[PATCH v9 00/16] New perf ilist app

Ian Rogers posted 16 patches 2 months, 1 week ago
There is a newer version of this series
tools/perf/builtin-list.c                     |  65 ++-
.../arch/common/common/software.json          |  92 +++
tools/perf/pmu-events/empty-pmu-events.c      | 266 +++++----
tools/perf/pmu-events/jevents.py              |  15 +-
tools/perf/python/ilist.py                    | 495 +++++++++++++++++
tools/perf/util/Build                         |   1 +
tools/perf/util/evsel.c                       |  21 +-
tools/perf/util/parse-events.c                | 198 ++-----
tools/perf/util/parse-events.h                |   1 -
tools/perf/util/parse-events.l                |  38 +-
tools/perf/util/parse-events.y                |  29 +-
tools/perf/util/pfm.c                         |   2 +
tools/perf/util/pmu.c                         |   7 +
tools/perf/util/pmus.c                        |   2 +
tools/perf/util/print-events.c                | 100 +---
tools/perf/util/print-events.h                |   4 +-
tools/perf/util/python.c                      | 522 +++++++++++++++++-
tools/perf/util/tp_pmu.c                      | 210 +++++++
tools/perf/util/tp_pmu.h                      |  19 +
19 files changed, 1646 insertions(+), 441 deletions(-)
create mode 100644 tools/perf/pmu-events/arch/common/common/software.json
create mode 100755 tools/perf/python/ilist.py
create mode 100644 tools/perf/util/tp_pmu.c
create mode 100644 tools/perf/util/tp_pmu.h
[PATCH v9 00/16] New perf ilist app
Posted by Ian Rogers 2 months, 1 week ago
This patch series builds up to the addition of a new ilist app written
in python using textual [1] for the UI. The app presents perf PMUs and
events, displays the event information as in `perf list` while at the
bottom of the console showing recent activity of the event in total
and across all CPUs. It also displays metrics, placed in a tree
through their metric group, again with counts being displayed in the
bottom panel.

The first ground work patches of fixes, cleanup and refactoring were
separated into their own series here:
https://lore.kernel.org/lkml/20250709214029.1769089-1-irogers@google.com/

The second part of the patches adds event json for the software PMU
and makes the tracepoint PMU support iteration of events and the
like. Without these improvements the tracepoint and software PMUs will
appear to have no events in the ilist app. As the software PMU moves
parsing to json, the legacy hard coded parsing is removed. This has
proven controversial for hardware events and so that cleanup isn't
done here.

The final patches expand the perf python APIs and add the ilist
command. To run it you need the updated perf.cpython.so in your
PYTHONPATH and then execute the script. Expanding PMUs and then
selecting events will cause event informatin to be displayed in the
top-right and the counters values to be displayed as sparklines and
counts in the bottom half of the screen.

[1] https://textual.textualize.io/

v9: sys metric support and pep8 clean up suggested by Xu Yang
    <xu.yang_2@nxp.com>.

v8: nit fixing of issues caught by Arnaldo and Namhyung. Add Arnaldo's
    tested-by. Fail to repro issue reported by Thomas Falcon but
    encounter textual rendering and DOM query race, add an exception
    handling path to avoid the race being fatal. The change is minor
    in patch 16, so Arnaldo's tested-by is kept.

v7: Better handle errors in the python code and ignore errors when
    scanning PMU/events in ilist.py, improving the behavior when not
    root. Add a tp_pmu/python clean up. Minor kernel coding style
    clean up. Fix behavior of ilist if a search result isn't found but
    then next is chosen.

v6: For metrics on hybrid systems don't purely match by name, also
    match the CPU and thread so that if the same metric exists for
    different PMUs the appropriate one is selected and counters may be
    read. Likewise use evsel maps and not the evlists.

v5: Split the series in two. Add metric support. Various clean ups and
    tweaks to the app in particular around the handling of searches.

v4: No conflict rebase. Picks up perf-tools-next DRM PMU which
    displays as expected.

v3: Add a search dialog to the ilist app with 'n'ext and 'p'revious
    keys. No changes in the ground work first 14 patches.

v2: In the jevents event description duplication, some minor changes
    accidentally missed from v1 meaning that in v1 the descriptions
    were still duplicated. Expand the cover letter with some thoughts
    on the series.

Ian Rogers (16):
  perf python: Add more exceptions on error paths
  perf jevents: Add common software event json
  perf parse-events: Remove non-json software events
  perf tp_pmu: Factor existing tracepoint logic to new file
  perf tp_pmu: Add event APIs
  perf list: Remove tracepoint printing code
  perf list: Skip ABI PMUs when printing pmu values
  perf python: Improve the tracepoint function if no libtraceevent
  perf python: Add basic PMU abstraction and pmus sequence
  perf python: Add function returning dictionary of all events on a PMU
  perf ilist: Add new python ilist command
  perf python: Add parse_metrics function
  perf python: Add evlist metrics function
  perf python: Add evlist compute_metric
  perf python: Add metrics function
  perf ilist: Add support for metrics

 tools/perf/builtin-list.c                     |  65 ++-
 .../arch/common/common/software.json          |  92 +++
 tools/perf/pmu-events/empty-pmu-events.c      | 266 +++++----
 tools/perf/pmu-events/jevents.py              |  15 +-
 tools/perf/python/ilist.py                    | 495 +++++++++++++++++
 tools/perf/util/Build                         |   1 +
 tools/perf/util/evsel.c                       |  21 +-
 tools/perf/util/parse-events.c                | 198 ++-----
 tools/perf/util/parse-events.h                |   1 -
 tools/perf/util/parse-events.l                |  38 +-
 tools/perf/util/parse-events.y                |  29 +-
 tools/perf/util/pfm.c                         |   2 +
 tools/perf/util/pmu.c                         |   7 +
 tools/perf/util/pmus.c                        |   2 +
 tools/perf/util/print-events.c                | 100 +---
 tools/perf/util/print-events.h                |   4 +-
 tools/perf/util/python.c                      | 522 +++++++++++++++++-
 tools/perf/util/tp_pmu.c                      | 210 +++++++
 tools/perf/util/tp_pmu.h                      |  19 +
 19 files changed, 1646 insertions(+), 441 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/common/common/software.json
 create mode 100755 tools/perf/python/ilist.py
 create mode 100644 tools/perf/util/tp_pmu.c
 create mode 100644 tools/perf/util/tp_pmu.h

-- 
2.50.1.552.g942d659e1b-goog
Re: [PATCH v9 00/16] New perf ilist app
Posted by Howard Chu 2 months ago
Hi Ian,

On Fri, Jul 25, 2025 at 11:52 AM Ian Rogers <irogers@google.com> wrote:
>
> This patch series builds up to the addition of a new ilist app written
> in python using textual [1] for the UI. The app presents perf PMUs and
> events, displays the event information as in `perf list` while at the
> bottom of the console showing recent activity of the event in total
> and across all CPUs. It also displays metrics, placed in a tree
> through their metric group, again with counts being displayed in the
> bottom panel.
>
> The first ground work patches of fixes, cleanup and refactoring were
> separated into their own series here:
> https://lore.kernel.org/lkml/20250709214029.1769089-1-irogers@google.com/
>
> The second part of the patches adds event json for the software PMU
> and makes the tracepoint PMU support iteration of events and the
> like. Without these improvements the tracepoint and software PMUs will
> appear to have no events in the ilist app. As the software PMU moves
> parsing to json, the legacy hard coded parsing is removed. This has
> proven controversial for hardware events and so that cleanup isn't
> done here.
>
> The final patches expand the perf python APIs and add the ilist
> command. To run it you need the updated perf.cpython.so in your
> PYTHONPATH and then execute the script. Expanding PMUs and then
> selecting events will cause event informatin to be displayed in the
> top-right and the counters values to be displayed as sparklines and
> counts in the bottom half of the screen.
>
> [1] https://textual.textualize.io/
>

Methinks this is a great series that opens up a ton of possibilities.
Fwiw, here are my opinions:

1)
Hitting enter while searching directly activates the collection, I'd
rather hit enter twice for more control.

2)
steps to execution:
~~~
sudo -s
source /home/howard/venv/bin/activate
pip install textual
PYTHONPATH=/tmp/perf/python python/ilist.py
~~~
For me, it's a lot of commands--especially since I need to install the
textual package myself. If the process were simplified or
well-documented on the perf wiki, I would have no problem entering all
the commands.

I don't have any issue running ilist.py using shabam (#!/usr/bin/env
python3), but to improve it slightly, ilist.py should be renamed to
ilist, just like b4 and yum.

3)
It would be better if the TreeNode could expand to the full height in
the left window when not collecting events, but only show their event
names, their parent, and positions.

4)
It'd be nice if I can pause the event collection.

5)
Sparkline's height can be bigger.

6)
If this is an interactive command that collects the count of events
why not name it istat? ilist sounds like reading the menu without
placing an order.

I apologize for the delay.

Thanks,
Howard
Re: [PATCH v9 00/16] New perf ilist app
Posted by Howard Chu 2 months ago
Hello Ian,

On Fri, Jul 25, 2025 at 11:52 AM Ian Rogers <irogers@google.com> wrote:
>
> This patch series builds up to the addition of a new ilist app written
> in python using textual [1] for the UI. The app presents perf PMUs and
> events, displays the event information as in `perf list` while at the
> bottom of the console showing recent activity of the event in total
> and across all CPUs. It also displays metrics, placed in a tree
> through their metric group, again with counts being displayed in the
> bottom panel.
>
> The first ground work patches of fixes, cleanup and refactoring were
> separated into their own series here:
> https://lore.kernel.org/lkml/20250709214029.1769089-1-irogers@google.com/
>
> The second part of the patches adds event json for the software PMU
> and makes the tracepoint PMU support iteration of events and the
> like. Without these improvements the tracepoint and software PMUs will
> appear to have no events in the ilist app. As the software PMU moves
> parsing to json, the legacy hard coded parsing is removed. This has
> proven controversial for hardware events and so that cleanup isn't
> done here.
>
> The final patches expand the perf python APIs and add the ilist
> command. To run it you need the updated perf.cpython.so in your
> PYTHONPATH and then execute the script. Expanding PMUs and then
> selecting events will cause event informatin to be displayed in the
> top-right and the counters values to be displayed as sparklines and
> counts in the bottom half of the screen.
>
> [1] https://textual.textualize.io/
>
> v9: sys metric support and pep8 clean up suggested by Xu Yang
>     <xu.yang_2@nxp.com>.
>
> v8: nit fixing of issues caught by Arnaldo and Namhyung. Add Arnaldo's
>     tested-by. Fail to repro issue reported by Thomas Falcon but
>     encounter textual rendering and DOM query race, add an exception
>     handling path to avoid the race being fatal. The change is minor
>     in patch 16, so Arnaldo's tested-by is kept.
>
> v7: Better handle errors in the python code and ignore errors when
>     scanning PMU/events in ilist.py, improving the behavior when not
>     root. Add a tp_pmu/python clean up. Minor kernel coding style
>     clean up. Fix behavior of ilist if a search result isn't found but
>     then next is chosen.
>
> v6: For metrics on hybrid systems don't purely match by name, also
>     match the CPU and thread so that if the same metric exists for
>     different PMUs the appropriate one is selected and counters may be
>     read. Likewise use evsel maps and not the evlists.
>
> v5: Split the series in two. Add metric support. Various clean ups and
>     tweaks to the app in particular around the handling of searches.
>
> v4: No conflict rebase. Picks up perf-tools-next DRM PMU which
>     displays as expected.
>
> v3: Add a search dialog to the ilist app with 'n'ext and 'p'revious
>     keys. No changes in the ground work first 14 patches.
>
> v2: In the jevents event description duplication, some minor changes
>     accidentally missed from v1 meaning that in v1 the descriptions
>     were still duplicated. Expand the cover letter with some thoughts
>     on the series.
>
> Ian Rogers (16):
>   perf python: Add more exceptions on error paths
>   perf jevents: Add common software event json
>   perf parse-events: Remove non-json software events
>   perf tp_pmu: Factor existing tracepoint logic to new file
>   perf tp_pmu: Add event APIs
>   perf list: Remove tracepoint printing code
>   perf list: Skip ABI PMUs when printing pmu values
>   perf python: Improve the tracepoint function if no libtraceevent
>   perf python: Add basic PMU abstraction and pmus sequence
>   perf python: Add function returning dictionary of all events on a PMU
>   perf ilist: Add new python ilist command
>   perf python: Add parse_metrics function
>   perf python: Add evlist metrics function
>   perf python: Add evlist compute_metric
>   perf python: Add metrics function
>   perf ilist: Add support for metrics
>
>  tools/perf/builtin-list.c                     |  65 ++-
>  .../arch/common/common/software.json          |  92 +++
>  tools/perf/pmu-events/empty-pmu-events.c      | 266 +++++----
>  tools/perf/pmu-events/jevents.py              |  15 +-
>  tools/perf/python/ilist.py                    | 495 +++++++++++++++++
>  tools/perf/util/Build                         |   1 +
>  tools/perf/util/evsel.c                       |  21 +-
>  tools/perf/util/parse-events.c                | 198 ++-----
>  tools/perf/util/parse-events.h                |   1 -
>  tools/perf/util/parse-events.l                |  38 +-
>  tools/perf/util/parse-events.y                |  29 +-
>  tools/perf/util/pfm.c                         |   2 +
>  tools/perf/util/pmu.c                         |   7 +
>  tools/perf/util/pmus.c                        |   2 +
>  tools/perf/util/print-events.c                | 100 +---
>  tools/perf/util/print-events.h                |   4 +-
>  tools/perf/util/python.c                      | 522 +++++++++++++++++-
>  tools/perf/util/tp_pmu.c                      | 210 +++++++
>  tools/perf/util/tp_pmu.h                      |  19 +
>  19 files changed, 1646 insertions(+), 441 deletions(-)
>  create mode 100644 tools/perf/pmu-events/arch/common/common/software.json
>  create mode 100755 tools/perf/python/ilist.py
>  create mode 100644 tools/perf/util/tp_pmu.c
>  create mode 100644 tools/perf/util/tp_pmu.h

Reviewed-by: Howard Chu <howardchu95@gmail.com>

Thanks a lot,
Howard

>
> --
> 2.50.1.552.g942d659e1b-goog
>
Re: [PATCH v9 00/16] New perf ilist app
Posted by Namhyung Kim 2 months, 1 week ago
On Fri, Jul 25, 2025 at 11:51:46AM -0700, Ian Rogers wrote:
> This patch series builds up to the addition of a new ilist app written
> in python using textual [1] for the UI. The app presents perf PMUs and
> events, displays the event information as in `perf list` while at the
> bottom of the console showing recent activity of the event in total
> and across all CPUs. It also displays metrics, placed in a tree
> through their metric group, again with counts being displayed in the
> bottom panel.
> 
> The first ground work patches of fixes, cleanup and refactoring were
> separated into their own series here:
> https://lore.kernel.org/lkml/20250709214029.1769089-1-irogers@google.com/
> 
> The second part of the patches adds event json for the software PMU
> and makes the tracepoint PMU support iteration of events and the
> like. Without these improvements the tracepoint and software PMUs will
> appear to have no events in the ilist app. As the software PMU moves
> parsing to json, the legacy hard coded parsing is removed. This has
> proven controversial for hardware events and so that cleanup isn't
> done here.
> 
> The final patches expand the perf python APIs and add the ilist
> command. To run it you need the updated perf.cpython.so in your
> PYTHONPATH and then execute the script. Expanding PMUs and then
> selecting events will cause event informatin to be displayed in the
> top-right and the counters values to be displayed as sparklines and
> counts in the bottom half of the screen.
> 
> [1] https://textual.textualize.io/
> 
> v9: sys metric support and pep8 clean up suggested by Xu Yang
>     <xu.yang_2@nxp.com>.
> 
> v8: nit fixing of issues caught by Arnaldo and Namhyung. Add Arnaldo's
>     tested-by. Fail to repro issue reported by Thomas Falcon but
>     encounter textual rendering and DOM query race, add an exception
>     handling path to avoid the race being fatal. The change is minor
>     in patch 16, so Arnaldo's tested-by is kept.
> 
> v7: Better handle errors in the python code and ignore errors when
>     scanning PMU/events in ilist.py, improving the behavior when not
>     root. Add a tp_pmu/python clean up. Minor kernel coding style
>     clean up. Fix behavior of ilist if a search result isn't found but
>     then next is chosen.
> 
> v6: For metrics on hybrid systems don't purely match by name, also
>     match the CPU and thread so that if the same metric exists for
>     different PMUs the appropriate one is selected and counters may be
>     read. Likewise use evsel maps and not the evlists.
> 
> v5: Split the series in two. Add metric support. Various clean ups and
>     tweaks to the app in particular around the handling of searches.
> 
> v4: No conflict rebase. Picks up perf-tools-next DRM PMU which
>     displays as expected.
> 
> v3: Add a search dialog to the ilist app with 'n'ext and 'p'revious
>     keys. No changes in the ground work first 14 patches.
> 
> v2: In the jevents event description duplication, some minor changes
>     accidentally missed from v1 meaning that in v1 the descriptions
>     were still duplicated. Expand the cover letter with some thoughts
>     on the series.
> 
> Ian Rogers (16):
>   perf python: Add more exceptions on error paths
>   perf jevents: Add common software event json
>   perf parse-events: Remove non-json software events
>   perf tp_pmu: Factor existing tracepoint logic to new file
>   perf tp_pmu: Add event APIs
>   perf list: Remove tracepoint printing code
>   perf list: Skip ABI PMUs when printing pmu values
>   perf python: Improve the tracepoint function if no libtraceevent
>   perf python: Add basic PMU abstraction and pmus sequence
>   perf python: Add function returning dictionary of all events on a PMU
>   perf ilist: Add new python ilist command
>   perf python: Add parse_metrics function
>   perf python: Add evlist metrics function
>   perf python: Add evlist compute_metric
>   perf python: Add metrics function
>   perf ilist: Add support for metrics

Applied patch 2-7 to perf-tools-next, thanks!

Best regards,
Namhyung

> 
>  tools/perf/builtin-list.c                     |  65 ++-
>  .../arch/common/common/software.json          |  92 +++
>  tools/perf/pmu-events/empty-pmu-events.c      | 266 +++++----
>  tools/perf/pmu-events/jevents.py              |  15 +-
>  tools/perf/python/ilist.py                    | 495 +++++++++++++++++
>  tools/perf/util/Build                         |   1 +
>  tools/perf/util/evsel.c                       |  21 +-
>  tools/perf/util/parse-events.c                | 198 ++-----
>  tools/perf/util/parse-events.h                |   1 -
>  tools/perf/util/parse-events.l                |  38 +-
>  tools/perf/util/parse-events.y                |  29 +-
>  tools/perf/util/pfm.c                         |   2 +
>  tools/perf/util/pmu.c                         |   7 +
>  tools/perf/util/pmus.c                        |   2 +
>  tools/perf/util/print-events.c                | 100 +---
>  tools/perf/util/print-events.h                |   4 +-
>  tools/perf/util/python.c                      | 522 +++++++++++++++++-
>  tools/perf/util/tp_pmu.c                      | 210 +++++++
>  tools/perf/util/tp_pmu.h                      |  19 +
>  19 files changed, 1646 insertions(+), 441 deletions(-)
>  create mode 100644 tools/perf/pmu-events/arch/common/common/software.json
>  create mode 100755 tools/perf/python/ilist.py
>  create mode 100644 tools/perf/util/tp_pmu.c
>  create mode 100644 tools/perf/util/tp_pmu.h
> 
> -- 
> 2.50.1.552.g942d659e1b-goog
>
Re: [PATCH v9 00/16] New perf ilist app
Posted by Namhyung Kim 2 months, 1 week ago
Hi Ian,

On Fri, Jul 25, 2025 at 11:51:46AM -0700, Ian Rogers wrote:
> This patch series builds up to the addition of a new ilist app written
> in python using textual [1] for the UI. The app presents perf PMUs and
> events, displays the event information as in `perf list` while at the
> bottom of the console showing recent activity of the event in total
> and across all CPUs. It also displays metrics, placed in a tree
> through their metric group, again with counts being displayed in the
> bottom panel.
> 
> The first ground work patches of fixes, cleanup and refactoring were
> separated into their own series here:
> https://lore.kernel.org/lkml/20250709214029.1769089-1-irogers@google.com/
> 
> The second part of the patches adds event json for the software PMU
> and makes the tracepoint PMU support iteration of events and the
> like. Without these improvements the tracepoint and software PMUs will
> appear to have no events in the ilist app. As the software PMU moves
> parsing to json, the legacy hard coded parsing is removed. This has
> proven controversial for hardware events and so that cleanup isn't
> done here.

Even software PMU can be controversial. :)  But I think we can try this
first.  Basically this will change the output `perf list` and the event
parsing behavior.

For example, `perf list sw` will look like:

software:
  alignment-faults
       [Number of kernel handled memory alignment faults. Unit: software]
  bpf-output
       [An event used by BPF programs to write to the perf ring buffer. Unit: software]
  cgroup-switches
       [Number of context switches to a task in a different cgroup. Unit: software]
  context-switches
       [Number of context switches [This event is an alias of cs]. Unit: software]
  cpu-clock
       [Per-CPU high-resolution timer based event. Unit: software]
  cpu-migrations
       [Number of times a process has migrated to a new CPU [This event is an alias of migrations]. Unit: software]
  cs
       [Number of context switches [This event is an alias of context-switches]. Unit: software]
  dummy
       [A placeholder event that doesn't count anything. Unit: software]
  ...

Let's add this change and see if people complain..

Btw, I think the alias can be one-way.  IOW 'context-switches' is a
software event and 'cs' is an alias to it, not vice versa.  I'll make
the change.

> 
> The final patches expand the perf python APIs and add the ilist
> command. To run it you need the updated perf.cpython.so in your
> PYTHONPATH and then execute the script. Expanding PMUs and then
> selecting events will cause event informatin to be displayed in the
> top-right and the counters values to be displayed as sparklines and
> counts in the bottom half of the screen.

This part can go to the next cycle.

Thanks,
Namhyung

> 
> [1] https://textual.textualize.io/
> 
> v9: sys metric support and pep8 clean up suggested by Xu Yang
>     <xu.yang_2@nxp.com>.
> 
> v8: nit fixing of issues caught by Arnaldo and Namhyung. Add Arnaldo's
>     tested-by. Fail to repro issue reported by Thomas Falcon but
>     encounter textual rendering and DOM query race, add an exception
>     handling path to avoid the race being fatal. The change is minor
>     in patch 16, so Arnaldo's tested-by is kept.
> 
> v7: Better handle errors in the python code and ignore errors when
>     scanning PMU/events in ilist.py, improving the behavior when not
>     root. Add a tp_pmu/python clean up. Minor kernel coding style
>     clean up. Fix behavior of ilist if a search result isn't found but
>     then next is chosen.
> 
> v6: For metrics on hybrid systems don't purely match by name, also
>     match the CPU and thread so that if the same metric exists for
>     different PMUs the appropriate one is selected and counters may be
>     read. Likewise use evsel maps and not the evlists.
> 
> v5: Split the series in two. Add metric support. Various clean ups and
>     tweaks to the app in particular around the handling of searches.
> 
> v4: No conflict rebase. Picks up perf-tools-next DRM PMU which
>     displays as expected.
> 
> v3: Add a search dialog to the ilist app with 'n'ext and 'p'revious
>     keys. No changes in the ground work first 14 patches.
> 
> v2: In the jevents event description duplication, some minor changes
>     accidentally missed from v1 meaning that in v1 the descriptions
>     were still duplicated. Expand the cover letter with some thoughts
>     on the series.
> 
> Ian Rogers (16):
>   perf python: Add more exceptions on error paths
>   perf jevents: Add common software event json
>   perf parse-events: Remove non-json software events
>   perf tp_pmu: Factor existing tracepoint logic to new file
>   perf tp_pmu: Add event APIs
>   perf list: Remove tracepoint printing code
>   perf list: Skip ABI PMUs when printing pmu values
>   perf python: Improve the tracepoint function if no libtraceevent
>   perf python: Add basic PMU abstraction and pmus sequence
>   perf python: Add function returning dictionary of all events on a PMU
>   perf ilist: Add new python ilist command
>   perf python: Add parse_metrics function
>   perf python: Add evlist metrics function
>   perf python: Add evlist compute_metric
>   perf python: Add metrics function
>   perf ilist: Add support for metrics
> 
>  tools/perf/builtin-list.c                     |  65 ++-
>  .../arch/common/common/software.json          |  92 +++
>  tools/perf/pmu-events/empty-pmu-events.c      | 266 +++++----
>  tools/perf/pmu-events/jevents.py              |  15 +-
>  tools/perf/python/ilist.py                    | 495 +++++++++++++++++
>  tools/perf/util/Build                         |   1 +
>  tools/perf/util/evsel.c                       |  21 +-
>  tools/perf/util/parse-events.c                | 198 ++-----
>  tools/perf/util/parse-events.h                |   1 -
>  tools/perf/util/parse-events.l                |  38 +-
>  tools/perf/util/parse-events.y                |  29 +-
>  tools/perf/util/pfm.c                         |   2 +
>  tools/perf/util/pmu.c                         |   7 +
>  tools/perf/util/pmus.c                        |   2 +
>  tools/perf/util/print-events.c                | 100 +---
>  tools/perf/util/print-events.h                |   4 +-
>  tools/perf/util/python.c                      | 522 +++++++++++++++++-
>  tools/perf/util/tp_pmu.c                      | 210 +++++++
>  tools/perf/util/tp_pmu.h                      |  19 +
>  19 files changed, 1646 insertions(+), 441 deletions(-)
>  create mode 100644 tools/perf/pmu-events/arch/common/common/software.json
>  create mode 100755 tools/perf/python/ilist.py
>  create mode 100644 tools/perf/util/tp_pmu.c
>  create mode 100644 tools/perf/util/tp_pmu.h
> 
> -- 
> 2.50.1.552.g942d659e1b-goog
>
Re: [PATCH v9 00/16] New perf ilist app
Posted by Namhyung Kim 2 months, 1 week ago
On Sat, Jul 26, 2025 at 04:12:29PM -0700, Namhyung Kim wrote:
> Hi Ian,
> 
> On Fri, Jul 25, 2025 at 11:51:46AM -0700, Ian Rogers wrote:
> > This patch series builds up to the addition of a new ilist app written
> > in python using textual [1] for the UI. The app presents perf PMUs and
> > events, displays the event information as in `perf list` while at the
> > bottom of the console showing recent activity of the event in total
> > and across all CPUs. It also displays metrics, placed in a tree
> > through their metric group, again with counts being displayed in the
> > bottom panel.
> > 
> > The first ground work patches of fixes, cleanup and refactoring were
> > separated into their own series here:
> > https://lore.kernel.org/lkml/20250709214029.1769089-1-irogers@google.com/
> > 
> > The second part of the patches adds event json for the software PMU
> > and makes the tracepoint PMU support iteration of events and the
> > like. Without these improvements the tracepoint and software PMUs will
> > appear to have no events in the ilist app. As the software PMU moves
> > parsing to json, the legacy hard coded parsing is removed. This has
> > proven controversial for hardware events and so that cleanup isn't
> > done here.
> 
> Even software PMU can be controversial. :)  But I think we can try this
> first.  Basically this will change the output `perf list` and the event
> parsing behavior.
> 
> For example, `perf list sw` will look like:
> 
> software:
>   alignment-faults
>        [Number of kernel handled memory alignment faults. Unit: software]
>   bpf-output
>        [An event used by BPF programs to write to the perf ring buffer. Unit: software]
>   cgroup-switches
>        [Number of context switches to a task in a different cgroup. Unit: software]
>   context-switches
>        [Number of context switches [This event is an alias of cs]. Unit: software]
>   cpu-clock
>        [Per-CPU high-resolution timer based event. Unit: software]
>   cpu-migrations
>        [Number of times a process has migrated to a new CPU [This event is an alias of migrations]. Unit: software]
>   cs
>        [Number of context switches [This event is an alias of context-switches]. Unit: software]
>   dummy
>        [A placeholder event that doesn't count anything. Unit: software]
>   ...
> 
> Let's add this change and see if people complain..
> 
> Btw, I think the alias can be one-way.  IOW 'context-switches' is a
> software event and 'cs' is an alias to it, not vice versa.  I'll make
> the change.

Hmm.. this needs to rebuild the string index and causes a build error.
I'll just leave it as is and we can update it later.

Thanks,
Namhyung