Information on profiling

Ian Lance Taylor iant@google.com
Tue Nov 10 15:40:00 GMT 2009


Harald Servat <harald.servat@bsc.es> writes:

>>>   In particular, I'm looking for information on (but not only):
>>>
>>>   * How GCC instruments user routines when compiling a C file using -p/-pg
>> 
>> It varies by target.  You need to look at the gcc backend for your
>> target.
>
>   Sorry, but I can't figure at what kind of backend are you referring
> to. Let's suppose I'm interested on i386 architecture and C compiled
> files, where in should I start looking?

gcc/config/i386/i386.h and gcc/config/i386/i386.c.


>>>   * Where I can find the instrumentation code (i.e., the code called at
>>> entry and exit points of user routines). Does it belongs to GCC package?
>>> Or maybe belongs to a foreign package lib GLIBC?
>> 
>> The entry/exit code is part of gcc.  The code that it calls is mostly
>> in gcc/libgcov.c.
>> 
>
>   Does it mean that the profile is built on top (or reuses code) from
> the code coverage mechanism?

Profiling is not built on top of code coverage.  As far as I know they
are more or less independent.

Ian



More information about the Gcc-help mailing list