diff options
author | Yuri Gorshenin <y@maps.me> | 2016-09-27 19:20:43 +0300 |
---|---|---|
committer | Yuri Gorshenin <y@maps.me> | 2016-09-28 14:46:25 +0300 |
commit | c9ef1fa3663816af59c09311d0004a0bb546c236 (patch) | |
tree | 9a7b4613b8239ceb42ea3c0daefc2689b7cbdb0f /base/time_samples.cpp | |
parent | 5951f4c0f834a139a78aa375e839b84ebde75bd4 (diff) |
Review fixes.
Diffstat (limited to 'base/time_samples.cpp')
-rw-r--r-- | base/time_samples.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/base/time_samples.cpp b/base/time_samples.cpp index 3a0d439e18..209385b060 100644 --- a/base/time_samples.cpp +++ b/base/time_samples.cpp @@ -4,21 +4,21 @@ namespace my { -void TimeSamples::Add(double s) +void TimeSamples::Add(double seconds) { - m_s += s; - m_s2 += s * s; + m_sum += seconds; + m_sum2 += seconds * seconds; ++m_total; } -double TimeSamples::GetMean() const { return m_total == 0 ? 0.0 : m_s / m_total; } +double TimeSamples::GetMean() const { return m_total == 0 ? 0.0 : m_sum / m_total; } -double TimeSamples::GetSd() const +double TimeSamples::GetSD() const { if (m_total < 2) return 0.0; - return std::max((m_s2 - m_s * m_s / static_cast<double>(m_total)) / (m_total - 1), 0.0); + return std::max((m_sum2 - m_sum * m_sum / static_cast<double>(m_total)) / (m_total - 1), 0.0); } -double TimeSamples::GetVar() const { return sqrt(GetSd()); } +double TimeSamples::GetVar() const { return sqrt(GetSD()); } } // namespace my |