00001 #ifndef STOR_FOREVER_AVERAGE_COUNTER_H 00002 #define STOR_FOREVER_AVERAGE_COUNTER_H 00003 00011 #include "boost/thread/recursive_mutex.hpp" 00012 00013 namespace stor 00014 { 00015 class ForeverAverageCounter 00016 { 00017 00018 public: 00019 00020 ForeverAverageCounter(); 00021 00022 void addSample(double value); 00023 void reset(); 00024 long long getSampleCount(); 00025 double getValueSum(); 00026 double getValueSumSquares(); 00027 double getValueAverage(); 00028 double getValueRMS(); 00029 double getValueMin(); 00030 double getValueMax(); 00031 00032 private: 00033 00034 long long sampleCount_; 00035 double currentTotal_; 00036 double currentTotalSquares_; 00037 double currentMin_; 00038 double currentMax_; 00039 00040 boost::recursive_mutex dataMutex_; 00041 00042 }; 00043 } 00044 00045 #endif