From: Frederic Weisbecker <fweisbec@gmail.com>
To: Christoph Bartoschek <bartoschek@gmx.de>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: Profiling a program's runtime
Date: Fri, 4 Feb 2011 18:16:06 +0100 [thread overview]
Message-ID: <20110204171604.GB1808@nowhere> (raw)
In-Reply-To: <ukft18-pba.ln1@burns.bruehl.pontohonk.de>
On Fri, Feb 04, 2011 at 03:38:53PM +0100, Christoph Bartoschek wrote:
> Hi,
>
> I would like to get a callgraph for the whole time a program runs. Is this
> possible with perf?
>
> Most profilers I know only show me where the cputime is spent. But I would
> like to know how the wall time is used and in which functions. It's hard for
> me to explain what I mean, therefore I try it with an example.
>
> I have a program that consists basically of three functions:
>
> func_calc() is a computationally intensive function.
> func_netw() is a function that reads requests from the network.
> func_disk() is a function that writes data to the filesystem.
>
> One execution of the program might last 10 seconds. 5 seconds of the time
> the programms waits for network requests in a call to read(). 3 seconds are
> spent for calculations in func_calc() and 2 seconds pass while the programm
> blocks on the write() requests in func_disk().
>
> Overall the profiler should tell me that 50% of runtime are used by
> func_netw(), 30% are used by func_calc() and 20% are used by func_disk().
>
> Most of the time I want to ignore the time the program spents to wait for
> the scheduler.
>
> How can such a profile be generated with perf?
If I understood you well, you make a difference between:
- profiling only the code executed by your task
- profiling any code executed while your task was existing,
which includes what happens on other CPUs and other tasks that
may share the same CPU? Everything in fact?
So for the case, you just launch:
perf record -g my_task
For the second case, use -a for system wide profiling while
your task exists:
./perf record -a -g my_task
Hope that helps.
next prev parent reply other threads:[~2011-02-04 17:16 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 [this message]
2011-02-04 17:41 ` Christoph Bartoschek
2011-02-04 17:47 ` Frederic Weisbecker
2011-02-04 18:10 ` David Ahern
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=20110204171604.GB1808@nowhere \
--to=fweisbec@gmail.com \
--cc=bartoschek@gmx.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).