linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What unit is used by "period" for sleep time profiling?
@ 2016-02-23 14:08 Milian Wolff
  2016-02-23 17:45 ` Taeung Song
  0 siblings, 1 reply; 3+ messages in thread
From: Milian Wolff @ 2016-02-23 14:08 UTC (permalink / raw)
  To: perf group

[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]

Hey all,

following the "profiling sleep times" steps on the perf wiki at [1], we can 
get some "Period" numbers. The wiki e.g. shows a number of "502408738". To 
match the results to the code snippet, I believe the unit is 0.1ns - can 
somebody confirm that please? I.e. 79.59% of should match 40ms, and 20.15% 
should match the 10ms.

Where does this odd unit come from, and could I patch perf to display readable 
times instead?

To make things worse, I actually have trouble reproducing the values shown in 
the wiki - is there an off-by-one error somewhere?

time perf record -e ... sleep 5
real    0m5.224s
user    0m0.033s
sys     0m0.130s
perf inject ...
perf report --stdio --show-total-period -i perf.data

# Children      Self        Period  Trace output                             
# ........  ........  ............  .........................................
#
   100.00%   100.00%   40004252280  sleep:27134 [120] S ==> swapper/0:0 [120]
            |
            ---__schedule
               schedule
               do_nanosleep
               hrtimer_nanosleep
               sys_nanosleep
               entry_SYSCALL_64_fastpath
               __nanosleep
               0x4040ff
               0x403f58
               0x4016da
               __libc_start_main
               0x4017c9

My above formula would now tell me that sleep only slept for 4s, not 5s... 
That looks very wrong!

[1]: https://perf.wiki.kernel.org/index.php/Tutorial#Profiling_sleep_times

-- 
Milian Wolff | milian.wolff@kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5903 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What unit is used by "period" for sleep time profiling?
  2016-02-23 14:08 What unit is used by "period" for sleep time profiling? Milian Wolff
@ 2016-02-23 17:45 ` Taeung Song
  2016-02-23 19:29   ` Milian Wolff
  0 siblings, 1 reply; 3+ messages in thread
From: Taeung Song @ 2016-02-23 17:45 UTC (permalink / raw)
  To: Milian Wolff, perf group

Hi, Milian

On 02/23/2016 11:08 PM, Milian Wolff wrote:
> Hey all,
>
> following the "profiling sleep times" steps on the perf wiki at [1], we can
> get some "Period" numbers. The wiki e.g. shows a number of "502408738".

AFAIK,
When it comes to perf, "Period" means the number of occurrences
of an event, not the number of timer ticks.

The period is raw number of event count of sample.

Perf can collect partial samples from a lot of event
information(who/how much/when/etc.) or get all available samples.
(of course, there are some limits using actual hardware counters)

For example,

# perf record -e cycles -c 1000 sleep 5

As above, if -c option is used,
perf-record can collect a sample every 1000 occurrences
of event 'cycles' for 5 seconds. (sampling period = 1000)


Thanks,
Taeung

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What unit is used by "period" for sleep time profiling?
  2016-02-23 17:45 ` Taeung Song
@ 2016-02-23 19:29   ` Milian Wolff
  0 siblings, 0 replies; 3+ messages in thread
From: Milian Wolff @ 2016-02-23 19:29 UTC (permalink / raw)
  To: Taeung Song; +Cc: perf group

[-- Attachment #1: Type: text/plain, Size: 1126 bytes --]

On Wednesday, February 24, 2016 2:45:26 AM CET Taeung Song wrote:
> Hi, Milian
> 
> On 02/23/2016 11:08 PM, Milian Wolff wrote:
> > Hey all,
> > 
> > following the "profiling sleep times" steps on the perf wiki at [1], we
> > can
> > get some "Period" numbers. The wiki e.g. shows a number of "502408738".
> 
> AFAIK,
> When it comes to perf, "Period" means the number of occurrences
> of an event, not the number of timer ticks.
> 
> The period is raw number of event count of sample.
> 
> Perf can collect partial samples from a lot of event
> information(who/how much/when/etc.) or get all available samples.
> (of course, there are some limits using actual hardware counters)
> 
> For example,
> 
> # perf record -e cycles -c 1000 sleep 5
> 
> As above, if -c option is used,
> perf-record can collect a sample every 1000 occurrences
> of event 'cycles' for 5 seconds. (sampling period = 1000)

I know, but this does not apply to the sleep time profiling, does it?

-- 
Milian Wolff | milian.wolff@kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5903 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-23 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-23 14:08 What unit is used by "period" for sleep time profiling? Milian Wolff
2016-02-23 17:45 ` Taeung Song
2016-02-23 19:29   ` 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).