HELP: Change the sampling time in gprof

Nick Clifton nickc@redhat.com
Wed May 26 15:38:00 GMT 2004


Hi Ranganath,

>    I am new to this group.I have a problem with gprof.I dont know if this
>    is the right place to ask this question.

It is the right place.

>    i am extracting the execution profiles of the test cases on gcc sing
> gprof.the output of the profile has all 0's for the self seconds colomn.is
> there any way to change the sample time so that i can get reasonable
> numbers in the colomn.default is 0.01 sec.i would like to change that to
> 0.001 or even lower...

Unfortunately the sampling rate is not controlled gprof itself.  Instead 
it is handled by the special function monstartup() which is called by a 
profiled program when it starts up.  On most systems this function will 
use the OS function profil() to set up the time-based sampling.

So your choices are:

   1. Alter the profil() function in your OS.
   2. Write your own monstartup() function and find some other way of 
generating the time samples.
   3. Use a different profiler which may be more suitable.  You did not 
specify your host environment so I cannot be more informative, but you 
should check out the oprofile project which might be what you need:

http://oprofile.sourceforge.net/about/

Cheers
   Nick





More information about the Binutils mailing list