diff --git a/esphome/components/runtime_stats/runtime_stats.h b/esphome/components/runtime_stats/runtime_stats.h index 24b6807008..7299fd7315 100644 --- a/esphome/components/runtime_stats/runtime_stats.h +++ b/esphome/components/runtime_stats/runtime_stats.h @@ -41,7 +41,7 @@ class RuntimeStatsCollector { // active_us = total time between loop start and just before yield. // before_us = time spent in Phase A (scheduler tick) excluding time // already attributed to per-component stats. - // tail_us = time spent in after_loop_tasks_ + the trailing record/stats + // tail_us = time spent in after_component_phase_ + the trailing record/stats // prefix. On Phase A-only ticks (component phase gated) this // is just the small trailing prefix between loop_before_end_us // and loop_now_us — non-zero but typically a few µs. diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index 68a430aff1..51966dfbec 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -106,7 +106,7 @@ void Application::setup() { this->feed_wdt(); } - this->after_loop_tasks_(); + this->after_component_phase_(); yield(); } while (!component->can_proceed() && !component->is_failed()); } diff --git a/esphome/core/application.h b/esphome/core/application.h index 924bdd5319..dbb219a80d 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -428,7 +428,7 @@ class Application { void activate_looping_component_(uint16_t index); inline uint32_t ESPHOME_ALWAYS_INLINE scheduler_tick_(uint32_t now); inline void ESPHOME_ALWAYS_INLINE before_component_phase_(); - inline void ESPHOME_ALWAYS_INLINE after_loop_tasks_() { this->in_loop_ = false; } + inline void ESPHOME_ALWAYS_INLINE after_component_phase_() { this->in_loop_ = false; } /// Process dump_config output one component per loop iteration. /// Extracted from loop() to keep cold startup/reconnect logging out of the hot path. @@ -695,10 +695,9 @@ inline void ESPHOME_ALWAYS_INLINE __attribute__((optimize("O2"))) Application::l #ifdef USE_RUNTIME_STATS loop_tail_start_us = micros(); #endif - this->after_loop_tasks_(); - this->last_loop_ = last_op_end_time; now = last_op_end_time; + this->after_component_phase_(); } #ifdef USE_RUNTIME_STATS