* task-clock vs. cpu-clock; per-event documentation @ 2015-08-05 12:55 Milian Wolff 2015-08-05 13:07 ` Andreas Hollmann 0 siblings, 1 reply; 3+ messages in thread From: Milian Wolff @ 2015-08-05 12:55 UTC (permalink / raw) To: linux-perf-users 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-and-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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: task-clock vs. cpu-clock; per-event documentation 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 0 siblings, 1 reply; 3+ messages in thread From: Andreas Hollmann @ 2015-08-05 13:07 UTC (permalink / raw) To: Milian Wolff; +Cc: linux-perf-users Hi, I had the same question in 2013 and the best answer I got was (by David Ahern): 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. David 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-and-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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: task-clock vs. cpu-clock; per-event documentation 2015-08-05 13:07 ` Andreas Hollmann @ 2015-08-05 13:38 ` Milian Wolff 0 siblings, 0 replies; 3+ messages in thread From: Milian Wolff @ 2015-08-05 13:38 UTC (permalink / raw) To: Andreas Hollmann; +Cc: linux-perf-users 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-05 13:38 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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).