public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Claudio Scordino <cloud.of.andor@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Task profiling in Linux
Date: Sun, 23 Oct 2005 22:49:38 +0200	[thread overview]
Message-ID: <200510232249.39236.cloud.of.andor@gmail.com> (raw)

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

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

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 
task

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,

            Claudio

             reply	other threads:[~2005-10-23 20:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-23 20:49 Claudio Scordino [this message]
2005-10-23 22:19 ` Task profiling in Linux Jon Masters
2005-10-23 22:31   ` Benoit Boissinot
2005-10-24  1:21 ` Peter Chubb
     [not found] ` <a36005b50510310915q53ded6e8y607a536992924e5a@mail.gmail.com>
2005-10-31 23:46   ` Claudio Scordino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200510232249.39236.cloud.of.andor@gmail.com \
    --to=cloud.of.andor@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox