lkml.org 
[lkml]   [2019]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6] perf diff: Report noisy for cycles diff
On Tue, Aug 20, 2019 at 08:22:07PM +0800, Jin Yao wrote:
> This patch prints the stddev and hist for the cycles diff of
> program block. It can help us to understand if the cycles
> is noisy or not.
>
> This patch is inspired by Andi Kleen's patch
> https://lwn.net/Articles/600471/
>
> We create new option '--cycles-hist'.
>
> Example:
>
> perf record -b ./div
> perf record -b ./div
> perf diff -c cycles
>
> # Baseline [Program Block Range] Cycles Diff Shared Object Symbol
> # ........ ...................................................................... ................. ............................
> #
> 46.72% [div.c:40 -> div.c:40] 0 div [.] main
> 46.72% [div.c:42 -> div.c:44] 0 div [.] main
> 46.72% [div.c:42 -> div.c:39] 0 div [.] main
> 20.54% [random_r.c:357 -> random_r.c:394] 1 libc-2.27.so [.] __random_r
> 20.54% [random_r.c:357 -> random_r.c:380] 0 libc-2.27.so [.] __random_r
> 20.54% [random_r.c:388 -> random_r.c:388] 0 libc-2.27.so [.] __random_r
> 20.54% [random_r.c:388 -> random_r.c:391] 0 libc-2.27.so [.] __random_r
> 17.04% [random.c:288 -> random.c:291] 0 libc-2.27.so [.] __random
> 17.04% [random.c:291 -> random.c:291] 0 libc-2.27.so [.] __random
> 17.04% [random.c:293 -> random.c:293] 0 libc-2.27.so [.] __random
> 17.04% [random.c:295 -> random.c:295] 0 libc-2.27.so [.] __random
> 17.04% [random.c:295 -> random.c:295] 0 libc-2.27.so [.] __random
> 17.04% [random.c:298 -> random.c:298] 0 libc-2.27.so [.] __random
> 8.40% [div.c:22 -> div.c:25] 0 div [.] compute_flag
> 8.40% [div.c:27 -> div.c:28] 0 div [.] compute_flag
> 5.14% [rand.c:26 -> rand.c:27] 0 libc-2.27.so [.] rand
> 5.14% [rand.c:28 -> rand.c:28] 0 libc-2.27.so [.] rand
> 2.15% [rand@plt+0 -> rand@plt+0] 0 div [.] rand@plt
> 0.00% [kernel.kallsyms] [k] __x86_indirect_thunk_rax
> 0.00% [do_mmap+714 -> do_mmap+732] -10 [kernel.kallsyms] [k] do_mmap
> 0.00% [do_mmap+737 -> do_mmap+765] 1 [kernel.kallsyms] [k] do_mmap
> 0.00% [do_mmap+262 -> do_mmap+299] 0 [kernel.kallsyms] [k] do_mmap
> 0.00% [__x86_indirect_thunk_r15+0 -> __x86_indirect_thunk_r15+0] 7 [kernel.kallsyms] [k] __x86_indirect_thunk_r15
> 0.00% [native_sched_clock+0 -> native_sched_clock+119] -1 [kernel.kallsyms] [k] native_sched_clock
> 0.00% [native_write_msr+0 -> native_write_msr+16] -13 [kernel.kallsyms] [k] native_write_msr
>
> When we enable the option '--cycles-hist', the output is
>
> perf diff -c cycles --cycles-hist
>
> # Baseline [Program Block Range] Cycles Diff stddev/Hist Shared Object Symbol
> # ........ ...................................................................... ................. ................. ............................
> #
> 46.72% [div.c:40 -> div.c:40] 0 ± 37.8% ▁█▁▁██▁█ div [.] main
> 46.72% [div.c:42 -> div.c:44] 0 ± 49.4% ▁▁▂█▂▂▂▂ div [.] main
> 46.72% [div.c:42 -> div.c:39] 0 ± 24.1% ▃█▂▄▁▃▂▁ div [.] main
> 20.54% [random_r.c:357 -> random_r.c:394] 1 ± 33.5% ▅▂▁█▃▁▂▁ libc-2.27.so [.] __random_r
> 20.54% [random_r.c:357 -> random_r.c:380] 0 ± 39.4% ▁▁█▁██▅▁ libc-2.27.so [.] __random_r
> 20.54% [random_r.c:388 -> random_r.c:388] 0 libc-2.27.so [.] __random_r
> 20.54% [random_r.c:388 -> random_r.c:391] 0 ± 41.2% ▁▃▁▂█▄▃▁ libc-2.27.so [.] __random_r
> 17.04% [random.c:288 -> random.c:291] 0 ± 48.8% ▁▁▁▁███▁ libc-2.27.so [.] __random
> 17.04% [random.c:291 -> random.c:291] 0 ±100.0% ▁█▁▁▁▁▁▁ libc-2.27.so [.] __random
> 17.04% [random.c:293 -> random.c:293] 0 ±100.0% ▁█▁▁▁▁▁▁ libc-2.27.so [.] __random
> 17.04% [random.c:295 -> random.c:295] 0 ±100.0% ▁█▁▁▁▁▁▁ libc-2.27.so [.] __random
> 17.04% [random.c:295 -> random.c:295] 0 libc-2.27.so [.] __random
> 17.04% [random.c:298 -> random.c:298] 0 ± 75.6% ▃█▁▁▁▁▁▁ libc-2.27.so [.] __random
> 8.40% [div.c:22 -> div.c:25] 0 ± 42.1% ▁▃▁▁███▁ div [.] compute_flag
> 8.40% [div.c:27 -> div.c:28] 0 ± 41.8% ██▁▁▄▁▁▄ div [.] compute_flag
> 5.14% [rand.c:26 -> rand.c:27] 0 ± 37.8% ▁▁▁████▁ libc-2.27.so [.] rand
> 5.14% [rand.c:28 -> rand.c:28] 0 libc-2.27.so [.] rand
> 2.15% [rand@plt+0 -> rand@plt+0] 0 div [.] rand@plt
> 0.00% [kernel.kallsyms] [k] __x86_indirect_thunk_rax
> 0.00% [do_mmap+714 -> do_mmap+732] -10 [kernel.kallsyms] [k] do_mmap
> 0.00% [do_mmap+737 -> do_mmap+765] 1 [kernel.kallsyms] [k] do_mmap
> 0.00% [do_mmap+262 -> do_mmap+299] 0 [kernel.kallsyms] [k] do_mmap
> 0.00% [__x86_indirect_thunk_r15+0 -> __x86_indirect_thunk_r15+0] 7 [kernel.kallsyms] [k] __x86_indirect_thunk_r15
> 0.00% [native_sched_clock+0 -> native_sched_clock+119] -1 ± 38.5% ▄█▁ [kernel.kallsyms] [k] native_sched_clock
> 0.00% [native_write_msr+0 -> native_write_msr+16] -13 ± 47.1% ▁█▇▃▁▁ [kernel.kallsyms] [k] native_write_msr
>
> v6:
> ---
> 1. Jiri provides better code for using data__hpp_register() in ui_init().
> Use this code in v6.

Reviewed-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

\
 
 \ /
  Last update: 2019-08-21 08:59    [W:0.127 / U:30.888 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site