diff --git a/libraries/shared/src/CounterStats.cpp b/libraries/shared/src/CounterStats.cpp index 20281c113e..b86cfd37f2 100644 --- a/libraries/shared/src/CounterStats.cpp +++ b/libraries/shared/src/CounterStats.cpp @@ -33,20 +33,40 @@ // int sampleAt; -CounterStatHistory::CounterStatHistory() { - init(); +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) { - init(); - name = myName; +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) { - init(); - lastCount = currentCount = initialCount; - lastTime = currentTime = totalTime = initialTime; - name = myName; + +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() {