gprof vs -O3

Kaz Kylheku kaz@cafe.net
Wed Apr 15 13:12:00 GMT 1998


On Tuesday, April 14, 1998 10:37 AM, Neal Becker [SMTP:neal@ctd.comsat.com] 
wrote:
> Does gprof work with -O3?  I'm getting very strange results trying to
> use gprof on code compiled with -O3 egcs-1.0.2.

That's probably because -O3 enables the inlining of functions.
You will get strange results from gprof, because it will behave as
though some of your functions had ``disappeared'', and their
contributions to the running times folded into the caller.

There is nothing you can do about this; if you want to
profile the software with functions inlined, you will simply
not be able to tell how much time was spent in the
inlined code. You will only be able to tell how much time
was spent in the functions that integrated the inlined
code.

By comparing the results from -O2 and -O3 profiling,
you can make educated guesses about how well
the inlined code is doing.





More information about the Gcc mailing list