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

From: Leo Yan
Date: Wed Mar 05 2025 - 04:50:12 EST


On Wed, Mar 05, 2025 at 09:35:45AM +0000, Leo Yan wrote:
> On Tue, Mar 04, 2025 at 01:49:14PM +0000, James Clark wrote:
> > Instead of showing multiple line items with the same event name and
> > description, show a single line and concatenate all PMUs that this
> > event can belong to.
> >
> > Don't do it for json output. Machine readable output doesn't need to be
> > minimized, and changing the "Unit" field to a list type would break
> > backwards compatibility.
> >
> > Before:
> > $ perf list -v
> > ...
> > br_indirect_spec
> > [Branch speculatively executed,indirect branch. Unit: armv8_cortex_a53]
> > br_indirect_spec
> > [Branch speculatively executed,indirect branch. Unit: armv8_cortex_a57]
> >
> > After:
> >
> > $ perf list -v
> > ...
> > br_indirect_spec
> > [Branch speculatively executed,indirect branch. Unit: armv8_cortex_a53,armv8_cortex_a57]
>
> From my testing, based on the latest tmp.perf-tools-next branch, I
> need to remove the option '-v'. Otherwise, the '-v' option will
> enable long event descriptions, in this case, it does _not_ print Unit
> strings at all (see default_print_event() in builtin-list.c).

Ah, actually I worked on the Linux master branch. After switched to
tmp.perf-tools-next branch, it works pretty well.

perf list -v 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]

Please ignore my previous comment. The series looks good to me.

Thanks,
Leo

> default_print_event()
> {
> ...
> if (long_desc && print_state->long_desc) {
> fprintf(fp, "%*s", 8, "[");
> wordwrap(fp, long_desc, 8, pager_get_columns(), 0);
> fprintf(fp, "]\n");
> } else if (desc && print_state->desc) {
> ...
> }
>
> The command `perf list` would be sufficent.

>
> Thanks,
> Leo
>