[PATCH v5 0/2] perf timechart: Add --live mode to the TUI and test
From: Ian Rogers
Date: Fri Oct 23 2026 - 01:50:10 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 '--' that stops recording when it exits, and
optional output recording (-o), along with headless shell tests in
test_ttimechart_python.sh.
Assisted-by: Antigravity:gemini-3.1-pro
v5: Address Sashiko review feedback:
- Patch 1: Always record system wide, as 'perf timechart record'
does, as switches into a task and idle states aren't seen by
per-task events when only a workload was recorded.
- Patch 1: Don't move a task's state start back before its recorded
history when its switch out and back in were lost, which inflated
its running time.
- Patch 1: Serialize LiveRecorder.stop() calls from the UI thread and
the thread processing events.
- Patch 2: Only run the live recording test when scheduler events can
be recorded system wide.
v4: https://lore.kernel.org/linux-perf-users/20261023050207.2449976-1-irogers@xxxxxxxxxx/
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 | 901 ++++++++++++++++--
.../tests/shell/test_ttimechart_python.sh | 310 ++++++
4 files changed, 1237 insertions(+), 75 deletions(-)
--
2.56.0.307.g5fe7bd680c-goog