mirror of
https://github.com/esphome/esphome.git
synced 2026-08-31 10:06:03 +00:00
- Remove BM_ prefix from all benchmark names (unnecessary convention) - Remove bench_application_loop.cpp (App needs pre_setup/setup which requires full code generation; will revisit as integration benchmark) - Fix extra_include_dirs to use os.path.relpath for sibling directories
27 lines
554 B
C++
27 lines
554 B
C++
#include <benchmark/benchmark.h>
|
|
|
|
#include "esphome/core/helpers.h"
|
|
|
|
namespace esphome::benchmarks {
|
|
|
|
// --- random_float() ---
|
|
// Ported from ol.yaml:148 "Random Float Benchmark"
|
|
|
|
static void RandomFloat(benchmark::State &state) {
|
|
for (auto _ : state) {
|
|
benchmark::DoNotOptimize(random_float());
|
|
}
|
|
}
|
|
BENCHMARK(RandomFloat);
|
|
|
|
// --- random_uint32() ---
|
|
|
|
static void RandomUint32(benchmark::State &state) {
|
|
for (auto _ : state) {
|
|
benchmark::DoNotOptimize(random_uint32());
|
|
}
|
|
}
|
|
BENCHMARK(RandomUint32);
|
|
|
|
} // namespace esphome::benchmarks
|