[lkml]   [2003]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: timing an application
I have a patch at that
adds a config item that times CPU usage at microsecond resolution. It's
for the 2.4.17 kernel, I don't know what the porting effort would be for

It's not a great patch, it would need some work to be really clean from
a code
quality point of view, but it does seem to work. With it you can use
to get the actual time your process has used between two points. It
works on
x86 and PPC.

Plus, obviously, this adds significant time to system calls and interrupts.


Chris Friesen wrote:

> Maciej Soltysiak wrote:
>> Hi,
>> being inspired by some book about optimizing c++ code i decided to do
>> timing of functions i wrote. I am using gettimeofday to set
>> two timeval structs and calculate the time between them.
>> But the results depend heavily on the load, also i reckon that this
>> is an innacurate timing.
>> Any ideas on timing a function, or a block of code? Maybe some kernel
>> timers or something.
> gettimeofday() is accurate. However, your task may be interrupted by
> other tasks, interrupts, etc.
> Your best bet may be to do many iterations of the routine in question
> and then
> do some statistical analysis of the results.
> Chris

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:32    [W:0.045 / U:0.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site