Skip to content

Commit dcb45c2

Browse files
committed
fix: resume and pause timing before measurements
1 parent 64d45bc commit dcb45c2

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
@@ -1066,12 +1066,14 @@ struct State::StateIterator {
10661066
if (BENCHMARK_BUILTIN_EXPECT(cached_ != 0, true)) return true;
10671067
#ifdef CODSPEED_INSTRUMENTATION
10681068
measurement_stop();
1069+
#endif
1070+
parent_->FinishKeepRunning();
10691071

1072+
#ifdef CODSPEED_INSTRUMENTATION
10701073
if (parent_->codspeed_ != NULL) {
10711074
parent_->codspeed_->end_benchmark();
10721075
}
10731076
#endif
1074-
parent_->FinishKeepRunning();
10751077
return false;
10761078
}
10771079

@@ -1084,12 +1086,14 @@ inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::begin() {
10841086
return StateIterator(this);
10851087
}
10861088
inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::end() {
1087-
StartKeepRunning();
10881089
#ifdef CODSPEED_INSTRUMENTATION
10891090
if (this->codspeed_ != NULL) {
10901091
this->codspeed_->start_benchmark(name_);
10911092
}
1092-
1093+
#endif
1094+
1095+
StartKeepRunning();
1096+
#ifdef CODSPEED_INSTRUMENTATION
10931097
measurement_start();
10941098
#endif
10951099
return StateIterator();

0 commit comments

Comments
 (0)