diff options
| author | Ian Rogers <irogers@google.com> | 2026-09-25 23:19:57 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-09-26 20:49:29 +0200 |
| commit | b103b3338b99c3edfe982ef1e6198db8aaa039b6 (patch) | |
| tree | f2a756e4f9402230fb722e45eb65cc586f2e61a3 /tools/perf/scripts/python/stackcollapse.py | |
| parent | 605fd1c8b7e6677428cd8395b8191d0846e18adf (diff) | |
| download | linux-next-b103b3338b99c3edfe982ef1e6198db8aaa039b6.tar.gz linux-next-b103b3338b99c3edfe982ef1e6198db8aaa039b6.zip | |
perf python: Port futex-contention to perf module
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>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
