From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
James Clark <james.clark@linaro.org>,
John Garry <john.g.garry@oracle.com>,
Xu Yang <xu.yang_2@nxp.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Thomas Falcon <thomas.falcon@intel.com>,
Weilin Wang <weilin.wang@intel.com>
Subject: [PATCH v1] perf jevents: Allow duplicate metrics with different PMUs
Date: Wed, 2 Apr 2025 11:38:06 -0700 [thread overview]
Message-ID: <20250402183806.3947021-1-irogers@google.com> (raw)
On hybrid machines the same metric may appear for cpu_atom and
cpu_core as well as being referenced from other metrics. The same
named metrics are required but on differing PMUs are required. Update
the jevents.py to handle this.
On (hybrid) Alderlake before:
```
$ perf stat -M tma_fp_divider -a sleep 1
event syntax error: '.._ACTIVE!3/,tma_core_bound/metric-id=tma_core_bound/,tma_backend_bound/metric-id=tma_..'
\___ Bad event or PMU
```
After:
```
$ perf stat -M tma_fp_divider -a sleep 1
Performance counter stats for 'system wide':
1,257,833,472 cpu_core/TOPDOWN.SLOTS/ # 0.0 % tma_fp_divider
45,870 cpu_core/ARITH.FPDIV_ACTIVE/
187,096,541 cpu_core/topdown-retiring/
199,533,380 cpu_core/topdown-mem-bound/
107,164,806 cpu_core/topdown-bad-spec/
214,281,782 cpu_core/CPU_CLK_UNHALTED.THREAD/
1,588,539 cpu_core/ARITH.DIV_ACTIVE/
538,842,818 cpu_core/topdown-fe-bound/
431,005,264 cpu_core/topdown-be-bound/
```
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/pmu-events/jevents.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py
index 36a5e5fa2a54..89f1ace2a697 100755
--- a/tools/perf/pmu-events/jevents.py
+++ b/tools/perf/pmu-events/jevents.py
@@ -481,7 +481,8 @@ def add_events_table_entries(item: os.DirEntry, topic: str) -> None:
for e in read_json_events(item.path, topic):
if e.name:
_pending_events.append(e)
- if e.metric_name and not any(e.metric_name == x.metric_name for x in _pending_metrics):
+ if e.metric_name and not any(e.metric_name == x.metric_name and
+ e.pmu == x.pmu for x in _pending_metrics):
_pending_metrics.append(e)
--
2.49.0.504.g3bcea36a83-goog
next reply other threads:[~2025-04-02 18:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 18:38 Ian Rogers [this message]
2025-04-03 21:53 ` [PATCH v1] perf jevents: Allow duplicate metrics with different PMUs Ian Rogers
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=20250402183806.3947021-1-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=james.clark@linaro.org \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=thomas.falcon@intel.com \
--cc=weilin.wang@intel.com \
--cc=xu.yang_2@nxp.com \
/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