mirror of
https://github.com/monero-project/monero.git
synced 2025-12-22 07:10:46 -08:00
perf_timer: add a way to get and reset the current time
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user