Skip to content

perf report: Add support for event group view (v9)

Namhyung Kim lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest19 patches 19 repliesIn review

v8 -> v9 from the cover letter

* split patches have multiple changes (Arnaldo)
* add --group option to perf evlist (Arnaldo)

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19perf tools: Keep group informationtools/perf/util/evlist.c tools/perf/util/evlist.h tools/perf/util/evsel.h +3 more+25 -11 reply
2/19perf tests: Add group test conditionstools/perf/tests/parse-events.c+28 -01 reply
3/19perf header: Add HEADER_GROUP_DESC featuretools/perf/builtin-record.c tools/perf/util/header.c tools/perf/util/header.h+169 -01 reply
4/19perf report: Make another loop for linking group histstools/perf/builtin-report.c tools/perf/util/symbol.h+14 -21 reply
5/19perf hists: Resort hist entries using group members for outputtools/perf/util/evsel.h tools/perf/util/hist.c+60 -11 reply
6/19perf ui/hist: Consolidate hpp helperstools/perf/ui/hist.c+84 -1541 reply
7/19perf hist browser: Convert hpp helpers to a functiontools/perf/ui/browsers/hists.c+32 -141 reply
8/19perf gtk/browser: Convert hpp helpers to a functiontools/perf/ui/gtk/hists.c+47 -211 reply
9/19perf ui/hist: Add support for event group viewtools/perf/ui/hist.c tools/perf/ui/stdio/hist.c+63 -11 reply
10/19perf hist browser: Move coloring logic to hpp functionstools/perf/ui/browsers/hists.c+42 -301 reply
11/19perf hist browser: Add suppport for event group viewtools/perf/ui/browsers/hists.c+57 -01 reply
12/19perf gtk/browser: Add support for event group viewtools/perf/ui/gtk/hists.c+52 -41 reply
13/19perf tools: Move ltrim() to util/string.ctools/perf/builtin-script.c tools/perf/util/string.c tools/perf/util/util.h+19 -121 reply
14/19perf gtk/browser: Trim column header string when event group enabledtools/perf/ui/gtk/hists.c+1 -11 reply
15/19perf report: Bypass non-leader events when event group is enabledtools/perf/builtin-report.c tools/perf/ui/browsers/hists.c tools/perf/ui/gtk/hists.c+43 -61 reply
16/19perf report: Show group description when event group is enabledtools/perf/builtin-report.c tools/perf/ui/browsers/hists.c tools/perf/ui/gtk/hists.c +2 more+84 -31 reply
17/19perf report: Add --group optiontools/perf/Documentation/perf-report.txt tools/perf/builtin-report.c+5 -01 reply
18/19perf report: Add report.group config optiontools/perf/builtin-report.c+13 -01 reply
19/19perf evlist: Add --group optiontools/perf/Documentation/perf-evlist.txt tools/perf/builtin-evlist.c tools/perf/util/evsel.c+33 -21 reply

Reviews trailers per patch

8 of 19 patches have a Reviewed-by or Acked-by.

PatchJiri Olsa
1/19A-b A-b
2/19A-b A-b
3/19A-b A-b
4/19A-b A-b
5/19A-b A-b
6/19
7/19
8/19
9/19
10/19
11/19
12/19
13/19
14/19
15/19A-b A-b
16/19A-b A-b
17/19A-b A-b
18/19
19/19

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

Read the v1 thread

Cover letter [PATCH 00/19] perf report: Add support for event group view (v9)

Hello,

This is a 9th attempt to enable event group view support to perf report.

The basic idea is link group member's hist entries to a leader so that they can be shown with leader's output together. The output is sorted by the leader's period and in turn first group member's and so on.

To use it, 'perf record' should group events when recording. And then perf report parses the saved group relation from file header and prints them together if --group option is provided. You can use 'perf evlist' command to see event group information:

  $ perf record -e '{ref-cycles,cycles}' noploop 1
  [ perf record: Woken up 2 times to write data ]
  [ perf record: Captured and wrote 0.385 MB perf.data (~16807 samples) ]
  $ perf evlist --group
  {ref-cycles,cycles}

With this example, default perf report will show you each event separately like this:

  $ perf report
  ...
  # group: {ref-cycles,cycles}
  # ========
  #
  # Samples: 3K of event 'ref-cycles'
  # Event count (approx.): 3153797218
  #
  # Overhead  Command      Shared Object                      Symbol
  # ........  .......  .................  ..........................
  #
      99.84%  noploop  noploop            [.] main                  
       0.07%  noploop  ld-2.15.so         [.] strcmp                
       0.03%  noploop  [kernel.kallsyms]  [k] timerqueue_del        
       0.03%  noploop  [kernel.kallsyms]  [k] sched_clock_cpu       
       0.02%  noploop  [kernel.kallsyms]  [k] account_user_time     
       0.01%  noploop  [kernel.kallsyms]  [k] __alloc_pages_nodemask
       0.00%  noploop  [kernel.kallsyms]  [k] native_write_msr_safe 

# Samples: 3K of event 'cycles'
# Event count (approx.): 3722310525
#
# Overhead Command Shared Object Symbol

  # ........  .......  .................  .........................
  #
      99.76%  noploop  noploop            [.] main                 
       0.11%  noploop  [kernel.kallsyms]  [k] _raw_spin_lock       
       0.06%  noploop  [kernel.kallsyms]  [k] find_get_page        
       0.03%  noploop  [kernel.kallsyms]  [k] sched_clock_cpu      
       0.02%  noploop  [kernel.kallsyms]  [k] rcu_check_callbacks  
       0.02%  noploop  [kernel.kallsyms]  [k] __current_kernel_time
       0.00%  noploop  [kernel.kallsyms]  [k] native_write_msr_safe

In this case the event group information will be shown in the end of header area. So you can use --group option to enable event group view.

  $ perf report --group
  ...
  # group: {ref-cycles,cycles}
  # ========
  #
  # Samples: 7K of event 'anon group { ref-cycles, cycles }'
  # Event count (approx.): 6876107743
  #
  #         Overhead  Command      Shared Object                      Symbol
  # ................  .......  .................  ..........................
  #
      99.84%  99.76%  noploop  noploop            [.] main                  
       0.07%   0.00%  noploop  ld-2.15.so         [.] strcmp                
       0.03%   0.00%  noploop  [kernel.kallsyms]  [k] timerqueue_del        
       0.03%   0.03%  noploop  [kernel.kallsyms]  [k] sched_clock_cpu       
       0.02%   0.00%  noploop  [kernel.kallsyms]  [k] account_user_time     
       0.01%   0.00%  noploop  [kernel.kallsyms]  [k] __alloc_pages_nodemask
       0.00%   0.00%  noploop  [kernel.kallsyms]  [k] native_write_msr_safe 
       0.00%   0.11%  noploop  [kernel.kallsyms]  [k] _raw_spin_lock        
       0.00%   0.06%  noploop  [kernel.kallsyms]  [k] find_get_page         
       0.00%   0.02%  noploop  [kernel.kallsyms]  [k] rcu_check_callbacks   
       0.00%   0.02%  noploop  [kernel.kallsyms]  [k] __current_kernel_time 

As you can see the Overhead column now contains both of ref-cycles and cycles and header line shows group information also - 'anon group { ref-cycles, cycles }'. The output is sorted by period of group leader first.

If perf.data file doesn't contain group information, this --group option does nothing. So if you want enable event group view by default you can set it in ~/.perfconfig file:

  $ cat ~/.perfconfig
  [report]
  group = true

It can be overridden with command line if you want:

  $ perf report --no-group

You can also get this on my 'perf/group-v9' branch in

git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git

Any comments are welcome, thanks.
Namhyung

Cc Jiri Olsa <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Pekka Enberg <[email protected]>

v8 -> v9:
* split patches have multiple changes (Arnaldo)
* add --group option to perf evlist (Arnaldo)

v7 -> v8:
* rebase onto acme/perf/core
* patch 3 in the previous version is merged
* add Jiri's Acked-by's

v6 -> v7:
* hists__{match,link} changes are merged separately
* factor out inc_group_count() from parsing group_def (Jiri)
* add checking for group fields in evlist/evsel (Jiri)
* check return value of during header processing (Arnaldo)
* get rid of a temporal array in hpp functions (Arnaldo)
* convert hpp macros to static inline functions (Jiri)

v5 -> v6:
* set ->leader alse for leader evsel (Arnaldo)
* use hists__{match,link} (Arnaldo)

v4 -> v5:
* rebase onto acme/perf/core

v3 -> v4:
* patch 1-9 in previous post are merged.
* add Jiri's Acked-by
* add report.group config option

v2 -> v3:
* drop patch 1 since it's merged into acme/perf/core
* cherry-pick Jiri's hpp changes
* add missing bswap_32 on reading nr_groups (Jiri)
* remove perf_evlist__recalc_nr_groups() in favor of list_is_last (Jiri)

v1 -> v2:
* save group relation to header (Jiri)

Namhyung Kim (19):
perf tools: Keep group information
perf tests: Add group test conditions
perf header: Add HEADER_GROUP_DESC feature
perf report: Make another loop for linking group hists perf hists: Resort hist entries using group members for output perf ui/hist: Consolidate hpp helpers
perf hist browser: Convert hpp helpers to a function
perf gtk/browser: Convert hpp helpers to a function
perf ui/hist: Add support for event group view
perf hist browser: Move coloring logic to hpp functions perf hist browser: Add suppport for event group view
perf gtk/browser: Add support for event group view
perf tools: Move ltrim() to util/string.c
perf gtk/browser: Trim column header string when event group enabled perf report: Bypass non-leader events when event group is enabled perf report: Show group description when event group is enabled perf report: Add --group option
perf report: Add report.group config option
perf evlist: Add --group option

 tools/perf/Documentation/perf-evlist.txt |   4 +
 tools/perf/Documentation/perf-report.txt |   3 +
 tools/perf/builtin-evlist.c              |   7 +
 tools/perf/builtin-record.c              |   3 +
 tools/perf/builtin-report.c              |  47 ++++-
 tools/perf/builtin-script.c              |  12 --
 tools/perf/tests/parse-events.c          |  28 +++
 tools/perf/ui/browsers/hists.c           | 217 ++++++++++++++++++----
 tools/perf/ui/gtk/hists.c                | 130 ++++++++++---
 tools/perf/ui/hist.c                     | 306 +++++++++++++++----------------
 tools/perf/ui/stdio/hist.c               |   2 +
 tools/perf/util/evlist.c                 |   7 +-
 tools/perf/util/evlist.h                 |   1 +
 tools/perf/util/evsel.c                  |  49 ++++-
 tools/perf/util/evsel.h                  |  16 ++
 tools/perf/util/header.c                 | 164 +++++++++++++++++
 tools/perf/util/header.h                 |   2 +
 tools/perf/util/hist.c                   |  59 +++++-
 tools/perf/util/parse-events.c           |   1 +
 tools/perf/util/parse-events.h           |   1 +
 tools/perf/util/parse-events.y           |  10 +
 tools/perf/util/string.c                 |  18 ++
 tools/perf/util/symbol.h                 |   3 +-
 tools/perf/util/util.h                   |   1 +
 24 files changed, 855 insertions(+), 236 deletions(-)
Signature · 1 line
1.7.11.7