View | Details | Raw Unified | Return to bug 1123
Collapse All | Expand All

(-)a/src/stats/model/basic-data-calculators.h (-4 / +6 lines)
 Lines 44-58    Link Here 
44
    double getMin() const { return m_min; }
44
    double getMin() const { return m_min; }
45
    double getMax() const { return m_max; }
45
    double getMax() const { return m_max; }
46
    double getMean() const { return m_total / (double)m_count; }
46
    double getMean() const { return m_total / (double)m_count; }
47
    double getStddev() const { return NaN; } // unsupported
47
    double getStddev() const { return sqrt (getVariance ()); }
48
    double getVariance() const { return NaN; } // unsupported
48
    double getVariance() const { return  ( m_count * m_totalSquare - m_total * m_total ) / (double) (m_count * (m_count - 1) ); }
49
    double getSqrSum() const { return NaN; } // unsupported
49
    double getSqrSum() const { return m_totalSquare; }
50
50
51
  protected:
51
  protected:
52
    virtual void DoDispose(void);
52
    virtual void DoDispose(void);
53
53
54
    uint32_t m_count;
54
    uint32_t m_count;
55
    T m_total, m_min, m_max;
55
    T m_total, m_min, m_max, m_totalSquare;
56
56
57
    // end MinMaxAvgTotalCalculator
57
    // end MinMaxAvgTotalCalculator
58
  };
58
  };
 Lines 63-68    Link Here 
63
  {
63
  {
64
    m_count = 0;
64
    m_count = 0;
65
    m_total = 0;
65
    m_total = 0;
66
    m_totalSquare = 0;
66
    m_min = ~0;
67
    m_min = ~0;
67
    m_max = 0;
68
    m_max = 0;
68
  }
69
  }
 Lines 85-90    Link Here 
85
  {
86
  {
86
    if (m_enabled) {
87
    if (m_enabled) {
87
      m_total += i;
88
      m_total += i;
89
      m_totalSquare += i*i;
88
90
89
      if (i < m_min)
91
      if (i < m_min)
90
        m_min = i;
92
        m_min = i;

Return to bug 1123