mirror of
https://github.com/overte-org/overte.git
synced 2025-06-05 05:01:03 +02:00
36 lines
767 B
C++
36 lines
767 B
C++
//
|
|
// SimpleMovingAverage.h
|
|
// hifi
|
|
//
|
|
// Created by Stephen Birarda on 4/18/13.
|
|
// Replaces Brad Hefta-Gaub's CounterStats class (RIP)
|
|
//
|
|
//
|
|
|
|
#ifndef __hifi__Stats__
|
|
#define __hifi__Stats__
|
|
|
|
#include <iostream>
|
|
|
|
class SimpleMovingAverage {
|
|
public:
|
|
SimpleMovingAverage(int numSamplesToAverage);
|
|
|
|
int updateAverage(float sample);
|
|
void reset();
|
|
|
|
int getSampleCount() { return _numSamples; };
|
|
float getAverage() { return _average; };
|
|
float getEventDeltaAverage();
|
|
float getAverageSampleValuePerSecond();
|
|
private:
|
|
int _numSamples;
|
|
long long _lastEventTimestamp;
|
|
float _average;
|
|
float _eventDeltaAverage;
|
|
|
|
const float WEIGHTING;
|
|
const float ONE_MINUS_WEIGHTING;
|
|
};
|
|
|
|
#endif /* defined(__hifi__Stats__) */
|