Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1503487 > unrolled thread

[PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view

Started byJin Yao <yao.jin@linux.intel.com>
First post2016-10-19 03:30 +0200
Last post2016-10-19 18:30 +0200
Articles 6 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view Jin Yao <yao.jin@linux.intel.com> - 2016-10-19 03:30 +0200
    [PATCH 3/6] perf report: Create a symbol_conf flag for showing branch flag counting Jin Yao <yao.jin@linux.intel.com> - 2016-10-19 03:30 +0200
    Re: [PATCH 0/6] Show branch flags/cycles in perf report  --branch-history callgraph view Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-19 16:30 +0200
    Re: [PATCH 0/6] Show branch flags/cycles in perf report  --branch-history callgraph view Jiri Olsa <jolsa@redhat.com> - 2016-10-19 17:00 +0200
    Re: [PATCH 0/6] Show branch flags/cycles in perf report  --branch-history callgraph view Jiri Olsa <jolsa@redhat.com> - 2016-10-19 18:10 +0200
      Re: [PATCH 0/6] Show branch flags/cycles in perf report  --branch-history callgraph view "Jin, Yao" <yao.jin@linux.intel.com> - 2016-10-19 18:30 +0200

#1503487 — [PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view

FromJin Yao <yao.jin@linux.intel.com>
Date2016-10-19 03:30 +0200
Subject[PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view
Message-ID<stNRD-220-3@gated-at.bofh.it>
perf record -g -b ...
perf report --branch-history

Currently it only shows the branches from the LBR in the callgraph view.
It would be useful to annotate branch predictions and TSX aborts and
also timed LBR cycles also in the callgraph view.

This would allow a quick overview where branch predictions are and how
costly basic blocks are.

For example:

Overhead  Source:Line                                   Symbol     Shared Object   Predicted  Abort  Cycles
........  ............................................  .........  ..............  .........  .....  ......

  38.25%  div.c:45                                      [.] main   div             97.6%      0.0%   3
          |
          ---main div.c:42 (cycles:2)
             compute_flag div.c:28 (cycles:2)
             compute_flag div.c:27 (cycles:1)
             rand rand.c:28 (cycles:1)
             rand rand.c:28 (cycles:1)
             __random random.c:298 (cycles:1)
             __random random.c:297 (cycles:1)
             __random random.c:295 (cycles:1)
             __random random.c:295 (cycles:1)
             __random random.c:295 (cycles:1)
             __random random.c:295 (cycles:9)
             |
             |--36.73%--__random_r random_r.c:392 (cycles:9)
             |          __random_r random_r.c:357 (cycles:1)
             |          __random random.c:293 (cycles:1)
             |          __random random.c:293 (cycles:1)
             |          __random random.c:291 (cycles:1)
             |          __random random.c:291 (cycles:1)
             |          __random random.c:291 (cycles:1)
             |          __random random.c:288 (cycles:1)
             |          rand rand.c:27 (cycles:1)
             |          rand rand.c:26 (cycles:1)
             |          rand@plt +4194304 (cycles:1)
             |          rand@plt +4194304 (cycles:1)
             |          compute_flag div.c:25 (cycles:1)
             |          compute_flag div.c:22 (cycles:1)
             |          main div.c:40 (cycles:1)
             |          main div.c:40 (cycles:16)
             |          main div.c:39 (cycles:16)
             |          |
             |          |--29.93%--main div.c:39 (predicted:50.6%, cycles:1)
             |          |          main div.c:44 (predicted:50.6%, cycles:1)
             |          |          |
             |          |           --22.69%--main div.c:42 (cycles:2)

Predicted is hide in callchain entry if the branch is 100% predicted.
Abort is hide in callchain entry if the branch is 0 aborted.

Now stdio and browser modes are both supported.

Jin Yao (6):
  perf report: Add branch flag to callchain cursor node
  perf report: Caculate and return the branch counting in callchain
  perf report: Create a symbol_conf flag for showing branch flag
    counting
  perf report: Show branch info in callchain entry with stdio mode
  perf report: Show branch info in callchain entry with browser mode
  perf report: Display keys Predicted/Abort/Cycles in --branch-history

 tools/perf/Documentation/perf-report.txt |   8 ++
 tools/perf/builtin-report.c              |   9 +-
 tools/perf/ui/browsers/hists.c           |  15 ++-
 tools/perf/ui/stdio/hist.c               |  30 +++++-
 tools/perf/util/callchain.c              | 176 ++++++++++++++++++++++++++++++-
 tools/perf/util/callchain.h              |  16 ++-
 tools/perf/util/hist.c                   |   3 +
 tools/perf/util/hist.h                   |   3 +
 tools/perf/util/machine.c                |  56 +++++++---
 tools/perf/util/sort.c                   | 117 +++++++++++++++++++-
 tools/perf/util/sort.h                   |   3 +
 tools/perf/util/symbol.h                 |   1 +
 12 files changed, 411 insertions(+), 26 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1503488 — [PATCH 3/6] perf report: Create a symbol_conf flag for showing branch flag counting

FromJin Yao <yao.jin@linux.intel.com>
Date2016-10-19 03:30 +0200
Subject[PATCH 3/6] perf report: Create a symbol_conf flag for showing branch flag counting
Message-ID<stNRE-220-21@gated-at.bofh.it>
In reply to#1503487
Create a new flag show_branchflag_count in symbol_conf. The flag is used
to control if showing the branch information. The flag depends on if the
perf.data has branch data and if user chooses the "branch-history" option
in perf report command line.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
 tools/perf/builtin-report.c | 3 +++
 tools/perf/util/symbol.h    | 1 +
 2 files changed, 4 insertions(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 6e88460..c406393 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -905,6 +905,9 @@ repeat:
 	if (itrace_synth_opts.last_branch)
 		has_br_stack = true;
 
+	if (has_br_stack && branch_call_mode)
+		symbol_conf.show_branchflag_count = true;
+
 	/*
 	 * Branch mode is a tristate:
 	 * -1 means default, so decide based on the file having branch data.
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index d964844..2d0a905 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -100,6 +100,7 @@ struct symbol_conf {
 			show_total_period,
 			use_callchain,
 			cumulate_callchain,
+			show_branchflag_count,
 			exclude_other,
 			show_cpu_utilization,
 			initialized,
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1503674 — Re: [PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-10-19 16:30 +0200
SubjectRe: [PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view
Message-ID<su02v-2rf-85@gated-at.bofh.it>
In reply to#1503487
Em Wed, Oct 19, 2016 at 10:55:34AM +0200, Jiri Olsa escreveu:
> On Wed, Oct 19, 2016 at 04:46:02PM +0800, Jin, Yao wrote:
> > It's based on the current branch "remotes/origin/perf/core" of tip
> > (https://kernel.googlesource.com/pub/scm/linux/kernel/git/tip/tip.git).
> > 
> > Should the patch be based on the branch "remotes/origin/perf/core" of the
> > repo (https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git)?
> 
> yep, that's what we do normaly.. because Arnaldo has already
> some other new patches pilled up

Yeah, please use acme/perf/core, I'll split it into more manageable
chunks and get them feed to Ingo, when he starts processing perf/core
pull requests.

The first one to get into probably is the perf/vendor_events branch.

- Arnaldo

[toc] | [prev] | [next] | [standalone]


#1503801 — Re: [PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view

FromJiri Olsa <jolsa@redhat.com>
Date2016-10-19 17:00 +0200
SubjectRe: [PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view
Message-ID<su02v-2rf-91@gated-at.bofh.it>
In reply to#1503487
On Wed, Oct 19, 2016 at 04:46:02PM +0800, Jin, Yao wrote:
> It's based on the current branch "remotes/origin/perf/core" of tip
> (https://kernel.googlesource.com/pub/scm/linux/kernel/git/tip/tip.git).
> 
> Should the patch be based on the branch "remotes/origin/perf/core" of the
> repo (https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git)?

yep, that's what we do normaly.. because Arnaldo has already
some other new patches pilled up

thanks,
jirka

[toc] | [prev] | [next] | [standalone]


#1504022 — Re: [PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view

FromJiri Olsa <jolsa@redhat.com>
Date2016-10-19 18:10 +0200
SubjectRe: [PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view
Message-ID<su02v-2rf-87@gated-at.bofh.it>
In reply to#1503487
On Wed, Oct 19, 2016 at 05:25:47PM +0800, Jin Yao wrote:

SNIP

> Predicted is hide in callchain entry if the branch is 100% predicted.
> Abort is hide in callchain entry if the branch is 0 aborted.
> 
> Now stdio and browser modes are both supported.
> 
> Jin Yao (6):
>   perf report: Add branch flag to callchain cursor node
>   perf report: Caculate and return the branch counting in callchain
>   perf report: Create a symbol_conf flag for showing branch flag
>     counting
>   perf report: Show branch info in callchain entry with stdio mode
>   perf report: Show branch info in callchain entry with browser mode
>   perf report: Display keys Predicted/Abort/Cycles in --branch-history

is there a branch? or a commit which is this based on?
got errors when applying this on current Arnaldo's perf/core:

Applying: perf report: Add branch flag to callchain cursor node
error: patch failed: tools/perf/util/machine.c:1747
error: tools/perf/util/machine.c: patch does not apply
Patch failed at 0001 perf report: Add branch flag to callchain cursor node

thanks,
jirka

[toc] | [prev] | [next] | [standalone]


#1504093 — Re: [PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view

From"Jin, Yao" <yao.jin@linux.intel.com>
Date2016-10-19 18:30 +0200
SubjectRe: [PATCH 0/6] Show branch flags/cycles in perf report --branch-history callgraph view
Message-ID<su02v-2rf-89@gated-at.bofh.it>
In reply to#1504022
It's based on the current branch "remotes/origin/perf/core" of tip 
(https://kernel.googlesource.com/pub/scm/linux/kernel/git/tip/tip.git).

Should the patch be based on the branch "remotes/origin/perf/core" of 
the repo (https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git)?

If so, I'd like to resend the patch.

Thanks
Jin Yao

On 10/19/2016 4:26 PM, Jiri Olsa wrote:
> On Wed, Oct 19, 2016 at 05:25:47PM +0800, Jin Yao wrote:
>
> SNIP
>
>> Predicted is hide in callchain entry if the branch is 100% predicted.
>> Abort is hide in callchain entry if the branch is 0 aborted.
>>
>> Now stdio and browser modes are both supported.
>>
>> Jin Yao (6):
>>    perf report: Add branch flag to callchain cursor node
>>    perf report: Caculate and return the branch counting in callchain
>>    perf report: Create a symbol_conf flag for showing branch flag
>>      counting
>>    perf report: Show branch info in callchain entry with stdio mode
>>    perf report: Show branch info in callchain entry with browser mode
>>    perf report: Display keys Predicted/Abort/Cycles in --branch-history
> is there a branch? or a commit which is this based on?
> got errors when applying this on current Arnaldo's perf/core:
>
> Applying: perf report: Add branch flag to callchain cursor node
> error: patch failed: tools/perf/util/machine.c:1747
> error: tools/perf/util/machine.c: patch does not apply
> Patch failed at 0001 perf report: Add branch flag to callchain cursor node
>
> thanks,
> jirka

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web