ChibiOS/RT  6.1.4
Time Measurement
Collaboration diagram for Time Measurement:

Detailed Description

Time Measurement APIs and services.

Macros

#define TM_CALIBRATION_LOOP   4U
 Number of iterations in the calibration loop. More...
 

Data Structures

struct  tm_calibration_t
 Type of a time measurement calibration data. More...
 
struct  time_measurement_t
 Type of a Time Measurement object. More...
 

Functions

void _tm_init (void)
 Initializes the time measurement unit. More...
 
void chTMObjectInit (time_measurement_t *tmp)
 Initializes a TimeMeasurement object. More...
 
NOINLINE void chTMStartMeasurementX (time_measurement_t *tmp)
 Starts a measurement. More...
 
NOINLINE void chTMStopMeasurementX (time_measurement_t *tmp)
 Stops a measurement. More...
 
NOINLINE void chTMChainMeasurementToX (time_measurement_t *tmp1, time_measurement_t *tmp2)
 Stops a measurement and chains to the next one using the same time stamp. More...
 

Macro Definition Documentation

◆ TM_CALIBRATION_LOOP

#define TM_CALIBRATION_LOOP   4U

Number of iterations in the calibration loop.

Note
This is required in order to assess the best result in architectures with instruction cache.

Definition at line 42 of file chtm.c.

Function Documentation

◆ _tm_init()

void _tm_init ( void  )

Initializes the time measurement unit.

Function Class:
Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 84 of file chtm.c.

References time_measurement_t::best, ch, chTMObjectInit(), chTMStartMeasurementX(), chTMStopMeasurementX(), tm_calibration_t::offset, ch_system::tm, and TM_CALIBRATION_LOOP.

Referenced by chSysInit().

Here is the call graph for this function:

◆ chTMObjectInit()

void chTMObjectInit ( time_measurement_t tmp)

Initializes a TimeMeasurement object.

Parameters
[out]tmppointer to a TimeMeasurement structure
Function Class:
Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 109 of file chtm.c.

References time_measurement_t::best, time_measurement_t::cumulative, time_measurement_t::last, time_measurement_t::n, and time_measurement_t::worst.

Referenced by _stats_init(), _thread_init(), and _tm_init().

◆ chTMStartMeasurementX()

NOINLINE void chTMStartMeasurementX ( time_measurement_t tmp)

Starts a measurement.

Precondition
The time_measurement_t structure must be initialized.
Parameters
[in,out]tmppointer to a TimeMeasurement structure
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 126 of file chtm.c.

References chSysGetRealtimeCounterX, and time_measurement_t::last.

Referenced by _stats_start_measure_crit_isr(), _stats_start_measure_crit_thd(), and _tm_init().

◆ chTMStopMeasurementX()

NOINLINE void chTMStopMeasurementX ( time_measurement_t tmp)

Stops a measurement.

Precondition
The time_measurement_t structure must be initialized.
Parameters
[in,out]tmppointer to a time_measurement_t structure
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 139 of file chtm.c.

Referenced by _stats_stop_measure_crit_isr(), _stats_stop_measure_crit_thd(), and _tm_init().

◆ chTMChainMeasurementToX()

NOINLINE void chTMChainMeasurementToX ( time_measurement_t tmp1,
time_measurement_t tmp2 
)

Stops a measurement and chains to the next one using the same time stamp.

Parameters
[in,out]tmp1pointer to the time_measurement_t structure to be stopped
[in,out]tmp2pointer to the time_measurement_t structure to be started
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 156 of file chtm.c.

References chSysGetRealtimeCounterX, and time_measurement_t::last.

Referenced by _stats_ctxswc().