linux/tools/perf/python
Ian Rogers eb08738a7f perf python: Port flamegraph to perf module
Port flamegraph.py to a standalone script in tools/perf/python/ that
uses the perf module directly, avoiding intermediate dictionary
allocations for event fields.

Improvements compared to the legacy script:
- Add Subresource Integrity (integrity="sha256-...") and
  crossorigin="anonymous" attributes to external CDN stylesheet and
  script tags in MINIMAL_HTML.
- Upgrade CDN HTML template hash verification from weak MD5
  (hashlib.md5) to cryptographic SHA-256 (hashlib.sha256).
- Escape '<', '>', and '&' ('\u003c', '\u003e', '\u0026') in embedded
  JSON payloads (stacks_json and options_json) to prevent HTML script
  injection / XSS when rendering untrusted symbol or command names.
- Skip invoking 'perf report --header-only' when the input is stdin
  ('-'), a FIFO pipe, or a character device (S_ISFIFO / S_ISCHR) so
  non-seekable streams do not hang or fail.

Add a shell test (test_flamegraph_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:28 +02:00
..
counting.py perf python: Improve perf script -l descriptions 2026-09-26 20:49:27 +02:00
flamegraph.py perf python: Port flamegraph to perf module 2026-09-26 20:49:28 +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