Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH v2 0/9] perf report/top: Add opt-in --hybrid-merge
@ 2026-09-16  6:52 Ian Rogers
  2026-09-16  6:52 ` [PATCH v2 1/9] perf evlist: Implement evlist__can_merge_hybrid using first_wildcard_match Ian Rogers
                   ` (9 more replies)
  0 siblings, 10 replies; 64+ messages in thread
From: Ian Rogers @ 2026-09-16  6:52 UTC (permalink / raw)
  To: irogers, acme, ak, ak, andi, namhyung; +Cc: linux-perf-users

On a hybrid machine a wildcard event expands to one event per core
PMU, so "perf record -e cycles" records cpu_core/cycles/ and
cpu_atom/cycles/. perf report and perf top then show one histogram per
PMU, and a symbol that ran on both kinds of core is split across them,
with each percentage relative to its own PMU's total. There is no way
to ask for the single combined profile.

Add --hybrid-merge to perf report and perf top, which merges the
histograms of the events that came from the same wildcard into one,
with percentages taken against the summed period.

Merging is opt-in because it isn't always the right thing to do. The
cores differ in performance, so a merged cycles count mixes work done
at different rates and a merged IPC is not the IPC of either core
type. perf-tips notes this. When merging is possible but wasn't asked
for, the TUI says so, rather than merging silently.

core.hybrid-merge in .perfconfig turns it on by default. As a default
rather than an explicit request it yields to the command line: with
--hierarchy it is ignored with a warning, whereas asking for both
--hierarchy and --hybrid-merge on the command line is an error.

perf stat is deliberately untouched. Counting already has its own
merging options, and this is aimed at sampling.

The events to merge are found with first_wildcard_match, which parsing
fills in. perf report reads events from a file rather than parsing
them, so there the wildcard grouping is recovered by matching event
names, and core PMUs are identified from the perf.data header topology
so that a file recorded on another machine is read correctly.

Changes in v2:
 - The interactive 'M' keystroke that toggled merging in the hists
   browser is gone. Merging is now asked for on the command line or
   through core.hybrid-merge, and the browser instead points out that
   --hybrid-merge is available when there are events it could merge.
 - Fold "perf ui hist: Format group headers iteratively based on
   proportional visual allocations" into patch 2, as the two only make
   sense together.
 - New patch 5, so that enabling and disabling a merged set touches
   every event in it. The merged events are made members of a leader
   but are not a real group, so each still has to be toggled in its
   own right.
 - New patch 7, adding core.hybrid-merge.
 - New patch 9, so that "perf test" doesn't inherit the user's
   ~/.perfconfig. Without it, setting core.hybrid-merge breaks the
   output matching of unrelated shell tests.
 - Patch 8 adds a C test for the merging decision and a report shell
   test, rather than only extending the perf top test.
 - Rewrite the commit messages of patches 2, 3, 5 and 8 to describe
   the problem being solved rather than the diff.

Testing:

 - New "Hybrid event merging" perf test with three subtests: merging
   events of 2 core PMUs, of 3 core PMUs, and events that must not be
   merged.
 - New "perf report hybrid merge" shell test, and the perf top shell
   test extended.
 - perf test 13, 17, 27, 30, 31, 66, 67, 68, 78, 102, 113 and 172 pass,
   covering the hists, --hierarchy and addr2line paths this touches.
 - Builds in 13 configurations, and every patch builds on its own so
   the series stays bisectable.

Ian Rogers (9):
  perf evlist: Implement evlist__can_merge_hybrid using
    first_wildcard_match
  perf ui hist: Add support for aggregated total_period and merging
    entries
  perf tools: Expose opt-in --hybrid-merge
  perf Documentation: Add tip for hybrid event merging
  perf evlist: Toggle merged_hybrid_group properly in enable/disable
  perf tools: Add TUI hints for --hybrid-merge
  perf config: Add core.hybrid-merge to configure event merging
  perf test: Expand tests for --hybrid-merge
  perf test: Isolate test suite from user .perfconfig natively

 tools/perf/Documentation/perf-config.txt      |   8 +
 tools/perf/Documentation/perf-report.txt      |   5 +
 tools/perf/Documentation/perf-top.txt         |   5 +
 tools/perf/Documentation/tips.txt             |   2 +
 tools/perf/builtin-report.c                   |  25 ++
 tools/perf/builtin-top.c                      |  29 ++-
 tools/perf/tests/Build                        |   1 +
 tools/perf/tests/builtin-test.c               |  50 +++-
 tools/perf/tests/hybrid-merge.c               | 206 +++++++++++++++
 tools/perf/tests/shell/report_hybrid_merge.sh | 121 +++++++++
 tools/perf/tests/shell/top.sh                 |  73 +++++-
 tools/perf/tests/tests.h                      |   1 +
 tools/perf/ui/browsers/hists.c                |   7 +-
 tools/perf/ui/hist.c                          | 246 +++++++++++++++++-
 tools/perf/util/config.c                      |  10 +
 tools/perf/util/evlist.c                      | 230 +++++++++++++++-
 tools/perf/util/evlist.h                      |   3 +
 tools/perf/util/evsel.h                       |   1 +
 tools/perf/util/hist.h                        |  15 +-
 tools/perf/util/parse-events.c                |   4 +-
 tools/perf/util/pmu.c                         |  43 ++-
 tools/perf/util/pmu.h                         |   3 +
 tools/perf/util/symbol.c                      |   1 +
 tools/perf/util/symbol_conf.h                 |   1 +
 24 files changed, 1046 insertions(+), 44 deletions(-)
 create mode 100644 tools/perf/tests/hybrid-merge.c
 create mode 100755 tools/perf/tests/shell/report_hybrid_merge.sh


base-commit: 91b0782fc9e9d2f0a40b5256146e014802fdbb36
prerequisite-patch-id: b6fdc526887b71fb66f5fe0c0d41f7ef9493861e
prerequisite-patch-id: d47077f674c700f4f6296e9367f7ddfe004aea89
prerequisite-patch-id: ed0db23450840601762fe85ca1bef06ce6d28fe7
prerequisite-patch-id: d84e6b96d533ee6ed549e26e94216e2da60f7f74
prerequisite-patch-id: 6e8f19551d771621a5037096626cfe7e271b36f9
prerequisite-patch-id: 3768dfd588c7439deb741bce44c74763011c6be7
prerequisite-patch-id: babac99a4faa3b1525e44d3f34ab33a88103334c
prerequisite-patch-id: 5279827453fea1536abc620aa33c887c44e41ee9
prerequisite-patch-id: bdc0d648a577142b9270fb59b54496bc2bf8d5ea
prerequisite-patch-id: 9d468f113dffb082d74eb6d76e442b6ac69d9983
prerequisite-patch-id: 6f38fc0028b7d5eba7b8b646b402b8187bc3dbfa
prerequisite-patch-id: bc536fd240b5ddd999c781831a6445cb04ace25c
-- 
2.55.0.1032.g73a4cd73de-goog


^ permalink raw reply	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2026-09-18 23:04 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-16  6:52 [PATCH v2 0/9] perf report/top: Add opt-in --hybrid-merge Ian Rogers
2026-09-16  6:52 ` [PATCH v2 1/9] perf evlist: Implement evlist__can_merge_hybrid using first_wildcard_match Ian Rogers
2026-09-16  7:02   ` sashiko-bot
2026-09-16  6:52 ` [PATCH v2 2/9] perf ui hist: Add support for aggregated total_period and merging entries Ian Rogers
2026-09-16  7:04   ` sashiko-bot
2026-09-16  6:52 ` [PATCH v2 3/9] perf tools: Expose opt-in --hybrid-merge Ian Rogers
2026-09-16  7:04   ` sashiko-bot
2026-09-16  6:52 ` [PATCH v2 4/9] perf Documentation: Add tip for hybrid event merging Ian Rogers
2026-09-16  6:59   ` sashiko-bot
2026-09-16  6:52 ` [PATCH v2 5/9] perf evlist: Toggle merged_hybrid_group properly in enable/disable Ian Rogers
2026-09-16  7:06   ` sashiko-bot
2026-09-16  6:52 ` [PATCH v2 6/9] perf tools: Add TUI hints for --hybrid-merge Ian Rogers
2026-09-16  7:01   ` sashiko-bot
2026-09-16  6:52 ` [PATCH v2 7/9] perf config: Add core.hybrid-merge to configure event merging Ian Rogers
2026-09-16  6:59   ` sashiko-bot
2026-09-16  6:52 ` [PATCH v2 8/9] perf test: Expand tests for --hybrid-merge Ian Rogers
2026-09-16  7:04   ` sashiko-bot
2026-09-16  6:52 ` [PATCH v2 9/9] perf test: Isolate test suite from user .perfconfig natively Ian Rogers
2026-09-16  7:08   ` sashiko-bot
2026-09-16 23:46 ` [PATCH v3 0/9] perf report/top: Add opt-in --hybrid-merge Ian Rogers
2026-09-16 23:46   ` [PATCH v3 1/9] perf evlist: Implement evlist__can_merge_hybrid using first_wildcard_match Ian Rogers
2026-09-16 23:58     ` sashiko-bot
2026-09-16 23:46   ` [PATCH v3 2/9] perf ui hist: Add support for aggregated total_period and merging entries Ian Rogers
2026-09-16 23:57     ` sashiko-bot
2026-09-16 23:46   ` [PATCH v3 3/9] perf tools: Expose opt-in --hybrid-merge Ian Rogers
2026-09-16 23:57     ` sashiko-bot
2026-09-16 23:46   ` [PATCH v3 4/9] perf Documentation: Add tip for hybrid event merging Ian Rogers
2026-09-16 23:48     ` sashiko-bot
2026-09-16 23:46   ` [PATCH v3 5/9] perf evlist: Toggle merged_hybrid_group properly in enable/disable Ian Rogers
2026-09-16 23:53     ` sashiko-bot
2026-09-16 23:46   ` [PATCH v3 6/9] perf tools: Add TUI hints for --hybrid-merge Ian Rogers
2026-09-16 23:53     ` sashiko-bot
2026-09-16 23:46   ` [PATCH v3 7/9] perf config: Add core.hybrid-merge to configure event merging Ian Rogers
2026-09-16 23:57     ` sashiko-bot
2026-09-16 23:46   ` [PATCH v3 8/9] perf test: Expand tests for --hybrid-merge Ian Rogers
2026-09-16 23:53     ` sashiko-bot
2026-09-16 23:46   ` [PATCH v3 9/9] perf test: Isolate test suite from user .perfconfig natively Ian Rogers
2026-09-16 23:57     ` sashiko-bot
2026-09-17  5:06   ` [PATCH v4 0/9] perf report/top: Add opt-in --hybrid-merge Ian Rogers
2026-09-17  5:07     ` [PATCH v4 1/9] perf evlist: Implement evlist__can_merge_hybrid using first_wildcard_match Ian Rogers
2026-09-17  5:14       ` sashiko-bot
2026-09-17  5:07     ` [PATCH v4 2/9] perf ui hist: Add support for aggregated total_period and merging entries Ian Rogers
2026-09-17  5:16       ` sashiko-bot
2026-09-17  5:07     ` [PATCH v4 3/9] perf tools: Expose opt-in --hybrid-merge Ian Rogers
2026-09-17  5:16       ` sashiko-bot
2026-09-18 20:31       ` Arnaldo Carvalho de Melo
2026-09-18 20:51         ` Ian Rogers
2026-09-17  5:07     ` [PATCH v4 4/9] perf Documentation: Add tip for hybrid event merging Ian Rogers
2026-09-17  5:10       ` sashiko-bot
2026-09-17  5:07     ` [PATCH v4 5/9] perf evlist: Toggle merged_hybrid_group properly in enable/disable Ian Rogers
2026-09-17  5:13       ` sashiko-bot
2026-09-17  5:07     ` [PATCH v4 6/9] perf tools: Add TUI hints for --hybrid-merge Ian Rogers
2026-09-17  5:14       ` sashiko-bot
2026-09-17  5:07     ` [PATCH v4 7/9] perf config: Add core.hybrid-merge to configure event merging Ian Rogers
2026-09-17  5:16       ` sashiko-bot
2026-09-17  5:07     ` [PATCH v4 8/9] perf test: Expand tests for --hybrid-merge Ian Rogers
2026-09-17  5:18       ` sashiko-bot
2026-09-17  5:07     ` [PATCH v4 9/9] perf test: Isolate test suite from user .perfconfig natively Ian Rogers
2026-09-17  5:17       ` sashiko-bot
2026-09-18 20:40     ` [PATCH v4 0/9] perf report/top: Add opt-in --hybrid-merge Arnaldo Carvalho de Melo
2026-09-18 21:58       ` Arnaldo Carvalho de Melo
2026-09-18 22:07         ` Ian Rogers
2026-09-18 22:11           ` Ian Rogers
2026-09-18 23:04           ` Arnaldo Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox