From: Ian Rogers <irogers@google.com>
To: irogers@google.com, acme@kernel.org, namhyung@kernel.org
Cc: adrian.hunter@intel.com, alice.mei.rogers@gmail.com,
atrajeev@linux.ibm.com, changbin.du@huawei.com,
dapeng1.mi@linux.intel.com, james.clark@linaro.org,
jolsa@kernel.org, linux-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org, mingo@redhat.com,
peterz@infradead.org, tanze@kylinos.cn, thomas.falcon@intel.com,
wutengda@huaweicloud.com
Subject: [PATCH v8 0/2] perf timechart: Add --live mode to the TUI and test
Date: Fri, 13 Nov 2026 07:26:18 -0800 [thread overview]
Message-ID: <20261113152622.1991001-1-irogers@google.com> (raw)
In-Reply-To: <20261113055926.1159033-1-irogers@google.com>
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
v8: Address Sashiko review feedback:
- Patch 1: Track switch-out timestamps explicitly on Task rather than
inferring switch counts from pruned STATE_RUNNING segments, and
accumulate Task.totals from the actual clipped duration returned by
SegmentList.add() while keeping Task.since monotonic.
- Patch 1: Keep each I/O syscall as its own unmerged segment and avoid
same-timestamp clipping so Task.io_bytes and syscall counts never
drift across pruning.
- Patch 1: Extend open STATE_WAITING and STATE_BLOCKED task states in
checkpoint(), preserve non-sleeping states across prune(), and clamp
live_prune() to last_time - 1 so open or finished states at last_time
are not deleted when idle past --window.
- Patch 1: Refresh comm names from perf.session on syscall lookups and
periodic live intervals (ignoring perf's unset ':tid' placeholders) so
pre-exec names update after execve(), and ignore scheduler-only tasks
in dump() and the UI when -I is set.
- Patch 1: Snapshot flush_round_target with a sequence counter before
draining perf record's pipe so concurrent or split-record flushes are
not dropped, and synchronize LiveRecorder.backlog() with
close_data_fds() under fd_lock.
- Patch 2: Add synthetic regression tests for all cases.
v7: Address Sashiko review feedback:
- Patch 1: Pass the comm/PID filter expression as a positional
argument to /bin/sh so the shell preserves the quotes around comm in
--live -I mode instead of stripping them before execing perf record.
- Patch 1: Clear LiveRecorder.control_thread if starting it raises so
stop() does not call join() on an unstarted thread and skip FD/comm
cleanup, and ignore OSError if perf record exits concurrently during
stop().
- Patch 2: Test the /bin/sh --filter quoting and control_thread
startup failure cleanup in the synthetic live test, and add a live
-I workload recording subtest when syscall tracepoints are permitted.
v6: https://lore.kernel.org/lkml/20261112233738.699031-1-irogers@google.com/
v6: Rebase onto perf-tools-next and address Sashiko review feedback:
- Patch 1: Queue pause/resume gap timestamps in a deque so rapid
pause/resume cycles before buffered events arrive still close
pre-pause open task and CPU states at each gap.
- Patch 1: Increment nr_samples inside TimechartData.lock and check/update
refreshed_samples in the same lock acquisition as checkpoint() in
live_refresh() so final buffered events aren't missed when paused.
- Patch 1: Keep cursor following in sync when zooming in/out, resetting
zoom with '0' after moving the cursor, or jumping to a waker ('w').
- Patch 1: Filter out all threads of ttimechart.py (via comm) and the
child perf record process (via $$) on syscall tracepoints in --live -I
mode, and ignore filtered I/O events before counting nr_samples.
- Patch 1: Track record boundaries in LiveRecorder's pipe pump and emit a
synthetic PERF_RECORD_FINISHED_ROUND when perf record goes idle or
pauses so ordered_events does not hold back the latest round.
- Patch 1: Always drain perf record's stdout on stop so perf record can
flush and terminate its workload cleanly without blocking on pipe writes,
and kill its process group if wait times out.
- Patch 2: Gate the LiveRecorder task-clock subtest on system-wide
task-clock permissions so unprivileged runs under perf_event_paranoid > 0
skip cleanly, and add synthetic tests for multiple pause gaps, round
tracking, and cursor following.
v5: https://lore.kernel.org/linux-perf-users/20261023054952.2503540-1-irogers@google.com/
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@google.com/
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@google.com/
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@google.com/
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 | 80 +-
tools/perf/python/ttimechart.py | 1334 +++++++++++++++--
.../tests/shell/test_ttimechart_python.sh | 591 ++++++++
4 files changed, 1899 insertions(+), 126 deletions(-)
--
2.56.1.703.gf848ed807c-goog
next prev parent reply other threads:[~2026-11-13 15:26 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 18:26 [PATCH v1 00/13] perf timechart/list/treport: Interactive Textual TUIs and perf python session improvements Ian Rogers
2026-10-02 18:26 ` [PATCH v1 01/13] perf session: Don't flush remaining events once processing is done Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 02/13] perf python: Quietly stop processing events when a callback raises Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 03/13] perf python: Lazily copy events and samples from process_events Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 04/13] perf python: Lazily resolve sample callchains Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 05/13] perf python: Release the GIL while processing session events Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 06/13] perf list: Add a --tui option to launch ilist Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 07/13] perf test: Add a test for the ilist script Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 08/13] perf treport: Show the profile while it loads Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-03 9:31 ` Arnaldo Carvalho de Melo
2026-10-02 18:26 ` [PATCH v1 09/13] perf test: Add a test for the treport script Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-03 9:35 ` Arnaldo Carvalho de Melo
2026-10-02 18:26 ` [PATCH v1 10/13] perf timechart: Add an interactive --tui mode Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 11/13] perf test: Add a test for perf timechart --tui Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 12/13] perf timechart: Add a --live mode to the TUI Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 13/13] perf test: Test perf timechart --live Ian Rogers
2026-10-03 1:33 ` sashiko-bot
2026-10-03 9:10 ` [PATCH v1 00/13] perf timechart/list/treport: Interactive Textual TUIs and perf python session improvements Arnaldo Carvalho de Melo
2026-10-03 9:12 ` Arnaldo Carvalho de Melo
2026-10-03 9:15 ` Arnaldo Carvalho de Melo
2026-10-14 4:22 ` [PATCH v2 0/2] perf timechart: Add --live mode to the TUI and test Ian Rogers
2026-10-14 4:22 ` [PATCH v2 1/2] perf timechart: Add a --live mode to the TUI Ian Rogers
2026-10-14 4:35 ` sashiko-bot
2026-10-14 4:22 ` [PATCH v2 2/2] perf test: Test perf timechart --live Ian Rogers
2026-10-14 4:28 ` sashiko-bot
2026-10-23 4:18 ` [PATCH v3 0/2] perf timechart: Add --live mode to the TUI and test Ian Rogers
2026-10-23 4:18 ` [PATCH v3 1/2] perf timechart: Add a --live mode to the TUI Ian Rogers
2026-10-23 4:37 ` sashiko-bot
2026-10-23 4:18 ` [PATCH v3 2/2] perf test: Test perf timechart --live Ian Rogers
2026-10-23 4:23 ` sashiko-bot
2026-10-23 5:02 ` [PATCH v4 0/2] perf timechart: Add --live mode to the TUI and test Ian Rogers
2026-10-23 5:02 ` [PATCH v4 1/2] perf timechart: Add a --live mode to the TUI Ian Rogers
2026-10-23 5:25 ` sashiko-bot
2026-10-23 5:02 ` [PATCH v4 2/2] perf test: Test perf timechart --live Ian Rogers
2026-10-23 5:07 ` sashiko-bot
2026-10-23 5:49 ` [PATCH v5 0/2] perf timechart: Add --live mode to the TUI and test Ian Rogers
2026-10-23 5:49 ` [PATCH v5 1/2] perf timechart: Add a --live mode to the TUI Ian Rogers
2026-10-23 6:16 ` sashiko-bot
2026-10-23 5:49 ` [PATCH v5 2/2] perf test: Test perf timechart --live Ian Rogers
2026-10-23 6:01 ` sashiko-bot
2026-11-12 23:37 ` [PATCH v6 0/2] perf timechart: Add --live mode to the TUI and test Ian Rogers
2026-11-12 23:37 ` [PATCH v6 1/2] perf timechart: Add a --live mode to the TUI Ian Rogers
2026-11-13 0:00 ` sashiko-bot
2026-11-12 23:37 ` [PATCH v6 2/2] perf test: Test perf timechart --live Ian Rogers
2026-11-12 23:43 ` sashiko-bot
2026-11-13 5:59 ` [PATCH v7 0/2] perf timechart: Add --live mode to the TUI and test Ian Rogers
2026-11-13 5:59 ` [PATCH v7 1/2] perf timechart: Add a --live mode to the TUI Ian Rogers
2026-11-13 6:29 ` sashiko-bot
2026-11-13 5:59 ` [PATCH v7 2/2] perf test: Test perf timechart --live Ian Rogers
2026-11-13 6:06 ` sashiko-bot
2026-11-13 15:26 ` Ian Rogers [this message]
2026-11-13 15:26 ` [PATCH v8 1/2] perf timechart: Add a --live mode to the TUI Ian Rogers
2026-11-13 15:44 ` sashiko-bot
2026-11-13 15:26 ` [PATCH v8 2/2] perf test: Test perf timechart --live Ian Rogers
2026-11-13 15:34 ` sashiko-bot
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=20261113152622.1991001-1-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alice.mei.rogers@gmail.com \
--cc=atrajeev@linux.ibm.com \
--cc=changbin.du@huawei.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tanze@kylinos.cn \
--cc=thomas.falcon@intel.com \
--cc=wutengda@huaweicloud.com \
/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