MotorWare f2806x Module API Documentation

- Main Page
- Modules
- Data Structures
- Files

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

typedef struct _CPU_USAGE_Obj_* CPU_USAGE_Handle

Defines the CPU_USAGE handle.

Definition at line 61 of file cpu_usage.h.

typedef struct _CPU_USAGE_Obj_ CPU_USAGE_Obj

Defines the CPU usage (CPU_USAGE) object.

## Function Documentation

static uint32_t CPU_USAGE_getAvgDeltaCntObserved | ( | CPU_USAGE_Handle | handle | ) |
| inline static

Gets the average delta count observed, cnts.

Parameters

  [in] | handle | The 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 | ) |
| inline static

Gets the current count value.

Parameters

  [in] | handle | The 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 | ) |
| inline static

Gets the previous count value.

Parameters

  [in] | handle | The 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 | ) |
| inline static

Gets the latest delta count measured, cnts.

Parameters

  [in] | handle | The 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 | ) |
| inline static

Gets the accumulated delta counts, cnts.

Parameters

  [in] | handle | The 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 | ) |
| inline static

Gets the number of accumulated delta counts, num.

Parameters

  [in] | handle | The 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 | ) |
| inline static

Gets the maximum number of accumulated delta counts, num.

Parameters

  [in] | handle | The 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 | ) |
| inline static

Gets the state of the reset stats flag.

Parameters

  [in] | handle | The 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 | ) |
| inline static

Gets the maximum delta count observed, cnts.

Parameters

  [in] | handle | The 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 | ) |
| inline static

Gets the minimum delta count observed, cnts.

Parameters

  [in] | handle | The 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 | ) |
| inline static

Gets the timer period, cnts.

Parameters

  [in] | handle | The 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] | pMemory | A pointer to the base address of the object
  [in] | numBytes | The 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 | ) |
| inline static

Runs the CPU usage module.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle

Definition at line 354 of file cpu_usage.h.

References _CPU_USAGE_Obj_::avgDeltaCntObserved, _CPU_USAGE_Obj_::cnt_z0, _CPU_USAGE_Obj_::cnt_z1, CPU_USAGE_getAvgDeltaCntObserved(), CPU_USAGE_getCnt_z0(), CPU_USAGE_getCnt_z1(), CPU_USAGE_getDeltaCntAcc(), CPU_USAGE_getDeltaCntAccNum(), CPU_USAGE_getDeltaCntAccNumMax(), CPU_USAGE_getFlag_resetStats(), CPU_USAGE_getMaxDeltaCntObserved(), CPU_USAGE_getMinDeltaCntObserved(), CPU_USAGE_getTimerPeriod(), CPU_USAGE_setAvgDeltaCntObserved(), CPU_USAGE_setDeltaCnt(), CPU_USAGE_setDeltaCntAcc(), CPU_USAGE_setDeltaCntAccNum(), CPU_USAGE_setFlag_resetStats(), CPU_USAGE_setMaxDeltaCntObserved(), CPU_USAGE_setMinDeltaCntObserved(), _CPU_USAGE_Obj_::deltaCnt, _CPU_USAGE_Obj_::deltaCntAcc, _CPU_USAGE_Obj_::deltaCntAccNum, _CPU_USAGE_Obj_::deltaCntAccNumMax, _CPU_USAGE_Obj_::flag_resetStats, _CPU_USAGE_Obj_::maxDeltaCntObserved, and _CPU_USAGE_Obj_::minDeltaCntObserved.

static void CPU_USAGE_setAvgDeltaCntObserved | ( | CPU_USAGE_Handle | handle,
|  | const uint32_t | avgDeltaCnt
| ) |  |
| inline static

Sets the average delta count observed, cnts.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | avgDeltaCnt | The 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
| ) |  |
| inline static

Sets the current count value.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | cnt | The 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
| ) |  |
| inline static

Sets the previous count value.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | cnt | The 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
| ) |  |
| inline static

Sets the delta count value.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | deltaCnt | The 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
| ) |  |
| inline static

Sets the accumulated delta counts value.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | deltaCntAcc | The 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
| ) |  |
| inline static

Sets the number of accumulated delta counts.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | deltaCntAccNum | The 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
| ) |  |
| inline static

Sets the maximum number of accumulated delta counts.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | deltaCntAccNumMax | The 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
| ) |  |
| inline static

Sets the state of the reset stats flag.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | state | The 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
| ) |  |
| inline static

Sets the maximum delta count observed, cnts.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | maxDeltaCnt | The 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
| ) |  |
| inline static

Sets the minimum delta count observed, cnts.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | minDeltaCnt | The 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] | handle | The CPU usage (CPU_USAGE) handle
  [in] | timerPeriod_cnts | The timer period, cnts
  [in] | numDeltaCntsAvg | The 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
| ) |  |
| inline static

Sets the timer period, cnts.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | timerPeriod_cnts | The 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
| ) |  |
| inline static

Updates the current and previous count values.

Parameters

  [in] | handle | The CPU usage (CPU_USAGE) handle
  [in] | timerCnt | The 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().