Fix binary path extraction and defer benchmark compile error

- Use BENCHMARK_BINARY= marker for reliable binary path extraction
  instead of fragile tail -1 (PlatformIO can print warnings after path)
- Fix Scheduler_Defer: defer() is protected on Component, use
  set_timeout(delay=0) directly on Scheduler instead
This commit is contained in:
J. Nick Koston
2026-03-17 01:42:37 -10:00
parent d5f2c93e68
commit b87b4102e0
3 changed files with 10 additions and 6 deletions
+2 -2
View File
@@ -332,8 +332,8 @@ jobs:
run: |
. venv/bin/activate
export BENCHMARK_LIB_CONFIG=$(python script/setup_codspeed_lib.py)
# --build-only prints the binary path as the last line of stdout
BINARY=$(script/cpp_benchmark.py --all --build-only | tail -1)
# --build-only prints BENCHMARK_BINARY=<path> to stdout
BINARY=$(script/cpp_benchmark.py --all --build-only | grep '^BENCHMARK_BINARY=' | tail -1 | cut -d= -f2-)
echo "binary=$BINARY" >> $GITHUB_OUTPUT
- name: Run CodSpeed benchmarks
+1 -1
View File
@@ -389,7 +389,7 @@ def build_and_run(
return exit_code
if build_only:
print(program_path)
print(f"BENCHMARK_BINARY={program_path}")
return EXIT_OK
# Run the binary
+7 -3
View File
@@ -111,16 +111,20 @@ static void Scheduler_SetInterval(benchmark::State &state) {
}
BENCHMARK(Scheduler_SetInterval);
// --- Scheduler: defer registration ---
// --- Scheduler: defer registration (set_timeout with delay=0) ---
static void Scheduler_Defer(benchmark::State &state) {
Scheduler scheduler;
Component dummy_component;
// defer() is Component::defer which calls set_timeout(delay=0).
// Call set_timeout directly since defer() is protected.
for (auto _ : state) {
for (int i = 0; i < kInnerIterations; i++) {
dummy_component.defer(static_cast<uint32_t>(i % 5), []() {});
scheduler.set_timeout(&dummy_component, static_cast<uint32_t>(i % 5), 0, []() {});
}
benchmark::DoNotOptimize(dummy_component);
scheduler.process_to_add();
benchmark::DoNotOptimize(scheduler);
}
state.SetItemsProcessed(state.iterations() * kInnerIterations);
}