MotorWare f2806x Module API Documentation
Data Structures | Typedefs | Functions
CPU_USAGE

Data Structures

struct  _CPU_USAGE_Obj_
 Defines the CPU usage (CPU_USAGE) object. More...
 

Typedefs

typedef struct _CPU_USAGE_Obj_ CPU_USAGE_Obj
 Defines the CPU usage (CPU_USAGE) object. More...
 
typedef struct _CPU_USAGE_Obj_CPU_USAGE_Handle
 Defines the CPU_USAGE handle. More...
 

Functions

static uint32_t CPU_USAGE_getTimerPeriod (CPU_USAGE_Handle handle)
 Gets the timer period, cnts. More...
 
static uint32_t CPU_USAGE_getCnt_z0 (CPU_USAGE_Handle handle)
 Gets the current count value. More...
 
static uint32_t CPU_USAGE_getCnt_z1 (CPU_USAGE_Handle handle)
 Gets the previous count value. More...
 
static uint32_t CPU_USAGE_getDeltaCnt (CPU_USAGE_Handle handle)
 Gets the latest delta count measured, cnts. More...
 
static uint32_t CPU_USAGE_getDeltaCntAcc (CPU_USAGE_Handle handle)
 Gets the accumulated delta counts, cnts. More...
 
static uint32_t CPU_USAGE_getDeltaCntAccNum (CPU_USAGE_Handle handle)
 Gets the number of accumulated delta counts, num. More...
 
static uint32_t CPU_USAGE_getDeltaCntAccNumMax (CPU_USAGE_Handle handle)
 Gets the maximum number of accumulated delta counts, num. More...
 
static uint32_t CPU_USAGE_getMinDeltaCntObserved (CPU_USAGE_Handle handle)
 Gets the minimum delta count observed, cnts. More...
 
static uint32_t CPU_USAGE_getAvgDeltaCntObserved (CPU_USAGE_Handle handle)
 Gets the average delta count observed, cnts. More...
 
static uint32_t CPU_USAGE_getMaxDeltaCntObserved (CPU_USAGE_Handle handle)
 Gets the maximum delta count observed, cnts. More...
 
static bool CPU_USAGE_getFlag_resetStats (CPU_USAGE_Handle handle)
 Gets the state of the reset stats flag. More...
 
CPU_USAGE_Handle CPU_USAGE_init (void *pMemory, const size_t numBytes)
 Initializes the CPU usage (CPU_USAGE) object. More...
 
static void CPU_USAGE_setTimerPeriod (CPU_USAGE_Handle handle, const uint32_t timerPeriod_cnts)
 Sets the timer period, cnts. More...
 
static void CPU_USAGE_setCnt_z0 (CPU_USAGE_Handle handle, const uint32_t cnt)
 Sets the current count value. More...
 
static void CPU_USAGE_setCnt_z1 (CPU_USAGE_Handle handle, const uint32_t cnt)
 Sets the previous count value. More...
 
static void CPU_USAGE_setDeltaCnt (CPU_USAGE_Handle handle, const uint32_t deltaCnt)
 Sets the delta count value. More...
 
static void CPU_USAGE_setDeltaCntAcc (CPU_USAGE_Handle handle, const uint32_t deltaCntAcc)
 Sets the accumulated delta counts value. More...
 
static void CPU_USAGE_setDeltaCntAccNum (CPU_USAGE_Handle handle, const uint32_t deltaCntAccNum)
 Sets the number of accumulated delta counts. More...
 
static void CPU_USAGE_setDeltaCntAccNumMax (CPU_USAGE_Handle handle, const uint32_t deltaCntAccNumMax)
 Sets the maximum number of accumulated delta counts. More...
 
static void CPU_USAGE_setMinDeltaCntObserved (CPU_USAGE_Handle handle, const uint32_t minDeltaCnt)
 Sets the minimum delta count observed, cnts. More...
 
static void CPU_USAGE_setAvgDeltaCntObserved (CPU_USAGE_Handle handle, const uint32_t avgDeltaCnt)
 Sets the average delta count observed, cnts. More...
 
static void CPU_USAGE_setMaxDeltaCntObserved (CPU_USAGE_Handle handle, const uint32_t maxDeltaCnt)
 Sets the maximum delta count observed, cnts. More...
 
static void CPU_USAGE_setFlag_resetStats (CPU_USAGE_Handle handle, const bool state)
 Sets the state of the reset stats flag. More...
 
void CPU_USAGE_setParams (CPU_USAGE_Handle handle, const uint32_t timerPeriod_cnts, const uint32_t numDeltaCntsAvg)
 Sets the CPU usage module parameters. More...
 
static void CPU_USAGE_run (CPU_USAGE_Handle handle)
 Runs the CPU usage module. More...
 
static void CPU_USAGE_updateCnts (CPU_USAGE_Handle handle, const uint32_t cnt)
 Updates the current and previous count values. More...
 

Detailed Description


Data Structure Documentation

struct _CPU_USAGE_Obj_

Defines the CPU usage (CPU_USAGE) object.

Definition at line 40 of file cpu_usage.h.

Data Fields
uint32_t avgDeltaCntObserved the average delta counts observed, cnts
uint32_t cnt_z0 the current timer count value, cnts
uint32_t cnt_z1 the previous timer count value, cnts
uint32_t deltaCnt the latest delta count value, cnts
uint32_t deltaCntAcc the accumulated delta count values, cnts
uint32_t deltaCntAccNum the number of accumulated delta count values, num
uint32_t deltaCntAccNumMax the maximum number of accumulated delta count values, num
bool flag_resetStats a flag to reset all measured data
uint32_t maxDeltaCntObserved the maximum delta counts observed, cnts
uint32_t minDeltaCntObserved the minimum delta counts observed, cnts
uint32_t timerPeriod_cnts the timer period, cnts

Typedef Documentation

Defines the CPU_USAGE handle.

Definition at line 61 of file cpu_usage.h.

Defines the CPU usage (CPU_USAGE) object.

Function Documentation

static uint32_t CPU_USAGE_getAvgDeltaCntObserved ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the average delta count observed, cnts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The average delta count allowed, cnts

Definition at line 163 of file cpu_usage.h.

References _CPU_USAGE_Obj_::avgDeltaCntObserved.

Referenced by CPU_USAGE_run().

static uint32_t CPU_USAGE_getCnt_z0 ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the current count value.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The current timer count value

Definition at line 86 of file cpu_usage.h.

References _CPU_USAGE_Obj_::cnt_z0.

Referenced by CPU_USAGE_run(), and CPU_USAGE_updateCnts().

static uint32_t CPU_USAGE_getCnt_z1 ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the previous count value.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The previous ount value

Definition at line 97 of file cpu_usage.h.

References _CPU_USAGE_Obj_::cnt_z1.

Referenced by CPU_USAGE_run().

static uint32_t CPU_USAGE_getDeltaCnt ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the latest delta count measured, cnts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The latest delta counts measured, cnts

Definition at line 108 of file cpu_usage.h.

References _CPU_USAGE_Obj_::deltaCnt.

static uint32_t CPU_USAGE_getDeltaCntAcc ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the accumulated delta counts, cnts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The accumulated delta counts, cnts

Definition at line 119 of file cpu_usage.h.

References _CPU_USAGE_Obj_::deltaCntAcc.

Referenced by CPU_USAGE_run().

static uint32_t CPU_USAGE_getDeltaCntAccNum ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the number of accumulated delta counts, num.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The number of accumulated delta counts, num

Definition at line 130 of file cpu_usage.h.

References _CPU_USAGE_Obj_::deltaCntAccNum.

Referenced by CPU_USAGE_run().

static uint32_t CPU_USAGE_getDeltaCntAccNumMax ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the maximum number of accumulated delta counts, num.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The maximum number of accumulated delta counts, num

Definition at line 141 of file cpu_usage.h.

References _CPU_USAGE_Obj_::deltaCntAccNumMax.

Referenced by CPU_USAGE_run().

static bool CPU_USAGE_getFlag_resetStats ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the state of the reset stats flag.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The flag state

Definition at line 185 of file cpu_usage.h.

References _CPU_USAGE_Obj_::flag_resetStats.

Referenced by CPU_USAGE_run().

static uint32_t CPU_USAGE_getMaxDeltaCntObserved ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the maximum delta count observed, cnts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The maximum delta count allowed, cnts

Definition at line 174 of file cpu_usage.h.

References _CPU_USAGE_Obj_::maxDeltaCntObserved.

Referenced by CPU_USAGE_run().

static uint32_t CPU_USAGE_getMinDeltaCntObserved ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the minimum delta count observed, cnts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The minimum delta count allowed, cnts

Definition at line 152 of file cpu_usage.h.

References _CPU_USAGE_Obj_::minDeltaCntObserved.

Referenced by CPU_USAGE_run().

static uint32_t CPU_USAGE_getTimerPeriod ( CPU_USAGE_Handle  handle)
inlinestatic

Gets the timer period, cnts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
Returns
The timer period, cnts

Definition at line 75 of file cpu_usage.h.

References _CPU_USAGE_Obj_::timerPeriod_cnts.

Referenced by CPU_USAGE_run().

CPU_USAGE_Handle CPU_USAGE_init ( void *  pMemory,
const size_t  numBytes 
)

Initializes the CPU usage (CPU_USAGE) object.

Parameters
[in]pMemoryA pointer to the base address of the object
[in]numBytesThe object size, bytes
Returns
The handle to the object

Definition at line 21 of file cpu_usage.c.

static void CPU_USAGE_run ( CPU_USAGE_Handle  handle)
inlinestatic
static void CPU_USAGE_setAvgDeltaCntObserved ( CPU_USAGE_Handle  handle,
const uint32_t  avgDeltaCnt 
)
inlinestatic

Sets the average delta count observed, cnts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]avgDeltaCntThe average delta count observed, cnts

Definition at line 307 of file cpu_usage.h.

References _CPU_USAGE_Obj_::avgDeltaCntObserved.

Referenced by CPU_USAGE_run(), and CPU_USAGE_setParams().

static void CPU_USAGE_setCnt_z0 ( CPU_USAGE_Handle  handle,
const uint32_t  cnt 
)
inlinestatic

Sets the current count value.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]cntThe current count value

Definition at line 216 of file cpu_usage.h.

References _CPU_USAGE_Obj_::cnt_z0.

Referenced by CPU_USAGE_setParams(), and CPU_USAGE_updateCnts().

static void CPU_USAGE_setCnt_z1 ( CPU_USAGE_Handle  handle,
const uint32_t  cnt 
)
inlinestatic

Sets the previous count value.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]cntThe previous count value

Definition at line 229 of file cpu_usage.h.

References _CPU_USAGE_Obj_::cnt_z1.

Referenced by CPU_USAGE_setParams(), and CPU_USAGE_updateCnts().

static void CPU_USAGE_setDeltaCnt ( CPU_USAGE_Handle  handle,
const uint32_t  deltaCnt 
)
inlinestatic

Sets the delta count value.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]deltaCntThe delta count value

Definition at line 242 of file cpu_usage.h.

References _CPU_USAGE_Obj_::deltaCnt.

Referenced by CPU_USAGE_run(), and CPU_USAGE_setParams().

static void CPU_USAGE_setDeltaCntAcc ( CPU_USAGE_Handle  handle,
const uint32_t  deltaCntAcc 
)
inlinestatic

Sets the accumulated delta counts value.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]deltaCntAccThe accumulated delta counts value

Definition at line 255 of file cpu_usage.h.

References _CPU_USAGE_Obj_::deltaCntAcc.

Referenced by CPU_USAGE_run(), and CPU_USAGE_setParams().

static void CPU_USAGE_setDeltaCntAccNum ( CPU_USAGE_Handle  handle,
const uint32_t  deltaCntAccNum 
)
inlinestatic

Sets the number of accumulated delta counts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]deltaCntAccNumThe number of accumulated delta counts

Definition at line 268 of file cpu_usage.h.

References _CPU_USAGE_Obj_::deltaCntAccNum.

Referenced by CPU_USAGE_run(), and CPU_USAGE_setParams().

static void CPU_USAGE_setDeltaCntAccNumMax ( CPU_USAGE_Handle  handle,
const uint32_t  deltaCntAccNumMax 
)
inlinestatic

Sets the maximum number of accumulated delta counts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]deltaCntAccNumMaxThe maximum number of accumulated delta counts

Definition at line 281 of file cpu_usage.h.

References _CPU_USAGE_Obj_::deltaCntAccNumMax.

Referenced by CPU_USAGE_setParams().

static void CPU_USAGE_setFlag_resetStats ( CPU_USAGE_Handle  handle,
const bool  state 
)
inlinestatic

Sets the state of the reset stats flag.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]stateThe desired state

Definition at line 333 of file cpu_usage.h.

References _CPU_USAGE_Obj_::flag_resetStats.

Referenced by CPU_USAGE_run(), and CPU_USAGE_setParams().

static void CPU_USAGE_setMaxDeltaCntObserved ( CPU_USAGE_Handle  handle,
const uint32_t  maxDeltaCnt 
)
inlinestatic

Sets the maximum delta count observed, cnts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]maxDeltaCntThe maximum delta count observed, cnts

Definition at line 320 of file cpu_usage.h.

References _CPU_USAGE_Obj_::maxDeltaCntObserved.

Referenced by CPU_USAGE_run(), and CPU_USAGE_setParams().

static void CPU_USAGE_setMinDeltaCntObserved ( CPU_USAGE_Handle  handle,
const uint32_t  minDeltaCnt 
)
inlinestatic

Sets the minimum delta count observed, cnts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]minDeltaCntThe minimum delta count observed, cnts

Definition at line 294 of file cpu_usage.h.

References _CPU_USAGE_Obj_::minDeltaCntObserved.

Referenced by CPU_USAGE_run(), and CPU_USAGE_setParams().

void CPU_USAGE_setParams ( CPU_USAGE_Handle  handle,
const uint32_t  timerPeriod_cnts,
const uint32_t  numDeltaCntsAvg 
)

Sets the CPU usage module parameters.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]timerPeriod_cntsThe timer period, cnts
[in]numDeltaCntsAvgThe number of delta accumulations for the average calculation

Definition at line 34 of file cpu_usage.c.

References CPU_USAGE_setAvgDeltaCntObserved(), CPU_USAGE_setCnt_z0(), CPU_USAGE_setCnt_z1(), CPU_USAGE_setDeltaCnt(), CPU_USAGE_setDeltaCntAcc(), CPU_USAGE_setDeltaCntAccNum(), CPU_USAGE_setDeltaCntAccNumMax(), CPU_USAGE_setFlag_resetStats(), CPU_USAGE_setMaxDeltaCntObserved(), CPU_USAGE_setMinDeltaCntObserved(), and CPU_USAGE_setTimerPeriod().

static void CPU_USAGE_setTimerPeriod ( CPU_USAGE_Handle  handle,
const uint32_t  timerPeriod_cnts 
)
inlinestatic

Sets the timer period, cnts.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]timerPeriod_cntsThe timer period, cnts

Definition at line 203 of file cpu_usage.h.

References _CPU_USAGE_Obj_::timerPeriod_cnts.

Referenced by CPU_USAGE_setParams().

static void CPU_USAGE_updateCnts ( CPU_USAGE_Handle  handle,
const uint32_t  cnt 
)
inlinestatic

Updates the current and previous count values.

Parameters
[in]handleThe CPU usage (CPU_USAGE) handle
[in]timerCntThe current count value

Definition at line 448 of file cpu_usage.h.

References _CPU_USAGE_Obj_::cnt_z0, CPU_USAGE_getCnt_z0(), CPU_USAGE_setCnt_z0(), and CPU_USAGE_setCnt_z1().