implement AtomicTimer::zeroize() that resets start_time and total_time
This commit is contained in:
parent
0f06774e94
commit
0e13aba1b7
|
@ -50,6 +50,17 @@ void AtomicTimer::stop()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void AtomicTimer::zeroize()
|
||||
{
|
||||
std::unique_lock<std::mutex> 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<std::mutex> lock(mtx);
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
*/
|
||||
void stop();
|
||||
|
||||
void zeroize();
|
||||
|
||||
bool running();
|
||||
|
||||
uint64_t threadCount();
|
||||
|
|
Loading…
Reference in New Issue