Message-ID: <379C511C.AE4D436D@student.uu.se> Date: Mon, 26 Jul 1999 14:14:21 +0200 From: Jonas Collberg X-Mailer: Mozilla 4.6 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Profiling problems. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com I get strange results when profiling the following test program (among others): // Start of program. #include 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.