Skip to content

Better fixes for grouping of events

Ian Rogers linux-perf-users lkml 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest11 patches 1 replyIn review
  2. v411 patches 6 repliesSuperseded
  3. v311 patches 3 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v210 patches14 repliesSuperseded
v110 patches16 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11libperf evlist: Avoid a use of evsel idxtools/lib/perf/evlist.c+6 -70 replies
2/11perf stat: Don't remove all grouped events when CPU maps disagreetools/perf/builtin-stat.c+15 -90 replies
3/11perf pmu: Earlier PMU auxtrace initializationtools/perf/arch/x86/util/auxtrace.c tools/perf/arch/x86/util/pmu.c+6 -60 replies
4/11perf stat: Modify the group testtools/perf/util/stat-shadow.c+1 -10 replies
5/11perf evsel: Allow const evsel for certain accessestools/perf/util/evsel.c tools/perf/util/evsel.h tools/perf/util/pmu.c +1 more+8 -80 replies
6/11perf evsel: Add function to compute group PMU nametools/perf/util/evsel.c tools/perf/util/evsel.h+25 -00 replies
7/11perf parse-events: Pass ownership of the group nametools/perf/util/parse-events.c tools/perf/util/parse-events.y+3 -20 replies
8/11perf parse-events: Sort and group parsed eventstools/perf/arch/x86/util/evlist.c tools/perf/util/evlist.h tools/perf/util/parse-events.c +2 more+136 -1520 replies
9/11perf evsel: Remove use_uncore_aliastools/perf/util/evsel.c tools/perf/util/evsel.h tools/perf/util/parse-events.c +2 more+11 -170 replies
10/11perf evlist: Remove nr_groupstools/lib/perf/evlist.c tools/lib/perf/include/internal/evlist.h tools/lib/perf/include/perf/evlist.h +12 more+45 -380 replies
11/11perf parse-events: Warn when events are regroupedtools/perf/tests/parse-events.c tools/perf/tests/pmu-events.c tools/perf/util/metricgroup.c +3 more+38 -160 replies

Reviews trailers per patch

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

PatchAdrian Hunter
1/11
2/11
3/11A-b
4/11
5/11
6/11
7/11
8/11
9/11
10/11
11/11

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

Read the v5 thread

Cover letter [PATCH v5 00/11] Better fixes for grouping of events

The rules for grouping events have grown more complex. Topdown events must be grouped, but flags like --metric-no-group and flags on metrics don't respect this. Uncore events may be expanded using wild cards for PMU names, but then the events need reordering so the group members are adjacent. Rather than fixing metrics, this change fixes the main event parsing code to first sort and then regroup evsels.

As this is shared functionality changes to it should cause concern. The change is done with the intent of simplifying and making more robust the grouping logic, examples are given. If additional changes are necessary, they are most likely necessary to the evsel__group_pmu_name logic as the code avoids breaking groups that are on the same "group" PMU. The group_pmu_name is a variant of the pmu_name tweaked in the case of software and aux events, that use groups in a slightly different manner to conventional events.

The code was manually tested as well as passing perf test on a Intel tigerlake CPU with intel-pt.

v5. Add Adrian's Acked-by on patch 3, add a fix to the warning logic
for multiple event groups as reported by Adrian.
v4. Move the Intel pmu->auxtrace initialization to the existing
perf_pmu__get_default_config as suggested by Adrian Hunter.
v3. Rename pmu_name to group_pmu_name and add patch to warn when
events are regrouped as requested by Namhyung.
v2. Fix up the commit message on 4/10 (thanks Arnaldo). Drop
unnecessary v1 5/10 (thanks Kan). evlist->core.nr_groups wasn't being correctly maintained after the sort/regrouping and so the new patch 10/10 removes that variable and computes it from the evlist when necessary, generally just tests.

Ian Rogers (11):
libperf evlist: Avoid a use of evsel idx
perf stat: Don't remove all grouped events when CPU maps disagree perf pmu: Earlier PMU auxtrace initialization
perf stat: Modify the group test
perf evsel: Allow const evsel for certain accesses perf evsel: Add function to compute group PMU name perf parse-events: Pass ownership of the group name perf parse-events: Sort and group parsed events
perf evsel: Remove use_uncore_alias
perf evlist: Remove nr_groups
perf parse-events: Warn when events are regrouped

 tools/lib/perf/evlist.c                  |  31 ++-
 tools/lib/perf/include/internal/evlist.h |   1 -
 tools/lib/perf/include/perf/evlist.h     |   1 +
 tools/perf/arch/x86/util/auxtrace.c      |   4 -
 tools/perf/arch/x86/util/evlist.c        |  39 ++--
 tools/perf/arch/x86/util/pmu.c           |   8 +-
 tools/perf/builtin-record.c              |   2 +-
 tools/perf/builtin-report.c              |   2 +-
 tools/perf/builtin-stat.c                |  24 +-
 tools/perf/tests/bpf.c                   |   1 -
 tools/perf/tests/parse-events.c          |  24 +-
 tools/perf/tests/pfm.c                   |  12 +-
 tools/perf/tests/pmu-events.c            |   2 +-
 tools/perf/util/evlist.c                 |   2 +-
 tools/perf/util/evlist.h                 |   8 +-
 tools/perf/util/evsel.c                  |  27 ++-
 tools/perf/util/evsel.h                  |   8 +-
 tools/perf/util/header.c                 |   3 +-
 tools/perf/util/metricgroup.c            |   3 +-
 tools/perf/util/parse-events.c           | 275 ++++++++++++-----------
 tools/perf/util/parse-events.h           |  14 +-
 tools/perf/util/parse-events.y           |  28 +--
 tools/perf/util/pfm.c                    |   1 -
 tools/perf/util/pmu.c                    |   6 +-
 tools/perf/util/python.c                 |   2 +-
 tools/perf/util/stat-shadow.c            |   2 +-
 26 files changed, 284 insertions(+), 246 deletions(-)
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog