ChibiOS/RT
2.6.0
Time Measurement Driver
Collaboration diagram for Time Measurement Driver:

Detailed Description

Time Measurement unit.

This module implements a time measurement mechanism able to monitor a portion of code and store the best/worst/last measurement. The measurement is performed using the realtime counter mechanism abstracted in the HAL driver.

Data Structures

struct  TimeMeasurement
 Time Measurement structure. More...

Functions

void tmInit (void)
 Initializes the Time Measurement unit.
void tmObjectInit (TimeMeasurement *tmp)
 Initializes a TimeMeasurement object.

Defines

#define tmStartMeasurement(tmp)   (tmp)->start(tmp)
 Starts a measurement.
#define tmStopMeasurement(tmp)   (tmp)->stop(tmp)
 Stops a measurement.

Typedefs

typedef struct TimeMeasurement TimeMeasurement
 Type of a Time Measurement object.

Function Documentation

void tmInit ( 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 104 of file tm.c.

References TimeMeasurement::last, tmObjectInit(), tmStartMeasurement, and tmStopMeasurement.

Referenced by halInit().

Here is the call graph for this function:

void tmObjectInit ( TimeMeasurement 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 124 of file tm.c.

References TimeMeasurement::best, TimeMeasurement::last, TimeMeasurement::start, TimeMeasurement::stop, and TimeMeasurement::worst.

Referenced by tmInit().


Define Documentation

#define tmStartMeasurement (   tmp)    (tmp)->start(tmp)

Starts a measurement.

Precondition:
The TimeMeasurement must be initialized.
Note:
This function can be invoked in any context.
Parameters:
[in,out]tmppointer to a TimeMeasurement structure
Function Class:
Special function, this function has special requirements see the notes.

Definition at line 95 of file tm.h.

Referenced by tmInit().

#define tmStopMeasurement (   tmp)    (tmp)->stop(tmp)

Stops a measurement.

Precondition:
The TimeMeasurement must be initialized.
Note:
This function can be invoked in any context.
Parameters:
[in,out]tmppointer to a TimeMeasurement structure
Function Class:
Special function, this function has special requirements see the notes.

Definition at line 106 of file tm.h.

Referenced by tmInit().


Typedef Documentation

Type of a Time Measurement object.

Note:
Start/stop of measurements is performed through the function pointers in order to avoid inlining of those functions which could compromise measurement accuracy.
The maximum measurable time period depends on the implementation of the realtime counter in the HAL driver.
The measurement is not 100% cycle-accurate, it can be in excess of few cycles depending on the compiler and target architecture.
Interrupts can affect measurement if the measurement is performed with interrupts enabled.

Definition at line 69 of file tm.h.