Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstenhater committed Sep 26, 2024
1 parent 3f861e0 commit 1a36c82
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions arbor/profile/profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,16 @@ const std::vector<profile_accumulator>& recorder::accumulators() const {
}

void recorder::enter(region_id_type index) {
if (index_!=npos) {
throw std::runtime_error("recorder::enter without matching recorder::leave, still active: " + region_names_(index_));
}
if (index>=accumulators_.size()) {
accumulators_.resize(index+1);
}
if (index_!=npos) throw std::runtime_error("recorder::enter without matching recorder::leave.");
if (index>=accumulators_.size()) accumulators_.resize(index+1);
index_ = index;
start_time_ = timer::tic();
}

void recorder::leave() {
// calculate the elapsed time before any other steps, to increase accuracy.
auto delta = timer::toc(start_time_);

if (index_==npos) {
throw std::runtime_error("recorder::leave without matching recorder::enter");
}
if (index_==npos) throw std::runtime_error("recorder::leave without matching recorder::enter.");
accumulators_[index_].count++;
accumulators_[index_].time += delta;
index_ = npos;
Expand Down

0 comments on commit 1a36c82

Please sign in to comment.