This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Information on profiling
- From: Ian Lance Taylor <iant at google dot com>
- To: Harald Servat <harald dot servat at bsc dot es>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 09 Nov 2009 08:05:02 -0800
- Subject: Re: Information on profiling
- References: <4AF8037C.1070004@bsc.es>
Harald Servat <harald.servat@bsc.es> writes:
> Is there any pointer on how GCC deals to generate profiles (-p/-pg flags)?
There may be, but I doubt it.
> 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.
> * 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.
> * Where is the alarm set (signal SIGALRM or SIGPROF)?
That is usually handled by the C library. For glibc, which is used on
GNU/Linux, see the libc/gmon directory.
Ian