From d7be19703bdcb56e8e7a7097bc6a568ccf7380c7 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 17 Mar 2026 00:54:29 -1000 Subject: [PATCH] Fix scheduler intervals not firing and warn_blocking Use interval=0 so all 5 intervals fire unconditionally every call(). Pass real millis() to scheduler.call() so WarnIfComponentBlockingGuard doesn't see fake time ahead of wall clock (which causes uint32_t underflow in the blocking time calculation). --- tests/benchmarks/core/bench_scheduler.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/benchmarks/core/bench_scheduler.cpp b/tests/benchmarks/core/bench_scheduler.cpp index 40bed05327..6282cc1597 100644 --- a/tests/benchmarks/core/bench_scheduler.cpp +++ b/tests/benchmarks/core/bench_scheduler.cpp @@ -66,20 +66,18 @@ static void Scheduler_Call_5IntervalsFiring(benchmark::State &state) { BenchComponent dummy_component; int fire_count = 0; - // Add 5 intervals with 1ms period — they fire every call when time advances + // Add 5 intervals with 0ms period — they fire every call() unconditionally. + // WarnIfComponentBlockingGuard compares the `now` we pass against real + // millis() in finish(), so we must pass real millis() to avoid underflow. + // With interval=0, all 5 fire every call without needing to advance time. for (int i = 0; i < 5; i++) { - scheduler.set_interval(&dummy_component, static_cast(i), 1, [&fire_count]() { fire_count++; }); + scheduler.set_interval(&dummy_component, static_cast(i), 0, [&fire_count]() { fire_count++; }); } scheduler.process_to_add(); 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); - now++; + scheduler.call(millis()); } benchmark::DoNotOptimize(fire_count); }