Mark Kirkwood
2005-Jun-07 10:23 UTC
5.4R - gcc/gprof profile not showing %time information
I profiled a program today, and discovered that the end result seems to
be missing information in the '%time' column - it is always zero. Has
something changed with respect to obtaining a profile?
Any suggestions welcome :-)
A simple example follows...
$ gcc -g -pg -o test test.c
$ ./test
$ gprof ./test test.gmon> test.gprof
test.c:
int
main() {
int i;
for (i=0;i<1000000;i++) {
}
return 0;
}
test.gprof:
% cumulative self self total
time seconds seconds calls ms/call ms/call name
0.0 0.00 0.00 1 0.00 0.00 __cxa_finalize [236]
0.0 0.00 0.00 1 0.00 0.00 __sys___sysctl [237]
0.0 0.00 0.00 1 0.00 0.00 _mcleanup (238)
0.0 0.00 0.00 1 0.00 0.00 _profil [239]
0.0 0.00 0.00 1 0.00 0.00 exit [1]
0.0 0.00 0.00 1 0.00 0.00 moncontrol [2]
0.0 0.00 0.00 1 0.00 0.00 sysctl [3]
Index by function name
[236] __cxa_finalize [239] _profil [3] sysctl
[237] __sys___sysctl [1] exit
(238) _mcleanup [2] moncontrol
regards
Mark
Mark Kirkwood
2005-Jun-07 11:24 UTC
5.4R - gcc/gprof profile not showing %time information
Danny Braniss wrote:> maybe if you run it on a i486 you'l be able to see something :-) > > your program takes less than 0.001 of a second, so there is nothing to show! >(chuckles) - yes indeed, you are correct. My example is crap - however I think your observation provides the key to explain what I am seeing: It is postgres I'm (trying to) profile, so there are several postmaster processes running and leaving postmaster.gmon's - so I guess some short-lived one is overwriting the 'interesting' one I actually want to see....I may need to use a single process backend or similar.... Thanks for making me think about this! Cheers Mark