summaryrefslogtreecommitdiff
path: root/tools/perf/python/task-analyzer.py
AgeCommit message (Collapse)Author
2026-09-26perf python: Port task-analyzer to perf moduleIan Rogers
Port task-analyzer.py from tools/perf/scripts/python/ to a standalone script in tools/perf/python/ refactored into a class-based architecture. Improvements compared to the legacy script: - Support both offline perf.data file analysis (using perf.session) and live trace capture (using evlist.read_on_cpu), accessing sched:sched_switch tracepoint fields directly from sample objects. - Automatically disable ANSI terminal color escape sequences when --csv or --csv-summary is enabled so CSV column headers ('Comm,', 'Time Out-Out,', etc.) are never polluted by color codes when running interactively on a TTY (e.g. as root). - Sanitize non-printable characters and leading CSV formula characters (=, +, -, @) in task comm strings. - Emit a one-time warning to stderr if sched:sched_switch samples are missing tracepoint fields (such as when recorded without libtraceevent support). Update test_task_analyzer.sh to invoke the standalone script. Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Ian Rogers <irogers@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>