This is the mail archive of the
mailing list for the GCC project.
Re: for getting profiling times in millsecond resolution.
- From: William Cohen <wcohen at redhat dot com>
- To: jayaraj <jayaraj at blr dot pin dot philips dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 22 Mar 2006 09:17:02 -0500
- Subject: Re: for getting profiling times in millsecond resolution.
- References: <1142848011.1649.45.camel@ingbtcpic2lx004>
I want to get the profiling data of an application in linux. Now I am
using -pg options of gcc for generating the profile data. then used
gprof for generating profiles. Here I am getting only in terms of
seconds. But I want in millisecond resolution. can anybody help me.
Thanks & regards
The sampling with the -pg profiling is fairly low resolution, 100
samples a second on linux. This would relate to about 10 milliseconds
per sample. The only way that you are going to get estimates for
functions in the millisecond if there are multiple calls to the funtion.
The accumulated time would be divided equally between the counted
function calls. You might make more runs over the same section of code
to accumulate more sample and function calls to get a better estimate of
If you are just looking for flat profilings with higher resolution, you
might look at OProfile. The sampling intervals can be much smaller.
However, you need to be careful on some processors because the time for
a clock cycle can be changed by power management.
If you know what sections of code you are interested in you might use
the timestamp register to read timing information and compute clock
cycles (time) spent in certain regions of code. Alternatively you might
use perfmon or perfctr to access performance counters (assuming that
the kernel has appropriate patches in it for these).