Skip to content

Commit 6cdd8c0

Browse files
committed
fix: separate instrumentation and walltime hooks
1 parent d782974 commit 6cdd8c0

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

google_benchmark/include/benchmark/benchmark.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,10 +1066,9 @@ struct State::StateIterator {
10661066
if (BENCHMARK_BUILTIN_EXPECT(cached_ != 0, true)) return true;
10671067

10681068

1069-
#if defined(CODSPEED_INSTRUMENTATION) || defined(CODSPEED_WALLTIME)
1069+
#if defined(CODSPEED_INSTRUMENTATION)
10701070
measurement_stop();
1071-
#endif
1072-
#ifdef CODSPEED_INSTRUMENTATION
1071+
10731072
if (parent_->codspeed_ != NULL) {
10741073
parent_->codspeed_->end_benchmark();
10751074
}
@@ -1094,8 +1093,7 @@ inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::end() {
10941093
if (this->codspeed_ != NULL) {
10951094
this->codspeed_->start_benchmark(name_);
10961095
}
1097-
#endif
1098-
#if defined(CODSPEED_INSTRUMENTATION) || defined(CODSPEED_WALLTIME)
1096+
10991097
measurement_start();
11001098
#endif
11011099

google_benchmark/src/benchmark.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
548548
if (codspeed != nullptr) {
549549
codspeed->start_benchmark(runner.GetBenchmarkName());
550550
}
551+
552+
measurement_start();
551553
#endif
552554

553555
runner.DoOneRepetition();
@@ -579,6 +581,8 @@ void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
579581
}
580582

581583
#ifdef CODSPEED_WALLTIME
584+
measurement_stop();
585+
582586
if (codspeed != nullptr) {
583587
codspeed->end_benchmark();
584588
}

0 commit comments

Comments
 (0)