This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: for getting profiling times in millsecond resolution.


jayaraj wrote:
Hi,

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

Jayaraj


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 the time.


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).

-Will


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]