Skip to content

perf timechart/list/treport: Interactive Textual TUIs and perf python session improvements

Ian Rogers linux-perf-users lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13perf session: Don't flush remaining events once processing is donetools/perf/util/auxtrace.c tools/perf/util/session.c+15 -00 replies
2/13perf python: Quietly stop processing events when a callback raisestools/perf/util/python.c+122 -270 replies
3/13perf python: Lazily copy events and samples from process_eventstools/perf/util/python.c+384 -2800 replies
4/13perf python: Lazily resolve sample callchainstools/perf/util/python.c+79 -810 replies
5/13perf python: Release the GIL while processing session eventstools/perf/util/python.c+215 -430 replies
6/13perf list: Add a --tui option to launch ilisttools/perf/Documentation/perf-list.txt tools/perf/builtin-list.c+44 -00 replies
7/13perf test: Add a test for the ilist scripttools/perf/tests/shell/test_ilist_python.sh+181 -00 replies
8/13perf treport: Show the profile while it loadstools/perf/python/treport.py+350 -1081 reply
9/13perf test: Add a test for the treport scripttools/perf/tests/shell/test_treport_python.sh+247 -01 reply
10/13perf timechart: Add an interactive --tui modetools/perf/Documentation/perf-timechart.txt tools/perf/builtin-timechart.c tools/perf/python/ttimechart.py+1859 -00 replies
11/13perf test: Add a test for perf timechart --tuitools/perf/tests/shell/test_ttimechart_python.sh+237 -00 replies
12/13perf timechart: Add a --live mode to the TUItools/perf/Documentation/perf-timechart.txt tools/perf/builtin-timechart.c tools/perf/python/ttimechart.py+811 -750 replies
13/13perf test: Test perf timechart --livetools/perf/tests/shell/test_ttimechart_python.sh+300 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 00/13] perf timechart/list/treport: Interactive Textual TUIs and perf python session improvements

This series adds interactive terminal user interfaces (TUIs) built with Python's textual framework for 'perf timechart' (--tui and --live) and 'perf list' (--tui), updates 'treport' to progressively display profiles while loading in the background, adds headless shell tests for all three TUIs, and improves the 'perf' Python extension module to support responsive background and live pipe event processing:

1. Session and Python extension improvements (patches 1-5):
- Skip flushing remaining deferred samples and auxtrace events once session_done() is set so stopping event processing is immediate.
- Quietly stop processing events when a Python session callback raises an exception (e.g., to cancel a background load on quit) without corrupting TUI output with reader error messages.
- Lazily copy perf_event and perf_sample in process_events() only when a Python callback retains a reference beyond its return, shrinking struct pyrf_event to fit in CPython's small-object allocator.
- Lazily unwind and resolve sample callchains only when event.callchain is accessed.
- Release the Python GIL around perf_session__new() and perf_session__process_events() (reacquiring it in callbacks and guarding concurrent thread/comm/symbol access) so blocking pipe reads do not freeze TUI threads.

2. 'perf list --tui' and ilist test (patches 6-7):
- Add 'perf list --tui' to launch the interactive ilist script via 'perf script', and add a shell test driving ilist headlessly.

3. Progressive loading in treport and test (patches 8-9):
- Load profiles in a background thread in treport.py so the report tree and flame graph are interactive while loading, with lazy tree node creation and a headless shell test.

4. 'perf timechart --tui' and '--live' and tests (patches 10-13):
- Add ttimechart.py and 'perf timechart --tui' to interactively view, zoom, and pan per-CPU (busy, frequency, idle), per-task (running, runnable, blocked, wakeups), and I/O timelines along with a summary table.
- Add 'perf timechart --live' to stream live scheduler, power, or I/O events from a 'perf record' subprocess over a pipe with a rolling time window, pause/resume via the control pipe, and optional output recording (-o).
- Add headless shell tests covering both '--tui' and '--live' modes.

Alice Rogers (6):
perf treport: Show the profile while it loads
perf test: Add a test for the treport script
perf timechart: Add an interactive --tui mode
perf test: Add a test for perf timechart --tui
perf timechart: Add a --live mode to the TUI
perf test: Test perf timechart --live

Ian Rogers (7):
perf session: Don't flush remaining events once processing is done perf python: Quietly stop processing events when a callback raises perf python: Lazily copy events and samples from process_events perf python: Lazily resolve sample callchains
perf python: Release the GIL while processing session events perf list: Add a --tui option to launch ilist
perf test: Add a test for the ilist script

 tools/perf/Documentation/perf-list.txt        |   10 +
 tools/perf/Documentation/perf-timechart.txt   |   24 +
 tools/perf/builtin-list.c                     |   34 +
 tools/perf/builtin-timechart.c                |  114 +-
 tools/perf/python/treport.py                  |  458 ++-
 tools/perf/python/ttimechart.py               | 2467 +++++++++++++++++
 tools/perf/tests/shell/test_ilist_python.sh   |  181 ++
 tools/perf/tests/shell/test_treport_python.sh |  247 ++
 .../tests/shell/test_ttimechart_python.sh     |  537 ++++
 tools/perf/util/auxtrace.c                    |    7 +
 tools/perf/util/python.c                      | 1191 +++++---
 tools/perf/util/session.c                     |    8 +
 12 files changed, 4754 insertions(+), 524 deletions(-)
 create mode 100755 tools/perf/python/ttimechart.py
 create mode 100755 tools/perf/tests/shell/test_ilist_python.sh
 create mode 100755 tools/perf/tests/shell/test_treport_python.sh
 create mode 100755 tools/perf/tests/shell/test_ttimechart_python.sh
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog