public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Jin Yao <yao.jin@linux.intel.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com,
	Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH v6] perf diff: Report noisy for cycles diff
Date: Wed, 21 Aug 2019 08:58:44 +0200	[thread overview]
Message-ID: <20190821065844.GA11701@krava> (raw)
In-Reply-To: <20190820122207.9723-1-yao.jin@linux.intel.com>

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

      reply	other threads:[~2019-08-21  7:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-20 12:22 [PATCH v6] perf diff: Report noisy for cycles diff Jin Yao
2019-08-21  6:58 ` Jiri Olsa [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=20190821065844.GA11701@krava \
    --to=jolsa@redhat.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.intel.com \
    /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