From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
James Clark <james.clark@linaro.org>,
Xu Yang <xu.yang_2@nxp.com>,
John Garry <john.g.garry@oracle.com>,
"Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
Howard Chu <howardchu95@gmail.com>,
Weilin Wang <weilin.wang@intel.com>,
Thomas Richter <tmricht@linux.ibm.com>,
Andi Kleen <ak@linux.intel.com>,
Tiezhu Yang <yangtiezhu@loongson.cn>,
Gautam Menghani <gautam@linux.ibm.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [PATCH v2 00/15] New perf ilist app
Date: Wed, 11 Jun 2025 09:01:51 -0700 [thread overview]
Message-ID: <20250611160206.552030-1-irogers@google.com> (raw)
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.
The first part of the patches are a few perf and perf python C API
fixes, most importantly the counter reading in python supports tool
PMUs.
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 patch adds 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.
Some thoughts on the series:
- The PMU changes will conflict with the addition of the DRM PMU:
https://lore.kernel.org/lkml/20250403202439.57791-1-irogers@google.com/
when these two are merged together ilist will show yet more
counters. It'd be nice if the DRM stuff could land and then I can
rebase these patches.
- The parse-events clean up of the software and tracepoint PMU. The
software PMU hard coding to be legacy first has similar issues and
will conflict with the clean up in:
https://lore.kernel.org/lkml/20250416045117.876775-1-irogers@google.com/
Moving the software work to json means we don't need special parse
events terms for software events, etc. We can just treat things
like regular PMUs with json, etc. I'd much rather we had less
special case logic so that series is best rebased on top of this
work and it should drop the changes for software terms, etc. which
this series removes. Maybe one day the whole event parsing can be
much more regular in how PMUs are treated but there's always
"cycles".
- Should python libraries have feature tests? How does this get
packaged outside the kernel tree? I think these are open
questions. Clearly textual is kind of a big dependency and we've
largely been moving in the direction of fewer dependencies
recently. Hopefully the app makes it clear why I think this one is
worth carrying. We carry libslang as a dependency and I think
textual clearly far surpasses it.
- How to launch? Currently I run tools/perf/python/ilist.py but it
would be much nicer if we could do `perf ilist` much as we do for
perf-archive.sh. There are probably other scripts that should be
perf commands like flamegraph and gecko. It'd be nice to follow up
the series with something to make using these commands easy.
[1] https://textual.textualize.io/
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 (15):
perf hwmon_pmu: Avoid shortening hwmon PMU name
perf parse-events: Minor tidy up of event_type helper
perf python: In str(evsel) use the evsel__pmu_name helper
perf python: Fix thread check in pyrf_evsel__read
perf python: Correct pyrf_evsel__read for tool PMUs
perf python: Add basic PMU abstraction and pmus sequence
perf python: Add function returning dictionary of all events on a PMU
perf jevents: If the long_desc and desc are identical then drop the
long_desc
perf jevents: Add common software event json
perf pmu: Tolerate failure to read the type for wellknown PMUs
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 ilist: Add new python ilist command
tools/perf/builtin-list.c | 47 ++--
.../arch/common/common/software.json | 92 ++++++
tools/perf/pmu-events/empty-pmu-events.c | 266 +++++++++++-------
tools/perf/pmu-events/jevents.py | 18 +-
tools/perf/python/ilist.py | 238 ++++++++++++++++
tools/perf/util/Build | 1 +
tools/perf/util/evsel.c | 21 +-
tools/perf/util/hwmon_pmu.c | 2 +-
tools/perf/util/parse-events.c | 225 +++++----------
tools/perf/util/parse-events.h | 3 +-
tools/perf/util/parse-events.l | 38 +--
tools/perf/util/parse-events.y | 29 +-
tools/perf/util/pmu.c | 44 ++-
tools/perf/util/print-events.c | 95 -------
tools/perf/util/print-events.h | 1 -
tools/perf/util/python.c | 248 +++++++++++++++-
tools/perf/util/tp_pmu.c | 209 ++++++++++++++
tools/perf/util/tp_pmu.h | 19 ++
18 files changed, 1144 insertions(+), 452 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.0.rc0.642.g800a2b2222-goog
next reply other threads:[~2025-06-11 16:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 16:01 Ian Rogers [this message]
2025-06-11 16:01 ` [PATCH v2 01/15] perf hwmon_pmu: Avoid shortening hwmon PMU name Ian Rogers
2025-06-11 16:01 ` [PATCH v2 02/15] perf parse-events: Minor tidy up of event_type helper Ian Rogers
2025-06-11 16:01 ` [PATCH v2 03/15] perf python: In str(evsel) use the evsel__pmu_name helper Ian Rogers
2025-06-11 16:01 ` [PATCH v2 04/15] perf python: Fix thread check in pyrf_evsel__read Ian Rogers
2025-06-11 16:01 ` [PATCH v2 05/15] perf python: Correct pyrf_evsel__read for tool PMUs Ian Rogers
2025-06-11 16:01 ` [PATCH v2 06/15] perf python: Add basic PMU abstraction and pmus sequence Ian Rogers
2025-06-11 16:01 ` [PATCH v2 07/15] perf python: Add function returning dictionary of all events on a PMU Ian Rogers
2025-06-11 16:01 ` [PATCH v2 08/15] perf jevents: If the long_desc and desc are identical then drop the long_desc Ian Rogers
2025-06-11 16:02 ` [PATCH v2 09/15] perf jevents: Add common software event json Ian Rogers
2025-06-11 16:02 ` [PATCH v2 10/15] perf pmu: Tolerate failure to read the type for wellknown PMUs Ian Rogers
2025-06-11 16:02 ` [PATCH v2 11/15] perf parse-events: Remove non-json software events Ian Rogers
2025-06-11 16:02 ` [PATCH v2 12/15] perf tp_pmu: Factor existing tracepoint logic to new file Ian Rogers
2025-06-11 16:02 ` [PATCH v2 13/15] perf tp_pmu: Add event APIs Ian Rogers
2025-06-11 16:02 ` [PATCH v2 14/15] perf list: Remove tracepoint printing code Ian Rogers
2025-06-11 16:02 ` [PATCH v2 15/15] perf ilist: Add new python ilist command Ian Rogers
2025-06-11 16:34 ` [PATCH v2 00/15] New perf ilist app Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250611160206.552030-1-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=gautam@linux.ibm.com \
--cc=howardchu95@gmail.com \
--cc=james.clark@linaro.org \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tmricht@linux.ibm.com \
--cc=weilin.wang@intel.com \
--cc=xu.yang_2@nxp.com \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).