From: Milian Wolff <mail@milianw.de>
To: Andreas Hollmann <hollmann@in.tum.de>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: task-clock vs. cpu-clock; per-event documentation
Date: Wed, 05 Aug 2015 15:38:50 +0200 [thread overview]
Message-ID: <2546272.3bCUhbRkWq@milian-kdab2> (raw)
In-Reply-To: <CAGz0_-2CGffoKu7LG+ZA6=QkYFzts8=AVg=j7xYVHkCxJPtQSQ@mail.gmail.com>
On Wednesday 05 August 2015 15:07:28 Andreas Hollmann wrote:
> Hi,
>
> I had the same question in 2013 and the best answer I got was (by David
> Ahern):
Hello Andreas,
I found your email as well, but not the answer by David Ahern - thanks!
> cpu-clock is wall-clock based -- so samples are taken at regular
> intervals relative to walltime.
>
> I believe that task-clock is relative to the task run time. So,
> samples are taken at regular intervals relative to the process'
> runtime.
Hm, I seem to be missing some crucial information then. From the above, I'd
assume that cpu-clock would advance even when any other process is running on
the given CPU, and also that it would always be higher than the task-clock:
perf stat -e cpu-clock,task-clock find /tmp
Performance counter stats for 'find /tmp':
2.504951 cpu-clock (msec)
2.508933 task-clock (msec) # 0.726 CPUs utilized
0.003456557 seconds time elapsed
Here the task-clock is higher than the cpu-clock...? So what is a task in
Kernel speak? Is it a thread? A process?
Also, you say that cpu-clock samples are relative to walltime, but that is
only CPU walltime, i.e. excluding sleep or I/O time. And even then, cpu-clock
is limited to the process clock:
$ perf stat -e cpu-clock,task-clock sleep 1
Performance counter stats for 'sleep 1':
0.365390 cpu-clock (msec)
0.365318 task-clock (msec) # 0.000 CPUs utilized
1.000775593 seconds time elapsed
$ sudo perf stat -e cpu-clock,task-clock -a sleep 1
Performance counter stats for 'system wide':
8015.143460 cpu-clock (msec)
(100.00%)
8015.047445 task-clock (msec) # 8.006 CPUs utilized
1.001121827 seconds time elapsed
Bye
> 2015-08-05 14:55 GMT+02:00 Milian Wolff <mail@milianw.de>:
> > Hello all,
> >
> > I was asked by a colleague of mine what the difference between task-clock
> > and cpu-clock is. I found many similar questions on the web, but none
> > have a final answer:
> >
> > http://stackoverflow.com/questions/23965363/linux-perf-events-cpu-clock-an
> > d-task-clock-what-is-the-difference https://lkml.org/lkml/2010/11/3/373
> >
> > Could someone explain the difference between the two counters for a
> > non-kernel person? What is a task for that matter? When I compare the
> > counters on test applications, they deviate only marginally.
> >
> > In general, is there hope for more documentation on the individual
> > performance counters? Perf list shows what's available but has no
> > information whatsoever about the actual meaning of the counters. It would
> > be excellent to also explain how to interpret the counter, or in what
> > case you'd want to look at a given event.
> >
> > Thanks
> > --
> > Milian Wolff
> > mail@milianw.de
> > http://milianw.de
> > --
> > To unsubscribe from this list: send the line "unsubscribe
> > linux-perf-users" in the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Milian Wolff
mail@milianw.de
http://milianw.de
prev parent reply other threads:[~2015-08-05 13:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-05 12:55 task-clock vs. cpu-clock; per-event documentation Milian Wolff
2015-08-05 13:07 ` Andreas Hollmann
2015-08-05 13:38 ` Milian Wolff [this message]
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=2546272.3bCUhbRkWq@milian-kdab2 \
--to=mail@milianw.de \
--cc=hollmann@in.tum.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).