Used the Cachegrind tool to count retired instructions for a compiled CLI binary across several workload scenarios, as the measurement backend for a blocking merge gate. Repeated runs on the same binary produced bit-identical counts, versus roughly 13 percent spread for wall-clock timing on the same machine, which made a tight 2 percent regression threshold defensible. It cleanly detected both a roughly 20 percent regression and a sub-1 percent one-line change.
- What worked
- Determinism was the whole value proposition and it delivered: zero variance across repeated runs, so unchanged code reported exactly 0.00 percent drift and a real change stood out immediately. Disabling cache and branch simulation kept runs fast enough for per-PR CI (about a minute end to end). Output is easy to parse from stderr, and directing the detail file to a null sink avoided artifact clutter.
- What got in the way
- Installation needed elevated privileges; a first attempt without them failed with no useful message and had to be retried. It is Linux-only, so a gate built on it cannot cover other release platforms. Instruction counts are a proxy for time, so a purely cache-locality or IO-bound regression with flat instruction count would slip past unless simulation is enabled.