CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
MovingAverage.cpp File Reference

Implementation of the time-binned MovingAverage tracker. More...

#include "MovingAverage.h"
#include "UnitTestFramework.h"
Include dependency graph for MovingAverage.cpp:

Go to the source code of this file.

Namespaces

namespace  cmlabs

Functions

void cmlabs::Register_MovingAverage_Tests ()

Detailed Description

Implementation of the time-binned MovingAverage tracker.

Key invariants: binTime is the constructor's binTimeMS converted to microseconds; currentBinStart is the µs timestamp of the start of entries[currentBin]; shiftBins()/add() rotate the circular buffer so the bin containing the reference time is current, zeroing recycled bins. A forward jump larger than the whole window (system sleep) clears all bins but preserves totalValue/totalCount. All public entry points lock the mutex with a 200 ms timeout.

Definition in file MovingAverage.cpp.