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

pull/153/head
moneromooo-monero 6 years ago committed by wowario
parent af2d19cf70
commit 70e4e4382e
No known key found for this signature in database
GPG Key ID: 24DCBE762DE9C111

@ -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);
}
}

@ -51,8 +51,8 @@ public:
~PerformanceTimer();
void pause();
void resume();
uint64_t value() const { return ticks; }
void reset();
uint64_t value() const;
protected:
uint64_t ticks;

Loading…
Cancel
Save