197 extern CPU_USAGE_Handle
CPU_USAGE_init(
void *pMemory,
const size_t numBytes);
349 const uint32_t numDeltaCntsAvg);
376 deltaCnt = cnt_z1 + timerPeriod - cnt_z0 + 1;
380 deltaCnt = cnt_z1 - cnt_z0 + 1;
390 if(deltaCntAccNum >= deltaCntAccNumMax)
402 if(deltaCnt < minDeltaCntObserved)
408 if(deltaCnt > maxDeltaCntObserved)
414 if(flag_resetStats ==
true)
423 minDeltaCntObserved = timerPeriod;
424 avgDeltaCntObserved = 0;
425 maxDeltaCntObserved = 0;
427 flag_resetStats =
false;
465 #endif // end of _CPU_USAGE_H_ definition
struct _CPU_USAGE_Obj_ * CPU_USAGE_Handle
Defines the CPU_USAGE handle.
Contains the public interface to the types definitions.
static void CPU_USAGE_setCnt_z0(CPU_USAGE_Handle handle, const uint32_t cnt)
Sets the current count value.
static void CPU_USAGE_setDeltaCntAcc(CPU_USAGE_Handle handle, const uint32_t deltaCntAcc)
Sets the accumulated delta counts value.
uint32_t cnt_z1
the previous timer count value, cnts
uint32_t cnt_z0
the current timer count value, cnts
static uint32_t CPU_USAGE_getCnt_z1(CPU_USAGE_Handle handle)
Gets the previous count value.
static uint32_t CPU_USAGE_getAvgDeltaCntObserved(CPU_USAGE_Handle handle)
Gets the average delta count observed, cnts.
static void CPU_USAGE_setFlag_resetStats(CPU_USAGE_Handle handle, const bool state)
Sets the state of the reset stats flag.
uint32_t avgDeltaCntObserved
the average delta counts observed, cnts
static uint32_t CPU_USAGE_getCnt_z0(CPU_USAGE_Handle handle)
Gets the current count value.
static uint32_t CPU_USAGE_getDeltaCntAccNumMax(CPU_USAGE_Handle handle)
Gets the maximum number of accumulated delta counts, num.
static void CPU_USAGE_setDeltaCnt(CPU_USAGE_Handle handle, const uint32_t deltaCnt)
Sets the delta count value.
static void CPU_USAGE_setMinDeltaCntObserved(CPU_USAGE_Handle handle, const uint32_t minDeltaCnt)
Sets the minimum delta count observed, cnts.
uint32_t deltaCntAccNumMax
the maximum number of accumulated delta count values, num
static void CPU_USAGE_setDeltaCntAccNumMax(CPU_USAGE_Handle handle, const uint32_t deltaCntAccNumMax)
Sets the maximum number of accumulated delta counts.
uint32_t deltaCnt
the latest delta count value, cnts
static void CPU_USAGE_setMaxDeltaCntObserved(CPU_USAGE_Handle handle, const uint32_t maxDeltaCnt)
Sets the maximum delta count observed, cnts.
static void CPU_USAGE_setTimerPeriod(CPU_USAGE_Handle handle, const uint32_t timerPeriod_cnts)
Sets the timer period, cnts.
static uint32_t CPU_USAGE_getDeltaCntAcc(CPU_USAGE_Handle handle)
Gets the accumulated delta counts, cnts.
void CPU_USAGE_setParams(CPU_USAGE_Handle handle, const uint32_t timerPeriod_cnts, const uint32_t numDeltaCntsAvg)
Sets the CPU usage module parameters.
CPU_USAGE_Handle CPU_USAGE_init(void *pMemory, const size_t numBytes)
Initializes the CPU usage (CPU_USAGE) object.
static uint32_t CPU_USAGE_getDeltaCnt(CPU_USAGE_Handle handle)
Gets the latest delta count measured, cnts.
static bool CPU_USAGE_getFlag_resetStats(CPU_USAGE_Handle handle)
Gets the state of the reset stats flag.
static uint32_t CPU_USAGE_getMaxDeltaCntObserved(CPU_USAGE_Handle handle)
Gets the maximum delta count observed, cnts.
uint32_t minDeltaCntObserved
the minimum delta counts observed, cnts
static void CPU_USAGE_setDeltaCntAccNum(CPU_USAGE_Handle handle, const uint32_t deltaCntAccNum)
Sets the number of accumulated delta counts.
static void CPU_USAGE_setAvgDeltaCntObserved(CPU_USAGE_Handle handle, const uint32_t avgDeltaCnt)
Sets the average delta count observed, cnts.
uint32_t timerPeriod_cnts
the timer period, cnts
bool flag_resetStats
a flag to reset all measured data
static void CPU_USAGE_updateCnts(CPU_USAGE_Handle handle, const uint32_t cnt)
Updates the current and previous count values.
Defines the CPU usage (CPU_USAGE) object.
static uint32_t CPU_USAGE_getMinDeltaCntObserved(CPU_USAGE_Handle handle)
Gets the minimum delta count observed, cnts.
struct _CPU_USAGE_Obj_ CPU_USAGE_Obj
Defines the CPU usage (CPU_USAGE) object.
static uint32_t CPU_USAGE_getDeltaCntAccNum(CPU_USAGE_Handle handle)
Gets the number of accumulated delta counts, num.
uint32_t deltaCntAccNum
the number of accumulated delta count values, num
uint32_t deltaCntAcc
the accumulated delta count values, cnts
static void CPU_USAGE_run(CPU_USAGE_Handle handle)
Runs the CPU usage module.
static uint32_t CPU_USAGE_getTimerPeriod(CPU_USAGE_Handle handle)
Gets the timer period, cnts.
static void CPU_USAGE_setCnt_z1(CPU_USAGE_Handle handle, const uint32_t cnt)
Sets the previous count value.
uint32_t maxDeltaCntObserved
the maximum delta counts observed, cnts