Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions google_benchmark/include/benchmark/benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -1074,16 +1074,7 @@ struct State::StateIterator {
if (BENCHMARK_BUILTIN_EXPECT(cached_ != 0, true)) {
return true;
}
#ifdef CODSPEED_ANALYSIS
measurement_stop();
#endif
parent_->FinishKeepRunning();

#ifdef CODSPEED_ANALYSIS
if (parent_->codspeed_ != NULL) {
parent_->codspeed_->end_benchmark();
}
#endif
return false;
}

Expand All @@ -1096,16 +1087,7 @@ inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::begin() {
return StateIterator(this);
}
inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::end() {
#ifdef CODSPEED_ANALYSIS
if (this->codspeed_ != NULL) {
this->codspeed_->start_benchmark(name_);
}
#endif

StartKeepRunning();
#ifdef CODSPEED_ANALYSIS
measurement_start();
#endif
return StateIterator();
}

Expand Down
16 changes: 16 additions & 0 deletions google_benchmark/src/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@ void State::SetLabel(const std::string& label) {
}

void State::StartKeepRunning() {
#ifdef CODSPEED_ANALYSIS
if (codspeed_ != NULL) {
codspeed_->start_benchmark(name_);
}
#endif
BM_CHECK(!started_ && !finished_);
started_ = true;
total_iterations_ = skipped() ? 0 : max_iterations;
Expand All @@ -364,9 +369,15 @@ void State::StartKeepRunning() {
if (!skipped()) {
ResumeTiming();
}
#ifdef CODSPEED_ANALYSIS
measurement_start();
#endif
}

void State::FinishKeepRunning() {
#ifdef CODSPEED_ANALYSIS
measurement_stop();
#endif
BM_CHECK(started_ && (!finished_ || skipped()));
if (!skipped()) {
PauseTiming();
Expand All @@ -378,6 +389,11 @@ void State::FinishKeepRunning() {
if (BENCHMARK_BUILTIN_EXPECT(profiler_manager_ != nullptr, false)) {
profiler_manager_->BeforeTeardownStop();
}
#ifdef CODSPEED_ANALYSIS
if (codspeed_ != NULL) {
codspeed_->end_benchmark();
}
#endif
}

namespace internal {
Expand Down