From: David Ahern <daahern@cisco.com>
To: Frederic Weisbecker <fweisbec@gmail.com>,
Christoph Bartoschek <bartoschek@gmx.de>
Cc: linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: Profiling a program's runtime
Date: Fri, 04 Feb 2011 11:10:13 -0700 [thread overview]
Message-ID: <4D4C4105.3050002@cisco.com> (raw)
In-Reply-To: <20110204174750.GD1808@nowhere>
On 02/04/11 10:47, Frederic Weisbecker wrote:
>> I want that not only the CPU time is counted that my task uses, but also the
>> time my task waits.
>
> The time your task waits, other tasks executes :-/ (including idle in the scheme)
>
>> For example, if my task waits for network packets in a read() then the time
>> should be added to the read() function. Other profilers I know would not
>> count the time when the process is blocked.
You can determine time blocked on read (and other system calls) by
acquiring all context switches:
perf record -e cs -c 1 -a
From there you'll want to generate a time history output. To use
unmodified perf code use the -D option to dump raw samples (perf report
-D). You can find the process of interest and the kernel timestamp
between schedule out events -- and the sched out event before your
process. Together you can piece together the time you blocked on read.
Alternatively, there are add-on patches which dump the timehistory in a
pretty print format:
http://www.mail-archive.com/linux-perf-users@vger.kernel.org/msg00049.html
http://www.mail-archive.com/linux-perf-users@vger.kernel.org/msg00047.html
http://www.mail-archive.com/linux-perf-users@vger.kernel.org/msg00048.html
That output can be manipulated much easier to determine time on the
processor and time between schedule-in events.
Not the complete picture of what I think you are looking for -- but a
way to get the time blocked on syscall stats via perf.
David
next prev parent reply other threads:[~2011-02-04 18:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-04 14:38 Profiling a program's runtime Christoph Bartoschek
2011-02-04 17:16 ` Frederic Weisbecker
2011-02-04 17:41 ` Christoph Bartoschek
2011-02-04 17:47 ` Frederic Weisbecker
2011-02-04 18:10 ` David Ahern [this message]
2011-02-04 18:33 ` Maucci, Cyrille
2011-02-04 19:48 ` Christoph Bartoschek
2011-02-04 19:57 ` Maucci, Cyrille
2011-02-07 20:38 ` Arnaldo Carvalho de Melo
2011-02-04 19:51 ` Christoph Bartoschek
2011-02-05 0:56 ` David Ahern
2011-02-04 19:24 ` Christoph Bartoschek
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=4D4C4105.3050002@cisco.com \
--to=daahern@cisco.com \
--cc=acme@redhat.com \
--cc=bartoschek@gmx.de \
--cc=fweisbec@gmail.com \
--cc=linux-perf-users@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.