I compiled and linked the program with -pg option. But when I run the
gprof
I only get this output
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 5 0.00 0.00 pmesg
Could someone point me what I am missing here. I need to find the time
spent on each function calls.
I barely remember using gprof.
I have found the simple shell command time(1) to be far more easier to
use and helpful.
I remember gprof reporting huge amounts of data. How did you get justI just posted the relevant output :)
one line?
There are plenty of profiling/monitoring tools in linux.
Why don't you try the other ones?
lsof(1), fstat(1) and so on.
I think you can simply
$ time ./a.out
for your immediate need.
As to why gprof results weird results, the answer might be far deeper
than what meets the eye.
As someone suggested you can try a few iterations.