perf_timer: add a way to get and reset the current time

This commit is contained in:
moneromooo-monero
2019-01-08 21:36:16 +03:00
committed by wowario
parent af2d19cf70
commit 70e4e4382e
2 changed files with 18 additions and 2 deletions
+16
View File
@@ -165,4 +165,20 @@ void PerformanceTimer::resume()
paused = false;
}
void PerformanceTimer::reset()
{
if (paused)
ticks = 0;
else
ticks = get_tick_count();
}
uint64_t PerformanceTimer::value() const
{
uint64_t v = ticks;
if (!paused)
v = get_tick_count() - v;
return ticks_to_ns(v);
}
}