summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/stackcollapse.py
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2026-09-25 23:19:50 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-09-26 20:49:29 +0200
commit712af96a53eddfba4ec93bd59e69a4b5a4815890 (patch)
tree48f5d5dfd023e42c073d7677a09c152e97b08641 /tools/perf/scripts/python/stackcollapse.py
parent3d69731960a5e55beecd9b395001b24a3c0b542e (diff)
downloadlinux-next-712af96a53eddfba4ec93bd59e69a4b5a4815890.tar.gz
linux-next-712af96a53eddfba4ec93bd59e69a4b5a4815890.zip
perf python: Port syscall-counts-by-pid to perf module
Port tools/perf/scripts/python/syscall-counts-by-pid.py to a standalone script in tools/perf/python/ using the perf module. Avoiding the embedded interpreter and per-event dictionary overhead improves execution speed by ~3.8x: ``` $ perf record -e raw_syscalls:sys_enter -a sleep 1 ... $ time perf script tools/perf/scripts/python/syscall-counts-by-pid.py perf ... real 0m3.852s user 0m3.512s sys 0m0.336s $ time python3 tools/perf/python/syscall-counts-by-pid.py perf ... real 0m1.011s user 0m0.963s sys 0m0.048s ``` Additional improvements compared to the legacy script: - Resolve architecture-specific syscall names via perf.syscall_name(id, session.e_machine) instead of host python-audit tables. - Support both raw_syscalls:sys_enter and individual syscalls:sys_enter_* tracepoints, and filter out invalid (> 0xffff or negative) syscall IDs. - Support filtering by numeric PID as well as command name (comm), and resolve process command names via session.find_thread(pid). Add a shell test (test_syscall_counts_by_pid_python.sh) to verify 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>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions