MXS-2078 Take new statistics into use

This commit is contained in:
Niclas Antti
2018-11-05 16:15:16 +02:00
parent 5175d2b2d7
commit c692c864e2
7 changed files with 55 additions and 31 deletions

View File

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