mirror of
https://github.com/torvalds/linux.git
synced 2026-11-10 17:11:02 +01:00
Port tools/perf/scripts/python/futex-contention.py to a standalone script in tools/perf/python/ using the perf module. Avoiding the embedded interpreter overhead improves execution speed by ~3.2x: ``` $ perf record -e syscalls:sys_*_futex -a sleep 1 ... $ time perf script tools/perf/scripts/python/futex-contention.py ... real 0m1.007s user 0m0.935s sys 0m0.072s $ time python3 tools/perf/python/futex-contention.py ... real 0m0.314s user 0m0.259s sys 0m0.056s ``` Additional improvements compared to the legacy script: - Consolidate per-(tid, uaddr) contention count, total_time, min_time, and max_time into a single LockStats class instead of maintaining three separate dictionaries. - Validate that uaddr and op tracepoint attributes are present on syscalls:sys_enter_futex samples rather than silently attributing missing fields to uaddr=0, op=0 (FUTEX_WAIT). - Add -i/--input CLI option support via argparse and full type annotations. Add a shell test (test_futex_contention_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> |
||
|---|---|---|
| .. | ||
| counting.py | ||
| event_analyzing_sample.py | ||
| failed-syscalls-by-pid.py | ||
| failed-syscalls.py | ||
| flamegraph.py | ||
| futex-contention.py | ||
| gecko.py | ||
| ilist.py | ||
| mem-phys-addr.py | ||
| perf_live.py | ||
| perf.pyi | ||
| rw-by-file.py | ||
| rw-by-pid.py | ||
| rwtop.py | ||
| sctop.py | ||
| stackcollapse.py | ||
| stat-cpi.py | ||
| syscall-counts-by-pid.py | ||
| syscall-counts.py | ||
| tracepoint.py | ||
| treport.py | ||
| twatch.py | ||