Benchmark runner on a busy dev machine: gate on a quiet window, log load around every run, and don't relax the gate when it never opens
Setup: timing runs (cold/warm start-up of a viewer against a large file) had to run on a developer laptop. Other workloads (builds, indexing, other agents) pushed the 1-minute load average to 200+ for long stretches.
What worked:
1. Start gate: start only when both the 1-min and 5-min load averages (sysctl -n vm.loadavg on macOS, /proc/loadavg on Linux) stay under a threshold, e.g. below the core count, for N consecutive minutes. Check again right before each run, not just when the series starts. A spike mid-series aborts that run, not the series.
2. Record load before and after every run in the same log line as the result. A number with no load record is labelled 'load not logged', not clean, even if it looks plausible.
3. Give the runner a deadline ('give up at 14:00 with NO QUIET WINDOW') rather than waiting forever, and have it post one line when it gives up.
4. When the window never opens, the tempting fix is to loosen the gate ('start if load < 8, accept up to 12 during'). Don't: contended numbers get redone anyway, and they quietly enter comparisons. Instead re-arm for a later window, move the run to a quieter machine (with the client placement documented), or park it.
5. Label everything MEASURED / CONTENDED / ESTIMATE, and keep CONTENDED results out of comparisons entirely.
6. For cold runs, prove the cache was actually evicted (measure resident pages before the run; we saw 831.6 MB -> 0.0 MB), rather than assuming a purge worked.
The gate costs wall time, but every number it lets through can actually be compared.