* [PATCH v1] perf jevents: Allow duplicate metrics with different PMUs
@ 2025-04-02 18:38 Ian Rogers
2025-04-03 21:53 ` Ian Rogers
0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2025-04-02 18:38 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, James Clark, John Garry,
Xu Yang, linux-perf-users, linux-kernel, Thomas Falcon,
Weilin Wang
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] perf jevents: Allow duplicate metrics with different PMUs
2025-04-02 18:38 [PATCH v1] perf jevents: Allow duplicate metrics with different PMUs Ian Rogers
@ 2025-04-03 21:53 ` Ian Rogers
0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2025-04-03 21:53 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, James Clark, John Garry,
Xu Yang, linux-perf-users, linux-kernel, Thomas Falcon,
Weilin Wang
On Wed, Apr 2, 2025 at 11:38 AM Ian Rogers <irogers@google.com> wrote:
>
> 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):
This was triggered by this patch carried in Google's tree but not yet
merged into perf-tools-next:
https://lore.kernel.org/lkml/20240926173554.404411-10-irogers@google.com/
So please ignore.
Thanks,
Ian
> _pending_metrics.append(e)
>
>
> --
> 2.49.0.504.g3bcea36a83-goog
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-03 21:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 18:38 [PATCH v1] perf jevents: Allow duplicate metrics with different PMUs Ian Rogers
2025-04-03 21:53 ` Ian Rogers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox