delorie.com/archives/browse.cgi | search |
From: | "Alex Vinokur" <alexvn AT bigfoot DOT com> |
Newsgroups: | comp.os.msdos.djgpp,gnu.gcc.help,gnu.utils.help |
Subject: | gcc -O3 & gprof |
Date: | Mon, 17 Mar 2003 13:59:33 +0200 |
Lines: | 109 |
Message-ID: | <b54db9$252aq3$1@ID-79865.news.dfncis.de> |
NNTP-Posting-Host: | pop03-2-ras5-p83.barak.net.il (212.150.100.83) |
X-Trace: | fu-berlin.de 1047902379 72428355 212.150.100.83 (16 [79865]) |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.50.4522.1200 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4522.1200 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
===================== Windows 2000 DJGPP 2.03 GNU gcc version 3.2.1 GNU gprof 2.13 ===================== Here is a simple program that has been profiled with using gprof. We can see that if the program is compiled with option -O3 then gprof's output doesn't contained called functions foo1() and foo2(). Any explanation ? ========= C code : BEGIN ========= /* File main.c */ int foo1 (int argc) { return argc; } int foo2 (int argc) { return argc; } int main(int argc) { return (foo1(argc) + foo2(argc)); } ========= C code : END =========== ========= Compiling & Running : BEGIN ========= % gcc -o a0.exe main.c -g -pg % a0.exe % gprof -b a0.exe Flat profile: Each sample counts as 0.0555556 seconds. no time accumulated % cumulative self self total time seconds seconds calls Ts/call Ts/call name 0.00 0.00 0.00 1 0.00 0.00 foo1 0.00 0.00 0.00 1 0.00 0.00 foo2 0.00 0.00 0.00 1 0.00 0.00 main [---omitted---] ----------------------------------------------- % gcc -O1 -o a1.exe main.c -g -pg % a1.exe % gprof -b a1.exe Flat profile: Each sample counts as 0.0555556 seconds. no time accumulated % cumulative self self total time seconds seconds calls Ts/call Ts/call name 0.00 0.00 0.00 1 0.00 0.00 foo1 0.00 0.00 0.00 1 0.00 0.00 foo2 0.00 0.00 0.00 1 0.00 0.00 main [---omitted---] ----------------------------------------------- % gcc -O2 -o a2.exe main.c -g -pg % a2.exe % gprof -b a2.exe Flat profile: Each sample counts as 0.0555556 seconds. no time accumulated % cumulative self self total time seconds seconds calls Ts/call Ts/call name 0.00 0.00 0.00 1 0.00 0.00 foo1 0.00 0.00 0.00 1 0.00 0.00 foo2 0.00 0.00 0.00 1 0.00 0.00 main [---omitted---] ----------------------------------------------- % gcc -O3 -o a3.exe main.c -g -pg % a3.exe % gprof -b a3.exe Flat profile: Each sample counts as 0.0555556 seconds. no time accumulated % cumulative self self total time seconds seconds calls Ts/call Ts/call name 0.00 0.00 0.00 1 0.00 0.00 main [---omitted---] ========= Compiling & Running : END =========== ================================= Alex Vinokur mailto:alexvn AT connect DOT to http://www.simtel.net/pub/oth/19088.html =================================
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |