跳轉到主要內容

MCUInstrumentation

Interface for instrumenting processors to measure MCU load via measured CPU cycles.

Public Functions

virtual uint32_tgetCCConsumed()
Gets number of consumed clock cycles.
virtual unsigned intgetCPUCycles(void ) =0
Gets CPU cycles from register.
virtual unsigned intgetElapsedUS(unsigned int start, unsigned int now, unsigned int clockfrequency) =0
Gets elapsed microseconds based on clock frequency.
virtual voidinit() =0
Initialize.
MCUInstrumentation()
Initializes a new instance of the MCUInstrumentation class.
virtual voidsetCCConsumed(uint32_t val)
Sets number of consumed clock cycles.
virtual voidsetMCUActive(bool active)
Sets MCU activity high.
virtual ~MCUInstrumentation()
Finalizes an instance of the MCUInstrumentation class.

Protected Attributes

uint32_tcc_consumed
Amount of consumed CPU cycles.
uint32_tcc_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 intstart ,=0
unsigned intnow ,=0
unsigned intclockfrequency=0
)=0

Gets elapsed microseconds based on clock frequency.

Parameters:
startStart time.
nowCurrent time.
clockfrequencyClock 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_tval)

Sets number of consumed clock cycles.

Parameters:
valnumber of clock cycles.

setMCUActive

virtual void setMCUActive(boolactive)

Sets MCU activity high.

Parameters:
activeif True, inactive otherwise.

~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.