Mail Archives: djgpp/1999/07/26/08:14:09
I get strange results when profiling the following test program (among
others):
// Start of program.
#include <conio.h>
void t_func1(void)
{
long i;
for(i = 0; i < 100000000; i++);
}
void t_func2(void)
{
long i;
for(i = 0; i < 100000000; i++);
}
int main(int argc, char *argv[])
{
t_func1();
t_func2();
return 0;
}
// End of program
The results I get (excerpt from the profiling output) are:
% cumulative self self total
time seconds seconds calls us/call
us/call name
100.00 0.06 0.06 1 55555.56 55555.56
t_func1(void)
0.00 0.06 0.00 1 0.00
55555.56 main
0.00 0.06 0.00 1 0.00
0.00 t_func2(void)
I.e. t_func1(void) takes 100 % of the time, when it should take only
about 50 %.
I use the option "-pg" both for compiling and linking. My gprof and gcc
versions are both 2.8.1.
Note:
Since I'm not a subscriber to the mailing list, I would appreciate if
you would send replies directly to me
(jonas DOT collberg DOT 8669 AT student DOT uu DOT se). Thanks.
- Raw text -