Re: [PATCH v7 00/16] New perf ilist app

From: Arnaldo Carvalho de Melo
Date: Wed Jul 23 2025 - 15:24:30 EST


On Wed, Jul 23, 2025 at 04:11:13PM -0300, Arnaldo Carvalho de Melo wrote:
> On Wed, Jul 23, 2025 at 04:08:55PM -0300, Arnaldo Carvalho de Melo wrote:
> > On Wed, Jul 23, 2025 at 11:00:18AM -0700, Namhyung Kim wrote:
> > > > I think there is some follow up for "make install" for scripts like
> > > > these, but I'm keen for the python API to move forward.

> > > I'll review the series today so that we can get some part of it, at
> > > least. Basically I think we need a wrapper script like perf-ilist to
> > > run this easily (maybe with documentation).

> > I just tried, with the series applied:

> > root@number:~# perf ilist
> > perf: 'ilist' is not a perf-command. See 'perf --help'.

> > Did you mean this?
> > list
> > root@number:~#

> > Now trying to figure out why it is not running.

> So it is not wired up like 'perf archive', trying it directly:

> root@number:~# ~acme/git/perf-tools-next/tools/perf/python/ilist.py
> Traceback (most recent call last):
> File "/home/acme/git/perf-tools-next/tools/perf/python/ilist.py", line 11, in <module>
> from textual import on
> ModuleNotFoundError: No module named 'textual'
> root@number:~#

> I thought there was some discussion about catching this exception and
> providing guidance, lemme try...

root@number:~# sudo dnf install python-textual
Updating and loading repositories:
google-chrome 100% | 6.1 KiB/s | 1.3 KiB | 00m00s
Copr repo for PyCharm owned by phracek 100% | 2.0 KiB/s | 2.1 KiB | 00m01s
RPM Fusion for Fedora 42 - Nonfree - NVIDIA Driver 100% | 2.6 KiB/s | 2.5 KiB | 00m01s
RPM Fusion for Fedora 42 - Nonfree - Steam 100% | 5.8 KiB/s | 2.4 KiB | 00m00s
google-chrome 100% | 7.2 KiB/s | 3.2 KiB | 00m00s
Copr repo for PyCharm owned by phracek 100% | 15.7 KiB/s | 4.8 KiB | 00m00s
Repositories loaded.
Package Arch Version Repository Size
Installing:
python3-textual noarch 1.0.0-1.fc42 fedora 6.6 MiB
Installing dependencies:
python3-linkify-it-py noarch 2.0.3-4.fc42 fedora 110.4 KiB
python3-markdown-it-py noarch 3.0.0-8.fc42 fedora 496.3 KiB
python3-markdown-it-py+linkify noarch 3.0.0-8.fc42 fedora 9.0 KiB
python3-markdown-it-py+plugins noarch 3.0.0-8.fc42 fedora 9.0 KiB
python3-mdit-py-plugins noarch 0.4.2-2.fc42 fedora 289.4 KiB
python3-mdurl noarch 0.1.2-9.fc42 fedora 41.4 KiB
python3-platformdirs noarch 4.2.2-4.fc42 fedora 162.0 KiB
python3-pygments noarch 2.18.0-4.fc42 fedora 10.6 MiB
python3-rich noarch 13.9.4-2.fc42 fedora 2.5 MiB
python3-uc-micro-py noarch 1.0.3-4.fc42 fedora 13.1 KiB

Transaction Summary:
Installing: 11 packages

Total size of inbound packages is 5 MiB. Need to download 5 MiB.
After this operation, 21 MiB extra will be used (install 21 MiB, remove 0 B).
Is this ok [y/N]: y
<SNIP>
[13/13] Installing python3-textual-0:1.0.0-1.fc42.noarch 100% | 10.1 MiB/s | 6.8 MiB | 00m01s
Complete!
root@number:~# ~acme/git/perf-tools-next/tools/perf/python/ilist.py
╭────────────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────────────╮
│ /home/acme/git/perf-tools-next/tools/perf/python/ilist.py:470 in compose │
│ │
│ 467 │ │ │ return tree │
│ 468 │ │ │
│ 469 │ │ yield Header(id="header") │
│ ❱ 470 │ │ yield Horizontal(Vertical(metric_event_tree(), id="events"), │
│ 471 │ │ │ │ │ │ Vertical(Label("event name", id="event_name"), │
│ 472 │ │ │ │ │ │ │ │ Static("description", markup=False, id="event_descript │
│ 473 │ │ │ │ │ │ │ │ )) │
│ │
│ ╭───────────────────────────────────────────────── locals ─────────────────────────────────────────────────╮ │
│ │ self = IListApp(title='Interactive Perf List', classes={'-dark-mode'}, pseudo_classes={'dark', 'focus'}) │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /home/acme/git/perf-tools-next/tools/perf/python/ilist.py:433 in metric_event_tree │
│ │
│ 430 │ │ │ """Create tree of PMUs and metricgroups with events or metrics under.""" ╭─────────── locals ────────────╮ │
│ 431 │ │ │ tree: Tree[TreeValue] = Tree("Root", id="root") │ pmus = TreeNode('PMUs', None) │ │
│ 432 │ │ │ pmus = tree.root.add("PMUs") │ tree = Tree(id='root') │ │
│ ❱ 433 │ │ │ for pmu in perf.pmus(): ╰───────────────────────────────╯ │
│ 434 │ │ │ │ pmu_name = pmu.name().lower() │
│ 435 │ │ │ │ pmu_node = pmus.add(pmu_name) │
│ 436 │ │ │ │ try: │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: module 'perf' has no attribute 'pmus'
root@number:~#

Ok, that was with the 'python-perf3' rpm package on fedora 42, trying
with the new one...

root@number:~# export PYTHONPATH=/tmp/build/perf-tools-next/python
root@number:~# ~acme/git/perf-tools-next/tools/perf/python/ilist.py

Cool stuff!

Lots of flashing lights! :-)

Interesting to quickly browse all those events, I like it.

I searched for "wakeup" and stumbled on ftrace:wakeup failures, but that
should be just a minor adjustment, some exception list:

root@number:~# ls -la /sys/kernel/tracing/events/ftrace/wakeup/
total 0
drwxr-xr-x. 1 root root 0 Jul 23 16:04 .
drwxr-xr-x. 1 root root 0 Jul 23 16:04 ..
-r--r-----. 1 root root 0 Jul 23 16:04 format
-r--r-----. 1 root root 0 Jul 23 16:19 hist
root@number:~#
root@number:~# ls -la /sys/kernel/tracing/events/sched/sched_wakeup/
total 0
drwxr-xr-x. 1 root root 0 Jul 23 16:04 .
drwxr-xr-x. 1 root root 0 Jul 23 16:04 ..
-rw-r-----. 1 root root 0 Jul 23 16:19 enable
-rw-r-----. 1 root root 0 Jul 23 16:19 filter
-r--r-----. 1 root root 0 Jul 23 16:04 format
-r--r-----. 1 root root 0 Jul 23 16:19 hist
-r--r-----. 1 root root 0 Jul 23 16:04 id
-rw-r-----. 1 root root 0 Jul 23 16:19 trigger
root@number:~#

Do you know how to take text screen shots in textual?

Apart from the super minor nits, thanks for working on this:

Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

- Arnaldo