From: Ian Rogers <irogers@google.com>
To: andi@firstfloor.org
Cc: acme@kernel.org, ak@kernel.org, ak@linux.intel.com,
linux-perf-users@vger.kernel.org, namhyung@kernel.org,
Ian Rogers <irogers@google.com>
Subject: [PATCH v1 4/7] perf tools: Expose opt-in --hybrid-merge
Date: Sun, 23 Aug 2026 23:37:41 -0700 [thread overview]
Message-ID: <20260824063744.1533837-5-irogers@google.com> (raw)
In-Reply-To: <20260824063744.1533837-1-irogers@google.com>
Add --hybrid-merge flag to explicitly trigger event merging
non-interactively
for both perf-top and perf-report.
Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.1-pro
---
tools/perf/Documentation/perf-report.txt | 5 +++++
tools/perf/Documentation/perf-top.txt | 5 +++++
tools/perf/builtin-report.c | 6 ++++++
tools/perf/builtin-top.c | 9 ++++++++-
tools/perf/util/symbol.c | 1 +
5 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 22f87eaa3279..b7775b9260b7 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -573,6 +573,11 @@ include::itrace.txt[]
When displaying traceevent output, do not use print fmt or plugins.
-H::
+--hybrid-merge::
+ Merge matching events from all hybrid core PMUs into one
+ display. For example, if a wildcard expands to run on both p-cores and
+ e-cores, this aggregates them into a single view.
+
--hierarchy::
Enable hierarchical output. In the hierarchy mode, each sort key groups
samples based on the criteria and then sub-divide it using the lower
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index af3e4230c72f..05fe65cd77c5 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -43,6 +43,11 @@ Default is to monitor all CPUS.
encoding with the layout of the event control registers as described
by entries in /sys/bus/event_source/devices/cpu/format/*.
+--hybrid-merge::
+ Merge matching events from all hybrid core PMUs into one
+ display. For example, if a wildcard expands to run on both p-cores and
+ e-cores, this aggregates them into a single view.
+
--filter=<filter>::
Event filter. This option should follow an event selector (-e). For
syntax see linkperf:perf-record[1].
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 60d1f166629e..2fc81f4517e9 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1113,6 +1113,10 @@ static int __cmd_report(struct report *rep)
evlist__for_each_entry(session->evlist, pos)
rep->nr_entries += evsel__hists(pos)->nr_entries;
+ if (symbol_conf.hybrid_merge && evlist__can_merge_hybrid(session->evlist)) {
+ evlist__merge_hybrid(session->evlist, false);
+ }
+
if (use_browser == 0) {
if (verbose > 3)
perf_session__fprintf(session, stdout);
@@ -1446,6 +1450,8 @@ int cmd_report(int argc, const char **argv)
parse_branch_mode),
OPT_BOOLEAN(0, "branch-history", &branch_call_mode,
"add last branch records to call history"),
+ OPT_BOOLEAN(0, "hybrid-merge", &symbol_conf.hybrid_merge,
+ "merge the same event across hybrid core PMUs"),
OPT_STRING(0, "objdump", &objdump_path, "path",
"objdump binary to use for disassembly and annotations"),
OPT_STRING(0, "addr2line", &addr2line_path, "path",
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 570410599f1b..cf7ac2712696 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -320,7 +320,7 @@ static void perf_top__resort_hists(struct perf_top *t)
static void perf_top__print_sym_table(struct perf_top *top)
{
- char bf[160];
+ char bf[512];
int printed = 0;
const int win_width = top->winsize.ws_col - 1;
struct evsel *evsel = top->sym_evsel;
@@ -1321,6 +1321,9 @@ static int __cmd_top(struct perf_top *top)
if (ret)
return ret;
+ if (symbol_conf.hybrid_merge && evlist__can_merge_hybrid(top->evlist))
+ evlist__merge_hybrid(top->evlist, false);
+
top->session->evlist = top->evlist;
perf_session__set_id_hdr_size(top->session);
@@ -1490,6 +1493,8 @@ int cmd_top(int argc, const char **argv)
OPT_CALLBACK('e', "event", &parse_events_option_args, "event",
"event selector. use 'perf list' to list available events",
parse_events_option),
+ OPT_BOOLEAN(0, "hybrid-merge", &symbol_conf.hybrid_merge,
+ "merge the same event across hybrid core PMUs"),
OPT_CALLBACK(0, "filter", &top.evlist, "filter",
"event filter", parse_filter),
OPT_U64('c', "count", &opts->user_interval, "event period to sample"),
@@ -1724,6 +1729,8 @@ int cmd_top(int argc, const char **argv)
evlist__put(def_evlist);
}
+
+
status = evswitch__init(&top.evswitch, top.evlist, stderr);
if (status)
goto out_put_evlist;
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 94f9c8faedda..5cbb899e8fbd 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -73,6 +73,7 @@ struct symbol_conf symbol_conf = {
.symfs = "",
.symfs_layout_flat = false,
.event_group = true,
+ .hybrid_merge = false,
.inline_name = true,
.res_sample = 0,
.addr2line_timeout_ms = 5 * 1000,
--
2.55.0.766.g2966f0265a-goog
next prev parent reply other threads:[~2026-08-24 6:38 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 13:25 [PATCH v1] perf top: Merge hybrid common events Andi Kleen
2026-08-13 13:57 ` sashiko-bot
2026-08-17 19:40 ` Ian Rogers
2026-08-18 17:29 ` Andi Kleen
2026-08-19 2:58 ` Ian Rogers
2026-08-19 3:34 ` Andi Kleen
2026-08-19 4:16 ` Ian Rogers
2026-08-19 16:11 ` Andi Kleen
2026-08-19 17:58 ` Ian Rogers
2026-08-19 18:25 ` Andi Kleen
2026-08-19 22:18 ` Ian Rogers
2026-08-24 6:37 ` [PATCH v1 0/7] perf ui: Implement hybrid event merging for heterogeneous systems Ian Rogers
2026-08-24 6:37 ` [PATCH v1 1/7] perf evlist: Implement evlist__can_merge_hybrid using first_wildcard_match Ian Rogers
2026-08-24 6:53 ` sashiko-bot
2026-08-24 22:49 ` Andi Kleen
2026-08-25 4:01 ` Ian Rogers
2026-08-24 6:37 ` [PATCH v1 2/7] perf ui hist: Add support for aggregated total_period and merging entries cleanly Ian Rogers
2026-08-24 6:53 ` sashiko-bot
2026-08-24 6:37 ` [PATCH v1 3/7] perf ui browsers: Implement interactive 'M' keystroke to toggle hybrid event merging Ian Rogers
2026-08-24 6:49 ` sashiko-bot
2026-08-24 6:37 ` Ian Rogers [this message]
2026-08-24 6:52 ` [PATCH v1 4/7] perf tools: Expose opt-in --hybrid-merge sashiko-bot
2026-08-24 22:40 ` Andi Kleen
2026-08-25 3:33 ` Ian Rogers
2026-08-25 22:19 ` Arnaldo Carvalho de Melo
2026-08-24 6:37 ` [PATCH v1 5/7] perf Documentation: Add tip for hybrid event merging Ian Rogers
2026-08-24 6:40 ` sashiko-bot
2026-08-24 6:37 ` [PATCH v1 6/7] perf ui hist: Format group headers iteratively based on proportional visual allocations Ian Rogers
2026-08-24 6:53 ` sashiko-bot
2026-08-24 6:37 ` [PATCH v1 7/7] perf test: Expand top tests for --hybrid-merge Ian Rogers
2026-08-24 6:55 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260824063744.1533837-5-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=ak@kernel.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox