func (s *StatsTracker) MovingAvg() int64 {
	s.lock.Lock()
	defer s.lock.Unlock()

	s.dropOldPoints(s.timeProvider())

	if s.avgPointsHead == nil {
		return 0
	}
	sum := s.avgPointsHead.value * s.avgPointsHead.count
	count := s.avgPointsHead.count
	for _, v := range s.aggregatedAvgPoints {
		sum += v.value * v.count
		count += v.count
	}
	return sum / count
}
// MovingAvg Gets the moving average of values within the time frame
MovingAvg Gets the moving average of values within the time frame
// MovingAvg Gets the moving average of values within the time frame
func (s *StatsTracker) MovingAvg() int64 {
	s.lock.Lock()
	defer s.lock.Unlock()
	s.dropOldPoints(s.timeProvider())
	if s.avgPointsHead == nil {
		return 0
	}
	sum := s.avgPointsHead.value * s.avgPointsHead.count
	count := s.avgPointsHead.count
	for _, v := range s.aggregatedAvgPoints {
		sum += v.value * v.count
		count += v.count
	}
	return sum / count
}
func ( s * StatsTracker ) MovingAvg ( ) int64 { s . lock . Lock ( ) defer s . lock . Unlock ( ) s . dropOldPoints ( s . timeProvider ( ) ) if s . avgPointsHead == nil { return 0 } sum := s . avgPointsHead . value * s . avgPointsHead . count count := s . avgPointsHead . count for _ , v := range s . aggregatedAvgPoints { sum += v . value * v . count count += v . count } return sum / count }
MovingAvg Gets the moving average of values within the time frame
MovingAvg Gets the moving average of values within the time frame