I\'m debugging an C application and I\'d like to know how much time it spends in a particular function.
I could change the source code and add some more code to do the m
Profiling is probably what you want. Take a look at prof or gprof.
UPDATE: After compilng with "cc -Wall -ggdb -pg -g3 -O2 diskhash.c -o diskhash" ( and running the program), "gprof -p diskhash" gives me:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
32.60 0.41 0.41 1 410.75 646.18 create_hashtab
31.80 0.81 0.40 5087692 0.00 0.00 hash_func
27.83 1.16 0.35 2543846 0.00 0.00 find_hash
2.78 1.20 0.04 2543846 0.00 0.00 chop_a_line
1.59 1.22 0.02 main
0.40 1.22 0.01 frame_dummy
0.00 1.22 0.00 4 0.00 0.00 map_da_file