diff --git a/libraries/shared/src/CounterStats.cpp b/libraries/shared/src/CounterStats.cpp index 050ee6159b..b86cfd37f2 100644 --- a/libraries/shared/src/CounterStats.cpp +++ b/libraries/shared/src/CounterStats.cpp @@ -33,6 +33,53 @@ // int sampleAt; +CounterStatHistory::CounterStatHistory() : + currentCount(0), + currentDelta(0), + currentTime(0.0), + lastCount(0), + lastTime(0.0), + totalTime(0.0), + sampleAt(-1), + sampleCount(0) { +} + +CounterStatHistory::CounterStatHistory(std::string myName) : + name(myName), + currentCount(0), + currentDelta(0), + currentTime(0.0), + lastCount(0), + lastTime(0.0), + totalTime(0.0), + sampleAt(-1), + sampleCount(0) { +} + + +CounterStatHistory::CounterStatHistory(std::string myName, double initialTime, long initialCount) : + name(myName), + currentCount(initialCount), + currentDelta(0), + currentTime(initialTime), + lastCount(initialCount), + lastTime(initialTime), + totalTime(initialTime), + sampleAt(-1), + sampleCount(0) { +} + +void CounterStatHistory::init() { + currentCount = 0; + currentDelta = 0; + currentTime = 0.0; + lastCount = 0; + lastTime = 0.0; + totalTime = 0.0; + sampleAt = -1; + sampleCount = 0; +} + void CounterStatHistory::recordSample(long thisCount) { timeval now; gettimeofday(&now,NULL); diff --git a/libraries/shared/src/CounterStats.h b/libraries/shared/src/CounterStats.h index 7d698d0970..81e34853ef 100644 --- a/libraries/shared/src/CounterStats.h +++ b/libraries/shared/src/CounterStats.h @@ -25,23 +25,9 @@ class CounterStatHistory { public: std::string name; - CounterStatHistory(std::string myName): - currentCount(0), currentDelta(0),currentTime(0.0), - lastCount(0),lastTime(0.0), - totalTime(0.0), - sampleAt(-1), sampleCount(0), name(myName) {}; - - CounterStatHistory(): - currentCount(0), currentDelta(0),currentTime(0.0), - lastCount(0),lastTime(0.0), - totalTime(0.0), - sampleAt(-1), sampleCount(0) {}; - - CounterStatHistory(std::string myName, double initialTime, long initialCount) : - currentCount(initialCount), currentDelta(0), currentTime(initialTime), - lastCount(initialCount),lastTime(initialTime), - totalTime(initialTime), - sampleAt(-1), sampleCount(0), name(myName) {}; + CounterStatHistory(); + CounterStatHistory(std::string myName); + CounterStatHistory(std::string myName, double initialTime, long initialCount); void recordSample(long thisCount); void recordSample(double thisTime, long thisCount); @@ -58,6 +44,8 @@ public: return currentCount; }; private: + void init(); + long currentCount; long currentDelta; double currentTime;