Skip to content

Commit 0247b66

Browse files
committed
chore: dont start/stop measurements in warmup
We would also measure the warmup with memory profiling, which is not what we want. This was fine with simulation, because we cleared the results on the second run.
1 parent 16f4e61 commit 0247b66

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

google_benchmark/include/benchmark/benchmark.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,12 +1075,14 @@ struct State::StateIterator {
10751075
return true;
10761076
}
10771077
#ifdef CODSPEED_ANALYSIS
1078+
if (!parent_->is_warmup_) {
10781079
measurement_stop();
1080+
}
10791081
#endif
10801082
parent_->FinishKeepRunning();
10811083

10821084
#ifdef CODSPEED_ANALYSIS
1083-
if (parent_->codspeed_ != NULL) {
1085+
if (parent_->codspeed_ != NULL && !parent_->is_warmup_) {
10841086
parent_->codspeed_->end_benchmark();
10851087
}
10861088
#endif
@@ -1097,14 +1099,16 @@ inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::begin() {
10971099
}
10981100
inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::end() {
10991101
#ifdef CODSPEED_ANALYSIS
1100-
if (this->codspeed_ != NULL) {
1102+
if (this->codspeed_ != NULL && !is_warmup_) {
11011103
this->codspeed_->start_benchmark(name_);
11021104
}
11031105
#endif
11041106

11051107
StartKeepRunning();
11061108
#ifdef CODSPEED_ANALYSIS
1107-
measurement_start();
1109+
if (!is_warmup_) {
1110+
measurement_start();
1111+
}
11081112
#endif
11091113
return StateIterator();
11101114
}

0 commit comments

Comments
 (0)