From 2a35c95718a6359b223b1eb78a3faf329b522b76 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 8 Jul 2025 11:31:25 -0600 Subject: [PATCH 1/4] fixes --- esphome/components/runtime_stats/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/runtime_stats/__init__.py b/esphome/components/runtime_stats/__init__.py index aff0bf086f..a36e8bfd28 100644 --- a/esphome/components/runtime_stats/__init__.py +++ b/esphome/components/runtime_stats/__init__.py @@ -17,7 +17,7 @@ CONFIG_SCHEMA = cv.Schema( { cv.GenerateID(): cv.declare_id(RuntimeStatsCollector), cv.Optional( - CONF_LOG_INTERVAL, default=60000 + CONF_LOG_INTERVAL, default="60s" ): cv.positive_time_period_milliseconds, } ) From 29fff967f5a08a906341dd11e113d19c258c66e5 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 8 Jul 2025 11:38:14 -0600 Subject: [PATCH 2/4] tweak --- tests/components/runtime_stats/common.yaml | 2 ++ tests/components/runtime_stats/test.esp32-ard.yaml | 1 + 2 files changed, 3 insertions(+) create mode 100644 tests/components/runtime_stats/common.yaml create mode 100644 tests/components/runtime_stats/test.esp32-ard.yaml diff --git a/tests/components/runtime_stats/common.yaml b/tests/components/runtime_stats/common.yaml new file mode 100644 index 0000000000..b434d1b5a7 --- /dev/null +++ b/tests/components/runtime_stats/common.yaml @@ -0,0 +1,2 @@ +# Test runtime_stats component with default configuration +runtime_stats: diff --git a/tests/components/runtime_stats/test.esp32-ard.yaml b/tests/components/runtime_stats/test.esp32-ard.yaml new file mode 100644 index 0000000000..dade44d145 --- /dev/null +++ b/tests/components/runtime_stats/test.esp32-ard.yaml @@ -0,0 +1 @@ +<<: !include common.yaml From 9dab840c58e0066ac16bf8ed41a9f3e794f1e3a8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 8 Jul 2025 11:42:17 -0600 Subject: [PATCH 3/4] tidy up --- esphome/components/runtime_stats/runtime_stats.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/runtime_stats/runtime_stats.h b/esphome/components/runtime_stats/runtime_stats.h index 20b0c08313..e2f8bee563 100644 --- a/esphome/components/runtime_stats/runtime_stats.h +++ b/esphome/components/runtime_stats/runtime_stats.h @@ -23,10 +23,10 @@ class ComponentRuntimeStats { public: ComponentRuntimeStats() : period_count_(0), - total_count_(0), period_time_ms_(0), - total_time_ms_(0), period_max_time_ms_(0), + total_count_(0), + total_time_ms_(0), total_max_time_ms_(0) {} void record_time(uint32_t duration_ms) { From dfa4328604703a2e991274cdcf1e31cc01b16061 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 8 Jul 2025 13:03:01 -0600 Subject: [PATCH 4/4] tidy up --- esphome/core/application.cpp | 3 +++ esphome/core/application.h | 3 --- esphome/core/component.cpp | 3 +++ esphome/core/component.h | 3 --- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index 6face23e3c..085b4941d1 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -4,6 +4,9 @@ #include "esphome/core/hal.h" #include #include +#ifdef USE_RUNTIME_STATS +#include "esphome/components/runtime_stats/runtime_stats.h" +#endif #ifdef USE_STATUS_LED #include "esphome/components/status_led/status_led.h" diff --git a/esphome/core/application.h b/esphome/core/application.h index 2cdcdf9e6a..f2b5cb5c89 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -9,9 +9,6 @@ #include "esphome/core/hal.h" #include "esphome/core/helpers.h" #include "esphome/core/preferences.h" -#ifdef USE_RUNTIME_STATS -#include "esphome/components/runtime_stats/runtime_stats.h" -#endif #include "esphome/core/scheduler.h" #ifdef USE_DEVICES diff --git a/esphome/core/component.cpp b/esphome/core/component.cpp index 8dbd054602..3b1120bdd7 100644 --- a/esphome/core/component.cpp +++ b/esphome/core/component.cpp @@ -9,6 +9,9 @@ #include "esphome/core/hal.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" +#ifdef USE_RUNTIME_STATS +#include "esphome/components/runtime_stats/runtime_stats.h" +#endif namespace esphome { diff --git a/esphome/core/component.h b/esphome/core/component.h index c7342cd563..3734473a02 100644 --- a/esphome/core/component.h +++ b/esphome/core/component.h @@ -6,9 +6,6 @@ #include #include "esphome/core/optional.h" -#ifdef USE_RUNTIME_STATS -#include "esphome/components/runtime_stats/runtime_stats.h" -#endif namespace esphome {