Skip to content

Commit ad31ee3

Browse files
committed
fix: skip warmup in memory mode
1 parent 2d0b4e4 commit ad31ee3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

google_benchmark/src/benchmark_api_internal.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "benchmark_api_internal.h"
22

33
#include <cinttypes>
4+
#include <cstring>
45

56
#include "codspeed.h"
67
#include "string_util.h"
@@ -100,11 +101,15 @@ State BenchmarkInstance::RunAnalysis(
100101
// Do one repetition to avoid flakiness due to inconcistencies in CPU cache
101102
// from execution order
102103

103-
internal::ThreadTimer warmup_timer = internal::ThreadTimer::Create();
104-
State warmup_state(name_.function_name, 1, args_, 0, 1, &warmup_timer,
105-
manager, perf_counters_measurement, profiler_manager,
106-
NULL, /*is_warmup=*/true );
107-
benchmark_.Run(warmup_state);
104+
// Only run the warmup in simulation mode. Removing this is a breaking change and has
105+
// to be properly planned and evaluated.
106+
if (strcmp(CODSPEED_MODE_DISPLAY, "memory") != 0) {
107+
internal::ThreadTimer warmup_timer = internal::ThreadTimer::Create();
108+
State warmup_state(name_.function_name, 1, args_, 0, 1, &warmup_timer,
109+
manager, perf_counters_measurement, profiler_manager,
110+
NULL, /*is_warmup=*/true );
111+
benchmark_.Run(warmup_state);
112+
}
108113

109114
State st(name().str(), 1, args_, 0, 1, timer, manager,
110115
perf_counters_measurement, profiler_manager, codspeed);

0 commit comments

Comments
 (0)