[lkml]   [2005]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectTask profiling in Linux
Hi all.

I need some help to make profiling of an application on Linux. I need to
measure the computation time between different points of my program,
considering only the CPU time that the task has actually executed (i.e.
without the intervals of time that the task has been preempted by other

To accomplish that, I can't just read the current time in different parts of
the program, nor I can set and use a timer, because this wouldn't consider

I found out that Linux provides the getrusage() syscall which provides the
information that I need. This syscall also says both user and system times
used by the task, which is a very useful thing.

However, it has two main drawbacks:

- its precision is very low: I'm working with real-time tasks on a Athlon-64
and I need a more accurate estimation

- it can't be invoked by a generic task to know the execution time of another

The only idea that I had is to insert some hooks in the kernel functions and
use some high resolution timer to compute the time that my task has
actually executed. This timer starts whenever the task obtains the CPU, and is
stopped whenever the task yields the CPU.

Therefore, I just need to know which functions are invoked when a task starts
executing on the CPU and when it looses the CPU.

May somebody tell me which are those functions ?

If somebody has suggestions about how doing this profiling, let me know.

Many thanks,

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-10-23 22:52    [W:0.034 / U:22.508 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site