DIY Auto-Correlator 1.0
Auto-Correlator Card implementation using Teensy 4.x microcontrollers.
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PerfCounter Class Reference

Performance Counter class for teensy 4.1 microcontrollers. More...

#include <perf_counter.hpp>

Public Member Functions

void start () __attribute__((always_inline))
 Start Measurement. More...
 
void end () __attribute__((always_inline))
 End measurement. More...
 
float mean ()
 Returns the mean number of cycles between start() and stop(). More...
 
uint32_t last_duration ()
 Returns the last recorded duration. More...
 
void reset () __attribute__((always_inline))
 
void output () __attribute__((always_inline))
 

Static Public Member Functions

static void init () __attribute__((always_inline))
 Set up the debug module for clock cycle counting. More...
 

Public Attributes

uint32_t Stack = 0
 Stack for mean calculation. More...
 
uint32_t Count = 0
 Count for mean calculation. More...
 
uint32_t Cycles = 0
 Last recorded duration (difference in clock cycles recorded) More...
 
uint32_t StartTime = 0
 Stored starting time of the measurement. More...
 

Detailed Description

Performance Counter class for teensy 4.1 microcontrollers.

Note
imxrt.h defines ARM_DWT_CYCCNT as (*(volatile uint32_t *)0xE0001004).

Member Function Documentation

◆ end()

void PerfCounter::end ( )
inline

End measurement.

◆ init()

static void PerfCounter::init ( )
inlinestatic

Set up the debug module for clock cycle counting.

Warning
This function sets the registers globally and will affect all instances and also the overall performance.

◆ last_duration()

uint32_t PerfCounter::last_duration ( )
inline

Returns the last recorded duration.

◆ mean()

float PerfCounter::mean ( )
inline

Returns the mean number of cycles between start() and stop().

◆ output()

void PerfCounter::output ( )
inline

◆ reset()

void PerfCounter::reset ( )
inline

◆ start()

void PerfCounter::start ( )
inline

Start Measurement.

Member Data Documentation

◆ Count

uint32_t PerfCounter::Count = 0

Count for mean calculation.

◆ Cycles

uint32_t PerfCounter::Cycles = 0

Last recorded duration (difference in clock cycles recorded)

◆ Stack

uint32_t PerfCounter::Stack = 0

Stack for mean calculation.

◆ StartTime

uint32_t PerfCounter::StartTime = 0

Stored starting time of the measurement.


The documentation for this class was generated from the following file: