Skip to content

RFC perf: Allow leader sampling on inherited events

Jiri Olsa lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest9 patches 26 repliesIn review
  2. v1 RFC5 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- detection of the kernel support
- added perf script support for period column
- separate kernel change for context_equiv change

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9perf: Remove redundant parent context check from context_equivkernel/events/core.c+0 -816 replies
2/9perf: Deny optimized switch for events read by PERF_SAMPLE_READkernel/events/core.c+12 -04 replies
3/9perf: Allow PERF_FORMAT_GROUP format on inherited eventskernel/events/core.c+2 -110 replies
4/9perf tools: Add support to traverse xyarraystools/perf/Makefile.perf tools/perf/tests/builtin-test.c tools/perf/tests/tests.h +3 more+48 -10 replies
5/9perf tools: Add pr_warning_once debug macrotools/perf/util/debug.h+12 -00 replies
6/9perf tools: Add hash of periods for struct perf_sample_idtools/perf/util/evsel.c tools/perf/util/evsel.h tools/perf/util/session.c+104 -70 replies
7/9perf tools: Allow PERF_FORMAT_GROUP for inherited eventstools/perf/perf.h tools/perf/util/evsel.c tools/perf/util/record.c+18 -10 replies
8/9perf script: Add period data columntools/perf/Documentation/perf-script.txt tools/perf/builtin-script.c+12 -23 replies
9/9perf script: Add period as a default output columntools/perf/builtin-script.c+6 -32 replies

Reviews trailers per patch

2 of 9 patches have a Reviewed-by or Acked-by.

PatchDavid Ahern
1/9
2/9
3/9
4/9
5/9
6/9
7/9
8/9A-b
9/9A-b

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

Read the v2 thread

Cover letter [RFCv2 0/9] perf: Allow leader sampling on inherited events

hi,
Jen-Cheng(Tommy) Huang reported the leader sampling not working on children processes:
http://www.mail-archive.com/[email protected]/msg01644.html

The leader sampling (example below) lets the group leader event (cycles) do the sampling and reads the rest of the group (cache-misses) via PERF_FORMAT_GROUP format.

Example:

  $ perf record -e '{cycles,cache-misses}:S' <workload>
  $ perf report --group

The perf report --group allows to see all events group data in single view.

The reason for leader sampling being switched off for inherited events, is that the kernel does no allow PERF_FORMAT_GROUP format on inherited events (which is used by leader sampling).

I switched on the PERF_FORMAT_GROUP format for inherited events with few other fixies in patches:
perf: Deny optimized switch for events read by PERF_SAMPLE_READ
perf: Allow PERF_FORMAT_GROUP format on inherited events

And I fixed perf tool code to be able to process data from children processes.

Anyway, I might have missed some other reason why this was never switched on in kernel, so sending this as RFC.

v2 changes:
- detection of the kernel support
- added perf script support for period column
- separate kernel change for context_equiv change

thanks for comments,
jirka

Cc Andi Kleen <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jen-Cheng(Tommy) Huang <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>

---
Jiri Olsa (9):
perf: Remove redundant parent context check from context_equiv
perf: Deny optimized switch for events read by PERF_SAMPLE_READ
perf: Allow PERF_FORMAT_GROUP format on inherited events perf tools: Add support to traverse xyarrays
perf tools: Add pr_warning_once debug macro
perf tools: Add hash of periods for struct perf_sample_id perf tools: Allow PERF_FORMAT_GROUP for inherited events perf script: Add period data column
perf script: Add period as a default output column

 kernel/events/core.c                     | 33 ++++++++++++++------------------
 tools/perf/Documentation/perf-script.txt |  2 +-
 tools/perf/Makefile.perf                 |  1 +
 tools/perf/builtin-script.c              | 21 +++++++++++++++++----
 tools/perf/perf.h                        |  1 +
 tools/perf/tests/builtin-test.c          |  4 ++++
 tools/perf/tests/tests.h                 |  1 +
 tools/perf/tests/xyarray.c               | 33 ++++++++++++++++++++++++++++++++
 tools/perf/util/debug.h                  | 12 ++++++++++++
 tools/perf/util/evsel.c                  | 19 ++++++++++++++++++-
 tools/perf/util/evsel.h                  |  5 ++++-
 tools/perf/util/record.c                 | 12 ++++++++++++
 tools/perf/util/session.c                | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
 tools/perf/util/xyarray.c                |  4 +++-
 tools/perf/util/xyarray.h                |  6 ++++++
 15 files changed, 214 insertions(+), 33 deletions(-)
 create mode 100644 tools/perf/tests/xyarray.c