MCUInstrumentation
platform/core/MCUInstrumentation.hpp
Interface for instrumenting processors to measure MCU load via measured CPU cycles.
Public Functions
virtual uint32_t | getCCConsumed() |
Gets number of consumed clock cycles. | |
virtual unsigned int | getCPUCycles(void ) =0 |
Gets CPU cycles from register. | |
virtual unsigned int | getElapsedUS(unsigned int start, unsigned int now, unsigned int clockfrequency) =0 |
Gets elapsed microseconds based on clock frequency. | |
virtual void | init() =0 |
Initialize. | |
MCUInstrumentation() | |
Initializes a new instance of the MCUInstrumentation class. | |
virtual void | setCCConsumed(uint32_t val) |
Sets number of consumed clock cycles. | |
virtual void | setMCUActive(bool active) |
Sets MCU activity high. | |
virtual | ~MCUInstrumentation() |
Finalizes an instance of the MCUInstrumentation class. | |
Protected Attributes
uint32_t | cc_consumed |
Amount of consumed CPU cycles. | |
uint32_t | cc_in |
Current CPU cycles. | |
Public Functions Documentation
getCCConsumed
virtual uint32_t getCCConsumed | ( | ) |
Gets number of consumed clock cycles.
Returns:
clock cycles.
getCPUCycles
virtual unsigned int getCPUCycles | ( | void | ) | ||
Gets CPU cycles from register.
Returns:
CPU cycles.
getElapsedUS
virtual unsigned int getElapsedUS | ( | unsigned int | start , | =0 | |
unsigned int | now , | =0 | |||
unsigned int | clockfrequency | =0 | |||
) | =0 |
Gets elapsed microseconds based on clock frequency.
Parameters:
start | Start time. |
now | Current time. |
clockfrequency | Clock frequency of the system expressed in MHz. |
Returns:
Elapsed microseconds start and now.
init
virtual void init | ( | ) | =0 |
Initialize.
MCUInstrumentation
Initializes a new instance of the MCUInstrumentation class.
setCCConsumed
virtual void setCCConsumed | ( | uint32_t | val | ) | |
Sets number of consumed clock cycles.
Parameters:
val | number of clock cycles. |
setMCUActive
virtual void setMCUActive | ( | bool | active | ) | |
Sets MCU activity high.
Parameters:
active | if True, inactive otherwise. |
~MCUInstrumentation
virtual ~MCUInstrumentation | ( | ) |
Finalizes an instance of the MCUInstrumentation class.
Protected Attributes Documentation
cc_consumed
uint32_t cc_consumed
Amount of consumed CPU cycles.
cc_in
uint32_t cc_in
Current CPU cycles.