[PATCH v5 0/2] perf list: Remove duplicate PMUs

Ian Rogers posted 2 patches 2 years, 3 months ago
tools/perf/builtin-list.c         |  8 +++
tools/perf/util/pmu.c             | 17 ++++--
tools/perf/util/pmu.h             |  3 +-
tools/perf/util/pmus.c            | 99 ++++++++++++++++++++++++++++++-
tools/perf/util/pmus.h            |  2 +
tools/perf/util/print-events.h    |  1 +
tools/perf/util/s390-sample-raw.c |  3 +-
7 files changed, 123 insertions(+), 10 deletions(-)
[PATCH v5 0/2] perf list: Remove duplicate PMUs
Posted by Ian Rogers 2 years, 3 months ago
When there are multiple PMUs, differing by ordered suffixes, by
default only display one. This avoids repeated listing of events, in
particular when there are 10s of uncore PMUs. If "-v" is passed to
"perf list" then still list all PMUs.

Listing fewer PMU/event combinations helps speed the all PMU event
tests.

Before:
```
$ perf list
...
  uncore_imc_free_running_0/data_read/               [Kernel PMU event]
  uncore_imc_free_running_0/data_total/              [Kernel PMU event]
  uncore_imc_free_running_0/data_write/              [Kernel PMU event]
  uncore_imc_free_running_1/data_read/               [Kernel PMU event]
  uncore_imc_free_running_1/data_total/              [Kernel PMU event]
  uncore_imc_free_running_1/data_write/              [Kernel PMU event]
```

After:
```
$ perf list
...
  uncore_imc_free_running/data_read/                 [Kernel PMU event]
  uncore_imc_free_running/data_total/                [Kernel PMU event]
  uncore_imc_free_running/data_write/                [Kernel PMU event]
...
$ perf list -v
...
  uncore_imc_free_running_0/data_read/               [Kernel PMU event]
  uncore_imc_free_running_0/data_total/              [Kernel PMU event]
  uncore_imc_free_running_0/data_write/              [Kernel PMU event]
  uncore_imc_free_running_1/data_read/               [Kernel PMU event]
  uncore_imc_free_running_1/data_total/              [Kernel PMU event]
  uncore_imc_free_running_1/data_write/              [Kernel PMU event]
...
```

The PMUs are sorted by name then suffix as a part of this change.

v5: Improved the 2nd patch's commit message and removed an unused
    variable as suggested by Kan Liang <kan.liang@linux.intel.com>.
v4: Rebase on top of lazy PMU changes. Ignore numeric ordering due to
    gaps, suggested by Kan Liang <kan.liang@linux.intel.com>. Fold
    patches 2 & 3 as suggested by John Garry <john.g.garry@oracle.com>
    (done by accident as part of rebasing).
v3: Add detail to patch 1 sorting commit message about the suffix and
    why sorting is necessary.
v2: List all PMUs when "-v" is passed as suggested by John Garry
    <john.g.garry@oracle.com>.

Ian Rogers (2):
  perf pmus: Sort pmus by name then suffix
  perf pmus: Skip duplicate PMUs and don't print list suffix by default

 tools/perf/builtin-list.c         |  8 +++
 tools/perf/util/pmu.c             | 17 ++++--
 tools/perf/util/pmu.h             |  3 +-
 tools/perf/util/pmus.c            | 99 ++++++++++++++++++++++++++++++-
 tools/perf/util/pmus.h            |  2 +
 tools/perf/util/print-events.h    |  1 +
 tools/perf/util/s390-sample-raw.c |  3 +-
 7 files changed, 123 insertions(+), 10 deletions(-)

-- 
2.42.0.rc2.253.gd59a3bf2b4-goog
Re: [PATCH v5 0/2] perf list: Remove duplicate PMUs
Posted by kajoljain 2 years, 3 months ago
Hi,
 Patchset looks good to me.

Reviewed-by: Kajol Jain <kjain@linux.ibm.com>

Thanks,
Kajol Jain

On 8/25/23 19:22, Ian Rogers wrote:
> When there are multiple PMUs, differing by ordered suffixes, by
> default only display one. This avoids repeated listing of events, in
> particular when there are 10s of uncore PMUs. If "-v" is passed to
> "perf list" then still list all PMUs.
> 
> Listing fewer PMU/event combinations helps speed the all PMU event
> tests.
> 
> Before:
> ```
> $ perf list
> ...
>   uncore_imc_free_running_0/data_read/               [Kernel PMU event]
>   uncore_imc_free_running_0/data_total/              [Kernel PMU event]
>   uncore_imc_free_running_0/data_write/              [Kernel PMU event]
>   uncore_imc_free_running_1/data_read/               [Kernel PMU event]
>   uncore_imc_free_running_1/data_total/              [Kernel PMU event]
>   uncore_imc_free_running_1/data_write/              [Kernel PMU event]
> ```
> 
> After:
> ```
> $ perf list
> ...
>   uncore_imc_free_running/data_read/                 [Kernel PMU event]
>   uncore_imc_free_running/data_total/                [Kernel PMU event]
>   uncore_imc_free_running/data_write/                [Kernel PMU event]
> ...
> $ perf list -v
> ...
>   uncore_imc_free_running_0/data_read/               [Kernel PMU event]
>   uncore_imc_free_running_0/data_total/              [Kernel PMU event]
>   uncore_imc_free_running_0/data_write/              [Kernel PMU event]
>   uncore_imc_free_running_1/data_read/               [Kernel PMU event]
>   uncore_imc_free_running_1/data_total/              [Kernel PMU event]
>   uncore_imc_free_running_1/data_write/              [Kernel PMU event]
> ...
> ```
> 
> The PMUs are sorted by name then suffix as a part of this change.
> 
> v5: Improved the 2nd patch's commit message and removed an unused
>     variable as suggested by Kan Liang <kan.liang@linux.intel.com>.
> v4: Rebase on top of lazy PMU changes. Ignore numeric ordering due to
>     gaps, suggested by Kan Liang <kan.liang@linux.intel.com>. Fold
>     patches 2 & 3 as suggested by John Garry <john.g.garry@oracle.com>
>     (done by accident as part of rebasing).
> v3: Add detail to patch 1 sorting commit message about the suffix and
>     why sorting is necessary.
> v2: List all PMUs when "-v" is passed as suggested by John Garry
>     <john.g.garry@oracle.com>.
> 
> Ian Rogers (2):
>   perf pmus: Sort pmus by name then suffix
>   perf pmus: Skip duplicate PMUs and don't print list suffix by default
> 
>  tools/perf/builtin-list.c         |  8 +++
>  tools/perf/util/pmu.c             | 17 ++++--
>  tools/perf/util/pmu.h             |  3 +-
>  tools/perf/util/pmus.c            | 99 ++++++++++++++++++++++++++++++-
>  tools/perf/util/pmus.h            |  2 +
>  tools/perf/util/print-events.h    |  1 +
>  tools/perf/util/s390-sample-raw.c |  3 +-
>  7 files changed, 123 insertions(+), 10 deletions(-)
>
Re: [PATCH v5 0/2] perf list: Remove duplicate PMUs
Posted by Liang, Kan 2 years, 3 months ago

On 2023-08-25 9:52 a.m., Ian Rogers wrote:
> When there are multiple PMUs, differing by ordered suffixes, by
> default only display one. This avoids repeated listing of events, in
> particular when there are 10s of uncore PMUs. If "-v" is passed to
> "perf list" then still list all PMUs.
> 
> Listing fewer PMU/event combinations helps speed the all PMU event
> tests.
> 
> Before:
> ```
> $ perf list
> ...
>   uncore_imc_free_running_0/data_read/               [Kernel PMU event]
>   uncore_imc_free_running_0/data_total/              [Kernel PMU event]
>   uncore_imc_free_running_0/data_write/              [Kernel PMU event]
>   uncore_imc_free_running_1/data_read/               [Kernel PMU event]
>   uncore_imc_free_running_1/data_total/              [Kernel PMU event]
>   uncore_imc_free_running_1/data_write/              [Kernel PMU event]
> ```
> 
> After:
> ```
> $ perf list
> ...
>   uncore_imc_free_running/data_read/                 [Kernel PMU event]
>   uncore_imc_free_running/data_total/                [Kernel PMU event]
>   uncore_imc_free_running/data_write/                [Kernel PMU event]
> ...
> $ perf list -v
> ...
>   uncore_imc_free_running_0/data_read/               [Kernel PMU event]
>   uncore_imc_free_running_0/data_total/              [Kernel PMU event]
>   uncore_imc_free_running_0/data_write/              [Kernel PMU event]
>   uncore_imc_free_running_1/data_read/               [Kernel PMU event]
>   uncore_imc_free_running_1/data_total/              [Kernel PMU event]
>   uncore_imc_free_running_1/data_write/              [Kernel PMU event]
> ...
> ```
> 
> The PMUs are sorted by name then suffix as a part of this change.
> 
> v5: Improved the 2nd patch's commit message and removed an unused
>     variable as suggested by Kan Liang <kan.liang@linux.intel.com>.
> v4: Rebase on top of lazy PMU changes. Ignore numeric ordering due to
>     gaps, suggested by Kan Liang <kan.liang@linux.intel.com>. Fold
>     patches 2 & 3 as suggested by John Garry <john.g.garry@oracle.com>
>     (done by accident as part of rebasing).
> v3: Add detail to patch 1 sorting commit message about the suffix and
>     why sorting is necessary.
> v2: List all PMUs when "-v" is passed as suggested by John Garry
>     <john.g.garry@oracle.com>.
> 
> Ian Rogers (2):
>   perf pmus: Sort pmus by name then suffix
>   perf pmus: Skip duplicate PMUs and don't print list suffix by default


Reviewed-by: Kan Liang <kan.liang@linux.intel.com>

Thanks,
Kan

> 
>  tools/perf/builtin-list.c         |  8 +++
>  tools/perf/util/pmu.c             | 17 ++++--
>  tools/perf/util/pmu.h             |  3 +-
>  tools/perf/util/pmus.c            | 99 ++++++++++++++++++++++++++++++-
>  tools/perf/util/pmus.h            |  2 +
>  tools/perf/util/print-events.h    |  1 +
>  tools/perf/util/s390-sample-raw.c |  3 +-
>  7 files changed, 123 insertions(+), 10 deletions(-)
>
Re: [PATCH v5 0/2] perf list: Remove duplicate PMUs
Posted by Arnaldo Carvalho de Melo 2 years, 3 months ago
Em Fri, Aug 25, 2023 at 10:05:46AM -0400, Liang, Kan escreveu:
> On 2023-08-25 9:52 a.m., Ian Rogers wrote:
> > When there are multiple PMUs, differing by ordered suffixes, by
> > default only display one. This avoids repeated listing of events, in
> > particular when there are 10s of uncore PMUs. If "-v" is passed to
> > "perf list" then still list all PMUs.
> > 
> > Listing fewer PMU/event combinations helps speed the all PMU event
> > tests.
> > 
> > Before:
> > ```
> > $ perf list
> > ...
> >   uncore_imc_free_running_0/data_read/               [Kernel PMU event]
> >   uncore_imc_free_running_0/data_total/              [Kernel PMU event]
> >   uncore_imc_free_running_0/data_write/              [Kernel PMU event]
> >   uncore_imc_free_running_1/data_read/               [Kernel PMU event]
> >   uncore_imc_free_running_1/data_total/              [Kernel PMU event]
> >   uncore_imc_free_running_1/data_write/              [Kernel PMU event]
> > ```
> > 
> > After:
> > ```
> > $ perf list
> > ...
> >   uncore_imc_free_running/data_read/                 [Kernel PMU event]
> >   uncore_imc_free_running/data_total/                [Kernel PMU event]
> >   uncore_imc_free_running/data_write/                [Kernel PMU event]
> > ...
> > $ perf list -v
> > ...
> >   uncore_imc_free_running_0/data_read/               [Kernel PMU event]
> >   uncore_imc_free_running_0/data_total/              [Kernel PMU event]
> >   uncore_imc_free_running_0/data_write/              [Kernel PMU event]
> >   uncore_imc_free_running_1/data_read/               [Kernel PMU event]
> >   uncore_imc_free_running_1/data_total/              [Kernel PMU event]
> >   uncore_imc_free_running_1/data_write/              [Kernel PMU event]
> > ...
> > ```
> > 
> > The PMUs are sorted by name then suffix as a part of this change.
> > 
> > v5: Improved the 2nd patch's commit message and removed an unused
> >     variable as suggested by Kan Liang <kan.liang@linux.intel.com>.
> > v4: Rebase on top of lazy PMU changes. Ignore numeric ordering due to
> >     gaps, suggested by Kan Liang <kan.liang@linux.intel.com>. Fold
> >     patches 2 & 3 as suggested by John Garry <john.g.garry@oracle.com>
> >     (done by accident as part of rebasing).
> > v3: Add detail to patch 1 sorting commit message about the suffix and
> >     why sorting is necessary.
> > v2: List all PMUs when "-v" is passed as suggested by John Garry
> >     <john.g.garry@oracle.com>.
> > 
> > Ian Rogers (2):
> >   perf pmus: Sort pmus by name then suffix
> >   perf pmus: Skip duplicate PMUs and don't print list suffix by default
> 
> 
> Reviewed-by: Kan Liang <kan.liang@linux.intel.com>

Thanks, applied.

- Arnaldo