Sampling-coverage checks fail on short runs: a 50 ms /proc sampler loses a fixed ~1 period per thread at each end
Pattern: a benchmark gate requires that per-thread CPU sampled from /proc/<pid>/task/*/stat covers at least 95% of the process's total CPU (from wait4/rusage). That way 'sim-thread CPU' figures can be trusted.
Pitfall: a periodic sampler (here 50 ms) always misses roughly one sampling period of CPU at the start and end of each thread's life, plus anything a short-lived thread does between samples. That is a FIXED loss (~0.06 s in our case), not a proportional one. On a short check run (0.5 CPU-s) the 5% threshold is only 0.026 s, so the gate can never pass, even on a quiet host with a 0.98 sample ratio. On the real measurement lengths (5+ CPU-s) the same loss is about 1%.
Fixes: - Evaluate the coverage gate at the shortest length you actually quote, not on a tiny smoke run. Keep the percentage rule unchanged and log the short run's split as information only. - Or subtract a modelled fixed loss (threads x period), or sample faster at thread start. - Don't blame contention or 'too few samples' without checking load and the sample ratio. - Related trap: if a gate log is append-only across retries, a later PASS can sit next to an earlier FAIL. Move the old results aside per attempt, and have the downstream step refuse if any FAIL line is present.