Re: [PATCH] perf jevents: make events order more deterministic
From: Ian Rogers
Date: Mon Jul 06 2026 - 14:08:12 EST
On Mon, Jul 6, 2026 at 10:57 AM Nazar Kazakov
<nazar.kazakov@xxxxxxxxxxxxxxx> wrote:
>
> Some of the events have the same name, but differing descriptions. This
> leads to a non-deterministic sorting order, so fix by adding the
> description field to the order.
>
> Signed-off-by: Nazar Kazakov <nazar.kazakov@xxxxxxxxxxxxxxx>
This shouldn't be an issue; can you give an example? I mean, with:
$ perf stat -e event1,event1 true
There's only one meaning for what event1 is. There is wildcard
support, but that's not the same as having the same event more than
once, differing only by description. Note, I deliberately use events
with perf stat in the example because the metrics build on the regular
event parsing code.
Thanks,
Ian
> ---
> tools/perf/pmu-events/metric.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py
> index a91ccb5977f0..b3ab78a0ecb2 100644
> --- a/tools/perf/pmu-events/metric.py
> +++ b/tools/perf/pmu-events/metric.py
> @@ -623,7 +623,7 @@ class Metric:
>
> def __lt__(self, other):
> """Sort order."""
> - return self.name < other.name
> + return self.name < other.name or self.description < other.description
>
> def AddToMetricGroup(self, group):
> """Callback used when being added to a MetricGroup."""
> --
> 2.54.0
>