mirror of
https://github.com/esphome/esphome.git
synced 2026-07-11 01:15:33 +00:00
68cec9cc28
- Call original_setup() in benchmark main.cpp so code-generated App initialization (pre_setup, area/device registration, looping_components_ init) runs before benchmarks - Restore ApplicationLoop_Empty benchmark that calls the actual App.loop()
20 lines
614 B
C++
20 lines
614 B
C++
#include <benchmark/benchmark.h>
|
|
|
|
#include "esphome/core/application.h"
|
|
|
|
namespace esphome::benchmarks {
|
|
|
|
// Benchmark Application::loop() with no registered components.
|
|
// App is initialized by original_setup() in main.cpp (code-generated
|
|
// pre_setup, area/device registration, looping_components_.init).
|
|
// This measures the baseline overhead of the main loop: scheduler,
|
|
// timing, before/after loop tasks, and yield_with_select_.
|
|
static void ApplicationLoop_Empty(benchmark::State &state) {
|
|
for (auto _ : state) {
|
|
App.loop();
|
|
}
|
|
}
|
|
BENCHMARK(ApplicationLoop_Empty);
|
|
|
|
} // namespace esphome::benchmarks
|