diff --git a/src/metrics.cpp b/src/metrics.cpp index e243171ff..0dc6c88b9 100644 --- a/src/metrics.cpp +++ b/src/metrics.cpp @@ -50,6 +50,17 @@ void AtomicTimer::stop() } } + +void AtomicTimer::zeroize() +{ + std::unique_lock lock(mtx); + // only zeroize it if there's no more threads (same semantics as start()) + if (threads < 1) { + start_time = 0; + total_time = 0; + } +} + bool AtomicTimer::running() { std::unique_lock lock(mtx); diff --git a/src/metrics.h b/src/metrics.h index e20473287..a29621f9a 100644 --- a/src/metrics.h +++ b/src/metrics.h @@ -52,6 +52,8 @@ public: */ void stop(); + void zeroize(); + bool running(); uint64_t threadCount();