Skip to content

feat: add perf-stat subtool for per-CPU IPC measurement - #59

Open
atheurer wants to merge 3 commits into
masterfrom
feat/perf-stat-subtool
Open

feat: add perf-stat subtool for per-CPU IPC measurement#59
atheurer wants to merge 3 commits into
masterfrom
feat/perf-stat-subtool

Conversation

@atheurer

Copy link
Copy Markdown
Contributor

Summary

Adds perf-stat as a new subtool alongside turbostat and perf. Uses perf stat -a -A -I <interval_ms> -x , to report hardware performance counters per CPU at configurable intervals, and post-processes the output into CDM metrics.

Motivation

When investigating throughput variability in single-threaded uperf TCP stream tests, we found that CPU utilization on the sender's pinned CPU is sometimes 100% sys — but we can't tell why from mpstat alone. IPC (instructions per cycle) per CPU at 3-second intervals would reveal:

  • Same IPC, more time → more actual work (extra syscalls, retransmits)
  • Lower IPC, same time → execution stalls (cache misses, memory pressure)

This is the key diagnostic that mpstat and turbostat don't provide.

Metrics emitted to CDM

Metric Class Breakout
perf-stat:ipc throughput {cpu: N}
perf-stat:cache-miss-rate utilization (%) {cpu: N}
perf-stat:llc-load-miss-rate utilization (%) {cpu: N}

Usage

--subtools perf-stat
--subtools turbostat,perf-stat
--interval 3

Notes

🤖 Generated with Claude Code

atheurer added 2 commits July 28, 2026 10:13
Add kerneltools-post-process.py registered in rickshaw.json as
controller.post-script. It dispatches based on which output files
exist in the tool data directory, so it handles gracefully when
subtools other than turbostat are used.

Turbostat handler parses the TSV output produced by
kerneltools-start with -d -d (debug) flags and emits:

System aggregate (Package/CPU = "-"):
  cpu-busy-pct, cpu-freq-avg-mhz, package-power-watt

Per-CPU (with cpu breakout):
  cpu-busy-pct, cpu-busy-freq-mhz, c1-pct, c2-pct, ipc

Tested against real PERF-E0306461 run data: 478 samples,
643 metric types, correct timestamps and values verified.

AI-assisted-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Adds perf-stat as a new subtool alongside turbostat. Uses
`perf stat -a -A -I <interval_ms> -x , -e cycles,instructions,cache-misses,LLC-load-misses`
to report hardware performance counters per CPU at configurable intervals.

IPC (instructions/cycles) per CPU per interval is the primary metric —
it reveals whether throughput variability is caused by more work (same
IPC, more cycles) or by execution stalls (lower IPC, same cycles). This
distinguishes cache/memory pressure from actual workload variation.

Metrics emitted to CDM:
  perf-stat:ipc                per-CPU  throughput
  perf-stat:cache-miss-rate    per-CPU  utilization (%)
  perf-stat:llc-load-miss-rate per-CPU  utilization (%)

Usage:
  --subtools perf-stat
  --subtools turbostat,perf-stat
  --interval 3  (3-second reporting intervals)

Requires: bare-metal host with hardware PMU access (not VMs).
debugfs is auto-mounted if not already present.

AI-assisted-by: Claude Sonnet 4.6
tc-wilson
tc-wilson previously approved these changes Jul 28, 2026
LLC-load-misses is not supported on AMD EPYC (returns <not supported>).
Replace with stalled-cycles-backend and stalled-cycles-frontend which
are generic hardware aliases that work on both Intel and AMD:

  AMD Zen 4: stalled-cycles-backend  = event=0x87,umask=0x01
             stalled-cycles-frontend = event=0x87,umask=0x02

These metrics directly answer the memory-bound vs core-bound question:
  backend-stall-rate  = stalled-cycles-backend / cycles * 100
  frontend-stall-rate = stalled-cycles-frontend / cycles * 100

A high backend-stall-rate with low cache-miss-rate (as observed on AMD
EPYC Genoa) points to memory ordering stalls, TLB pressure, or store
buffer conflicts — not L3 cache capacity misses.

AI-assisted-by: Claude Sonnet 4.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants