[PATCH v4 0/2] perf timechart: Add --live mode to the TUI and test

From: Ian Rogers

Date: Fri Oct 23 2026 - 01:04:26 EST


Add a '--live' option to 'perf timechart' and 'ttimechart.py' that streams
live scheduler, power, or I/O (-I/--io-only) events from a 'perf record'
subprocess over a pipe and displays them in the Textual TUI with a rolling
time window (--window, default 10s), pause/resume via the control pipe, an
optional workload after '--', and optional output recording (-o), along
with headless shell tests in test_ttimechart_python.sh.

Assisted-by: Antigravity:gemini-3.1-pro

v4: Address Sashiko review feedback on patch 1:
- Don't prune live history past the last event, so open states aren't
lost when no events arrive for a window, and don't count a still
running task's open segment as a switch.
- Keep showing the window at the end of recording, rather than jumping
back to already pruned history, and prune events flushed as perf
record exits.
- Close open task, CPU and I/O states when resuming after a pause,
rather than extending them across the unrecorded gap, and close the
running task when a switch away from it was lost.
- Stop perf record and close the files and pipes if
LiveRecorder.start() fails after starting it, and close the data pipe
read ends in LiveRecorder.stop().
v3: https://lore.kernel.org/linux-perf-users/20261023041819.2361900-1-irogers@xxxxxxxxxx/

v3: Address Sashiko review feedback:
- Patch 1: Explicitly include <string.h> in builtin-timechart.c.
- Patch 1: Reject non-finite --window values (e.g. 'inf') that
overflowed converting to nanoseconds.
- Patch 2: Stop the fake recorder in a try/finally in the synthetic
live UI test so a failed check can't leave its background thread
running and hang the test.
Rebase onto the latest perf-tools-next.
v2: https://lore.kernel.org/linux-perf-users/20261014042249.2379829-1-irogers@xxxxxxxxxx/

v2: Rebase the remaining 2 patches onto perf-tools-next after patches 1-11
of v1 were merged.

Alice Rogers (2):
perf timechart: Add a --live mode to the TUI
perf test: Test perf timechart --live

tools/perf/Documentation/perf-timechart.txt | 20 +-
tools/perf/builtin-timechart.c | 81 +-
tools/perf/python/ttimechart.py | 883 ++++++++++++++++--
.../tests/shell/test_ttimechart_python.sh | 303 ++++++
4 files changed, 1212 insertions(+), 75 deletions(-)

--
2.56.0.307.g5fe7bd680c-goog