mirror of
https://github.com/esphome/esphome.git
synced 2026-09-27 23:10:21 +00:00
Fix scheduler benchmark: use fake time with guard disabled at compile time
interval=0 causes infinite loop (reschedules at same time, never breaks). interval=1 with millis() doesn't work (real time doesn't advance fast enough between inner iterations for intervals to re-fire). Solution: use interval=1 with monotonically increasing fake time (now++) and disable WarnIfComponentBlockingGuard at compile time via -DWARN_IF_BLOCKING_OVER_MS=UINT32_MAX in benchmark build flags. This prevents the guard's (millis() - started_) underflow when fake time exceeds real millis().
This commit is contained in:
@@ -34,6 +34,10 @@ PLATFORMIO_OPTIONS = {
|
||||
"-O2", # optimize for speed (CodSpeed recommends RelWithDebInfo)
|
||||
"-g", # debug symbols for profiling
|
||||
USE_TIME_TIMEZONE_FLAG,
|
||||
# Disable WarnIfComponentBlockingGuard check — scheduler benchmarks
|
||||
# use fake monotonic time ahead of real millis(), causing uint32_t
|
||||
# underflow in the guard's (millis() - started_) calculation.
|
||||
"-DWARN_IF_BLOCKING_OVER_MS=UINT32_MAX",
|
||||
],
|
||||
# Use deep+ LDF mode to ensure PlatformIO detects the benchmark
|
||||
# library dependency from nested includes.
|
||||
|
||||
Reference in New Issue
Block a user