Skip to content

Commit dd8a704

Browse files
committed
fix(cli): clamp the benchmark overhead sample at zero
Overhead is wall time minus the sum of the phase deltas. The unattributed preamble keeps the remainder positive in practice, but summing many small phase values can round just above the wall measurement, and a negative overhead in the report would read as an accounting bug.
1 parent 9f7a311 commit dd8a704

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • bin/ethlambda/src/benchmark

bin/ethlambda/src/benchmark/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ fn run_synthetic(options: SyntheticOptions) -> eyre::Result<()> {
182182
);
183183

184184
if measured {
185-
let overhead_seconds = wall_seconds - phases.values().sum::<f64>();
185+
// Clamped: the unattributed preamble makes the remainder
186+
// positive in practice, but summing many small phase values can
187+
// round just above the wall measurement, and a negative overhead
188+
// in the report would read as an accounting bug.
189+
let overhead_seconds = (wall_seconds - phases.values().sum::<f64>()).max(0.0);
186190
samples.push(Sample {
187191
iteration: slot - options.warmup_slots,
188192
slot,

0 commit comments

Comments
 (0)