Skip to content

perf report: Show branch type

Jin Yao lkml 10 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest7 patches 2 repliesIn review
  2. v97 patches 4 repliesSuperseded
  3. v87 patches 6 repliesSuperseded
Earlier versions · 7
VersionPostedPatchesRepliesStatus
v77 patches3 repliesSuperseded
v67 patches27 repliesSuperseded
v57 patches7 repliesSuperseded
v45 patches17 repliesSuperseded
v35 patches6 repliesSuperseded
v25 patches5 repliesSuperseded
v15 patches10 repliesSuperseded

Changes in v10 from the cover letter

----
According to Jiri Olsa's comment, update the patch "perf/x86/intel: Record branch type". Set the branch_map array to be static. The previous version has it on stack then makes the compiler to create it every time when the function gets called.

Patches in v10 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7perf/core: Define the common branch type classificationinclude/uapi/linux/perf_event.h tools/include/uapi/linux/perf_event.h+52 -22 replies
2/7perf/x86/intel: Record branch typearch/x86/events/intel/lbr.c+51 -10 replies
3/7perf record: Create a new option save_type in --branch-filtertools/perf/Documentation/perf-record.txt tools/perf/util/parse-branch-options.c+2 -00 replies
4/7perf report: Refactor the branch info printing codetools/perf/util/callchain.c+47 -590 replies
5/7perf util: Create branch.c/.h for common branch functionstools/perf/util/Build tools/perf/util/branch.c tools/perf/util/branch.h +1 more+194 -10 replies
6/7perf report: Show branch type statistics for stdio modetools/perf/builtin-report.c tools/perf/util/hist.c+26 -40 replies
7/7perf report: Show branch type in callchain entrytools/perf/util/callchain.c tools/perf/util/callchain.h tools/perf/util/machine.c+50 -190 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchMichael Ellerman
1/7A-b
2/7
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v10 thread

Cover letter [PATCH v10 0/7] perf report: Show branch type

v10:
----
According to Jiri Olsa's comment, update the patch "perf/x86/intel: Record branch type". Set the branch_map array to be static. The previous version has it on stack then makes the compiler to create it every time when the function gets called.

Other patches have been acked by Jiri Olsa and Michael Ellerman.

v9:
---
It only changes the patch "perf/x86/intel: Record branch type". Peter suggests to use __ffs() to find first bit. Yes, with this change, the code is simpler and clearer.

No other functional changes.

v8:
---
Change PERF_BR_NONE to PERF_BR_UNKNOWN according to Peter's comments. No other functional changes.

v7:
---
Redefine the common branch types according to review comments from Michael Ellerman <[email protected]>

Now the patch series just defines a minimum but more common set of branch types.

   PERF_BR_NONE            : unknown
   PERF_BR_COND            :conditional
   PERF_BR_UNCOND          : unconditional
   PERF_BR_IND             : indirect
   PERF_BR_CALL            : function call
   PERF_BR_IND_CALL        : indirect function call
   PERF_BR_RET             : function return
   PERF_BR_SYSCALL         : syscall
   PERF_BR_SYSRET          : syscall return
   PERF_BR_COND_CALL       : conditional function call
   PERF_BR_COND_RET        : conditional function return

v6:
---
Update according to the review comments from Jiri Olsa <[email protected]>. Major modifications are:

1. Move that multiline conditional code inside {} brackets.

2. Move branch_type_stat_display() from builtin-report.c to branch.c. Move branch_type_str() from callchain.c to branch.c.

3. Keep the original branch info display order, that is:
predicted, abort, cycles, iterations

v5:
---
Mainly the v5 patch series are updated according to comments from Jiri Olsa <[email protected]>.

The kernel part doesn't have functional change. It just solve the merge issue.

In userspace, the functions of branch type counting and branch type name resolving are moved to the new files:
util/branch.c, util/branch.h.

And refactor the branch info printing code for better maintenance.

Not changed (or just fix merge issue):
perf/core: Define the common branch type classification perf/x86/intel: Record branch type
perf record: Create a new option save_type in --branch-filter

New patches:
perf report: Refactor the branch info printing code perf util: Create branch.c/.h for common branch functions

Changed:
perf report: Show branch type statistics for stdio mode perf report: Show branch type in callchain entry

v4:
---
1. Describe the major changes in patch description. Thanks for Peter Zijlstra's reminding.

2. Initialize branch type to 0 in intel_pmu_lbr_read_32 and intel_pmu_lbr_read_64. Remove the invalid else code in intel_pmu_lbr_filter.

v3:
---
1. Move the JCC forward/backward and cross page computing from kernel to userspace.

2. Use lookup table to replace original switch/case processing.

Changed:
perf/core: Define the common branch type classification perf/x86/intel: Record branch type
perf report: Show branch type statistics for stdio mode perf report: Show branch type in callchain entry

Not changed:
perf record: Create a new option save_type in --branch-filter

v2:
---
1. Use 4 bits in perf_branch_entry to record branch type.

2. Pull out some common branch types from FAR_BRANCH. Now the branch types defined in perf_event.h:

Jin Yao (7):
perf/core: Define the common branch type classification perf/x86/intel: Record branch type
perf record: Create a new option save_type in --branch-filter perf report: Refactor the branch info printing code perf util: Create branch.c/.h for common branch functions perf report: Show branch type statistics for stdio mode perf report: Show branch type in callchain entry

 arch/x86/events/intel/lbr.c              |  52 +++++++++-
 include/uapi/linux/perf_event.h          |  27 ++++-
 tools/include/uapi/linux/perf_event.h    |  27 ++++-
 tools/perf/Documentation/perf-record.txt |   1 +
 tools/perf/builtin-report.c              |  25 +++++
 tools/perf/util/Build                    |   1 +
 tools/perf/util/branch.c                 | 166 +++++++++++++++++++++++++++++++
 tools/perf/util/branch.h                 |  25 +++++
 tools/perf/util/callchain.c              | 140 ++++++++++++++------------
 tools/perf/util/callchain.h              |   5 +-
 tools/perf/util/event.h                  |   3 +-
 tools/perf/util/hist.c                   |   5 +-
 tools/perf/util/machine.c                |  26 +++--
 tools/perf/util/parse-branch-options.c   |   1 +
 14 files changed, 420 insertions(+), 84 deletions(-)
 create mode 100644 tools/perf/util/branch.c
 create mode 100644 tools/perf/util/branch.h
Signature · 1 line
2.7.4