Information on profiling

View: New views
4 Messages — Rating Filter:   Alert me  

Information on profiling

by Harald Servat-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

  first of all, I don't know if this is the appropriate list to ask
about this subject. If it's not, sorry for the noise.

  Is there any pointer on how GCC deals to generate profiles (-p/-pg flags)?
  In particular, I'm looking for information on (but not only):

  * How GCC instruments user routines when compiling a C file using -p/-pg

  * 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?

  * Where is the alarm set (signal SIGALRM or SIGPROF)?

Thank you very much.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkr4A3wACgkQwMPeuqUCg9yL3gCfRyrmRlAeYyNqVjMtTv9NEZfN
AT8AnijOlrale22w4ctrQvRu9//nEL7B
=G4Jl
-----END PGP SIGNATURE-----

Re: Information on profiling

by Ian Lance Taylor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Harald Servat <harald.servat@...> 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

Re: Information on profiling

by Harald Servat-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hello,

En/na Ian Lance Taylor ha escrit:

> Harald Servat <harald.servat@...> 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.

  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?

>>   * 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?

Thank you very much.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkr5hzgACgkQwMPeuqUCg9xP8wCdFywki65ZrsoPZ+9Jys2CtceT
XtEAn0bsNjRXlsMYnxX+/H4aBLcGUmQW
=XlwU
-----END PGP SIGNATURE-----

Re: Information on profiling

by Ian Lance Taylor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Harald Servat <harald.servat@...> 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