summaryrefslogtreecommitdiff
path: root/tools/perf/tests/shell/test_mem_phys_addr_python.sh
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2026-09-25 23:19:43 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-09-26 20:49:28 +0200
commit4425182d426b2180e98d0b537f46cdb03078876d (patch)
tree17bdf04632bf9747a69d2c53a7857b4b8f5d7fcf /tools/perf/tests/shell/test_mem_phys_addr_python.sh
parentaf2f226e8c29fc4dfa381043b7de2c145532bbae (diff)
downloadlinux-next-4425182d426b2180e98d0b537f46cdb03078876d.tar.gz
linux-next-4425182d426b2180e98d0b537f46cdb03078876d.zip
perf python: Port stat-cpi to perf module
Port stat-cpi.py from the legacy embedded scripting framework to a standalone Python script in tools/perf/python/ to calculate Cycles Per Instruction (CPI) per interval per CPU or thread. Improvements compared to the legacy script: - Support both perf.data file mode (via perf.session stat callbacks) and live counter collection mode (using perf.parse_events, evlist.open, and evsel.read across intervals), with automatic fallback to user-space (:u) and self-process monitoring when perf_event_paranoid restricts system-wide events (EACCES). - Compute per-interval counter deltas (val, ena, run) keyed by raw event name so cumulative PERF_RECORD_STAT snapshots and hybrid PMU events (e.g. cpu_core/cycles/, cpu_atom/cycles/) are accumulated accurately, and scale counts by time_enabled / time_running when multiplexed. - Replace hard-coded CPU ([0, 1]) and thread ([0]) arrays with dynamic CPU and thread discovery so arbitrary system topologies work automatically. - Add CLI option handling (-i, -I, -p) via argparse and type annotations passing mypy and pylint. Add a shell test (test_stat_cpi_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/tests/shell/test_mem_phys_addr_python.sh')
0 files changed, 0 insertions, 0 deletions