MXS-2078 Take new statistics into use
This commit is contained in:
@ -37,12 +37,14 @@ struct Duration : public Clock::duration
|
||||
{
|
||||
using Clock::duration::duration;
|
||||
Duration() = default;
|
||||
Duration(Clock::duration d) : Clock::duration(d)
|
||||
Duration(Clock::duration d)
|
||||
: Clock::duration(d)
|
||||
{
|
||||
}
|
||||
|
||||
/** From seconds */
|
||||
explicit Duration(double secs) : Duration{rep(secs * period::den / period::num)}
|
||||
explicit Duration(double secs)
|
||||
: Duration{rep(secs * period::den / period::num)}
|
||||
{
|
||||
}
|
||||
|
||||
@ -125,7 +127,7 @@ public:
|
||||
/** Resume measuring time. Ok to call multiple times without an end_interval(). */
|
||||
void start_interval();
|
||||
|
||||
/** Pause measuring time. */
|
||||
/** Pause measuring time. Ok to call without a start_interval. */
|
||||
void end_interval();
|
||||
|
||||
/** Total duration of intervals (thus far). */
|
||||
|
@ -47,7 +47,8 @@ Duration StopWatch::restart()
|
||||
return split;
|
||||
}
|
||||
|
||||
IntervalTimer::IntervalTimer() : m_total(0)
|
||||
IntervalTimer::IntervalTimer()
|
||||
: m_total(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -58,6 +59,12 @@ void IntervalTimer::start_interval()
|
||||
|
||||
void IntervalTimer::end_interval()
|
||||
{
|
||||
if (m_last_start == maxbase::TimePoint())
|
||||
{
|
||||
// m_last_start is defaulted. Ignore, avoids extra logic at call sites.
|
||||
return;
|
||||
}
|
||||
|
||||
m_total += Clock::now() - m_last_start;
|
||||
// reset to make it easier to spot usage bugs, like calling end_interval(); end_interval();
|
||||
m_last_start = TimePoint();
|
||||
|
Reference in New Issue
Block a user