Re: [PATCH 0/3] perf list: Collapse similar events across PMUs

From: Leo Yan
Date: Wed Mar 05 2025 - 04:27:03 EST


On Tue, Mar 04, 2025 at 01:49:12PM +0000, James Clark wrote:

[...]

> As some background, the original commit for deduplication, commit
> 3241d46f5f54 ("perf pmus: Sort/merge/aggregate PMUs like mrvl_ddr_pmu")
> mentions reducing the number of duplicate PMUs, and is presumably
> motivated by usability. But there are also other commits mentioning
> reducing openat()s, for example lazily loading formats 504026412162
> ("perf pmu: Make the loading of formats lazy"). Deduplicating based on
> the contents of the events/ folder is somewhat in contention with this
> reduction, but could be done along side some more lazy loading (like of
> the terms) and hashing the result of readdir() without opening any of
> the contents. JSON tables can have event name hashes calculated at build
> time if we want to consider them for deduplication too.
>
> Then with the events hash, PMU's can be sorted based on this and the
> 'Unit:' string can be constructed with a set of values that collapses
> adjacent suffixes to display as ranges. I believe that could remove the
> need for any further changes to duplication based on suffix, but still
> avoids over deduplication.

I did a test with a simulated platform with cortex-a510 and cortex-a710
cores, the result looks correct to me:

# perf list -d 2>&1 | grep br_mis_pred_retired -A 2
br_mis_pred_retired
[Instruction architecturally executed,mispredicted branch. Unit:
armv9_cortex_a510,armv9_cortex_a710]

Tested-by: Leo Yan <leo.yan@xxxxxxx>

However, I will have minor comments on two patches and reply
separately. Please take a look.

Thanks,
Leo