linux/tools
Ian Rogers 712af96a53 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>
2026-09-26 20:49:29 +02:00
..
accounting
arch perf headers: Sync perf_event.h/perf_regs.h with the kernel headers 2026-09-14 15:32:52 -03:00
bootconfig Bootconfig updates for v7.3: 2026-08-25 08:59:09 -07:00
bpf perf tools updates for v7.3 2026-08-22 08:47:50 -07:00
build perf dwarf-aux: Add die_same_file() and die_get_type_die() 2026-09-25 18:13:25 +02:00
certs
cgroup
counter
crypto
debugging
dma
docs doc tools: fix 'path' typos 2026-08-11 10:43:16 -06:00
firewire
firmware
gpio
hv
iio
include tools include: Add missing stdarg.h include 2026-09-25 15:04:50 +02:00
kvm/kvm_stat
laptop
leds
lib perf evlist: Don't restrict uncore events to PMU CPUs 2026-09-25 15:29:56 +02:00
memory-model
mm mm.git review status for master..mm-nonmm-stable 2026-08-23 08:07:11 -07:00
net Including fixes from Bluetooth, IPSec and Netfilter. 2026-08-27 13:53:43 -07:00
objtool Rust fixes for v7.3 2026-08-30 09:47:39 -07:00
pcmcia
perf perf python: Port syscall-counts-by-pid to perf module 2026-09-26 20:49:29 +02:00
platform/x86/amd
power
rcu
sched
sched_ext sched_ext: Check bpf_timer_start return values in scx_qmap 2026-08-31 06:47:39 -10:00
scripts perf tools updates for v7.3 2026-08-22 08:47:50 -07:00
sound
spi
testing bpf-fixes 2026-09-06 13:49:44 -07:00
thermal
time
tracing
unittests
usb
verification verification/rvgen: Use .old instead of .bak for kunit backup files 2026-08-25 13:56:53 +02:00
virtio tools/virtio: Fix control typo in trace agent comment 2026-08-19 06:38:48 -04:00
wmi
workqueue tools/workqueue/wq_dump.py: Support backward compatibility for wq->attrs rename 2026-08-31 10:17:08 -10:00
writeback
Makefile