Discussion:
HELP: Change the sampling time in gprof
p***@csee.wvu.edu
2004-05-25 15:09:33 UTC
Permalink
Hi,
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.if not please let me know the
correct 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...
any help will be appreciated.thank you.

regards,
Ranganath.
Nick Clifton
2004-05-26 15:05:34 UTC
Permalink
Hi Ranganath,
Post by p***@csee.wvu.edu
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.
Post by p***@csee.wvu.edu
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
p***@csee.wvu.edu
2004-05-26 17:15:49 UTC
Permalink
Hi Nick,
thanks for the reply.
You did not specify your host environment
I am working on debian linux 2.4.24-1-smp kernal
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
I may not be able to chage the profiler at this stage, so I will go for
the first option. can you tell me how to change the profil() function.is
this the function i have to change in this environment or is there some
thing else i should take care of.thanx in advance
regards,
Ranganath.
Hi Ranganath,
Post by p***@csee.wvu.edu
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.
Post by p***@csee.wvu.edu
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.
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
http://oprofile.sourceforge.net/about/
Cheers
Nick
Nick Clifton
2004-05-26 18:17:38 UTC
Permalink
Hi Ranganarth,
Post by p***@csee.wvu.edu
I am working on debian linux 2.4.24-1-smp kernal
On an x86 ? An AMD64 ? An alpha ? ....
Post by p***@csee.wvu.edu
Post by Nick Clifton
1. Alter the profil() function in your OS.
I may not be able to chage the profiler at this stage, so I will go for
the first option. can you tell me how to change the profil() function.is
this the function i have to change in this environment or is there some
thing else i should take care of.
Sorry this is a Linux kernel issue which is way beyond my limited
knowledge. Basically you will want to find the sources for the profil()
function in the kernel and then examine them to see if you can change
the sampling frequency. You will then have to rebuild your kernel with
this changed function in it before you can start generating profiles
with greater frequency samples.

Cheers
Nick
Ian Lance Taylor
2004-05-26 21:13:51 UTC
Permalink
Post by Nick Clifton
Hi Ranganarth,
Post by p***@csee.wvu.edu
I am working on debian linux 2.4.24-1-smp kernal
On an x86 ? An AMD64 ? An alpha ? ....
Post by p***@csee.wvu.edu
Post by Nick Clifton
1. Alter the profil() function in your OS.
I may not be able to chage the profiler at this stage, so I will go for
the first option. can you tell me how to change the profil() function.is
this the function i have to change in this environment or is there some
thing else i should take care of.
Sorry this is a Linux kernel issue which is way beyond my limited
knowledge. Basically you will want to find the sources for the
profil() function in the kernel and then examine them to see if you
can change the sampling frequency. You will then have to rebuild your
kernel with this changed function in it before you can start
generating profiles with greater frequency samples.
Actually, on GNU/Linux, profil is part of glibc. It's not a kernel
system call.

You should talk to the glibc people.

Ian
p***@csee.wvu.edu
2004-06-12 20:21:48 UTC
Permalink
Hi,
I am using gprof to profile the gcc compiler.i am getting huge profiles
.how can I find out where the execution started and where it ended, from
the profiler output.i didn't find that information in the gprof
documentation.can anyone help me figure this out.thank you in advance
regards
nath.
Ian Lance Taylor
2004-06-13 01:18:03 UTC
Permalink
Post by p***@csee.wvu.edu
I am using gprof to profile the gcc compiler.i am getting huge profiles
.how can I find out where the execution started and where it ended, from
the profiler output.i didn't find that information in the gprof
documentation.can anyone help me figure this out.thank you in advance
Profiling doesn't tell you where execution starts or stops.

It tells you how much it spent along the way.

Ian
Ben Elliston
2004-06-15 00:01:33 UTC
Permalink
Post by Ian Lance Taylor
Post by p***@csee.wvu.edu
I am using gprof to profile the gcc compiler.i am getting huge profiles
.how can I find out where the execution started and where it ended, from
the profiler output.i didn't find that information in the gprof
documentation.can anyone help me figure this out.thank you in advance
Profiling doesn't tell you where execution starts or stops.
The graph profile can provide limited information. The answer to the
original poster's question seems too easy, though: execution starts at
main() and ends at exit() :-)

Ben

Loading...