linux/tools/perf/python
Ian Rogers c3034e70c6 perf python: Port stackcollapse to perf module
Port stackcollapse.py from tools/perf/scripts/python/ to a standalone
script in tools/perf/python/ refactored into a StackCollapseAnalyzer
class.

Improvements compared to the legacy script:
- Traverse sample.callchain directly from perf.session without
  allocating per-event dictionaries, and fall back to sample.symbol when
  a sample has no callchain.
- Replace deprecated optparse with argparse, adding -i/--input alongside
  --include-tid, --include-pid, --no-comm, --tidy-java, and --kernel.
- Handle BrokenPipeError cleanly when output is piped into downstream
  tools (such as head or flamegraph.pl).

Add a shell test (test_stackcollapse_python.sh) using a CPU workload
(perf test -w noploop) 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:28 +02:00
..
counting.py perf python: Improve perf script -l descriptions 2026-09-26 20:49:27 +02:00
ilist.py perf python: Clean up pylint warnings in ilist.py 2026-09-26 20:49:27 +02:00
mem-phys-addr.py perf python: Port mem-phys-addr to perf module 2026-09-26 20:49:28 +02:00
perf_live.py perf python: Allow KeyboardInterrupt to propagate in LiveSession 2026-09-26 20:49:27 +02:00
perf.pyi perf python: Add Intel PT call_return and itrace capability 2026-09-26 20:49:27 +02:00
stackcollapse.py perf python: Port stackcollapse to perf module 2026-09-26 20:49:28 +02:00
stat-cpi.py perf python: Port stat-cpi to perf module 2026-09-26 20:49:28 +02:00
tracepoint.py perf python: Improve perf script -l descriptions 2026-09-26 20:49:27 +02:00
treport.py perf python: Clean up pylint warnings in treport.py 2026-09-26 20:49:27 +02:00
twatch.py perf python: Improve perf script -l descriptions 2026-09-26 20:49:27 +02:00