Re: [PATCH v4 07/17] perf jevents: Sort json files entries

From: John Garry
Date: Wed Aug 10 2022 - 11:56:18 EST


On 10/08/2022 15:23, Ian Rogers wrote:
We sort the attributes of the events alphabetically by attribute name,
right? Is there any advantage in this? Do we need it for later?

The sort order is given by the tuple:
(not j.desc is None, fix_none(j.topic), fix_none(j.name),
fix_none(j.pmu), fix_none(j.metric_name))
which is putting events with descriptions and topics before those
without, then sorting by name, then pmu and finally metric_name. The
advantage is that when we qsort alias events:
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/util/pmu.c?h=perf/core#n1759
the events are already in the sorted format, which should make the
code faster -

ok, so can you mention that in the commit message? Just writing that you want to replicate cmp_sevent from pmu.c does not tell us this clearly.

> it still has to qsort the sysfs events.

thanks,
John