From 4565167bec8d98f664ecfed4115c9bcdb22ed336 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 17 Mar 2026 00:53:10 -1000 Subject: [PATCH] Fix scheduler benchmark triggering warn_blocking WarnIfComponentBlockingGuard compares the `now` passed to scheduler.call() against real millis() in finish(). Using fake time ahead of real millis() caused uint32_t underflow in the guard, triggering blocking warnings. Fix by reading real millis() at the start of each outer iteration so fake time stays close to wall clock. --- tests/benchmarks/core/bench_scheduler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/benchmarks/core/bench_scheduler.cpp b/tests/benchmarks/core/bench_scheduler.cpp index 897e3adc98..40bed05327 100644 --- a/tests/benchmarks/core/bench_scheduler.cpp +++ b/tests/benchmarks/core/bench_scheduler.cpp @@ -72,13 +72,13 @@ static void Scheduler_Call_5IntervalsFiring(benchmark::State &state) { } scheduler.process_to_add(); - // Must be monotonic — millis_64_from_() tracks rollovers. - uint32_t now = millis() + 100; - for (auto _ : state) { + // Use real millis() each outer iteration so our fake time stays close + // to wall clock — WarnIfComponentBlockingGuard compares the `now` we + // pass to scheduler.call() against real millis() in finish(). + uint32_t now = millis(); for (int i = 0; i < kInnerIterations; i++) { scheduler.call(now); - // Advance time by 1ms so intervals are due again next call now++; } benchmark::DoNotOptimize(fire_count);