High Resolution Timer Functions
These functions can be used to measure time intervals with very high resolution. The accuracy of the timing is around 1 microsecond.
These functions both use the structure, THR_TIME. This structure contains two values: seconds (secs) and nanoseconds (ns). The nanoseconds are always less than 109 (equal to 1 second).
THR_BeginTiming
This function can be used to start a high-resolution timing operation. The timing resolution is 20ns, and the accuracy of the timer is about 1 microsecond.
Synopsis
#include <timing.h>ditto for other timing functions
void THR_BeginTiming(THR_TIME *start);
Parameter | Description |
---|---|
start
|
Address of the THR_TIME structure, which will keep the information needed to measure the timing interval. |
Return Code
N/A
THR_UpdateTiming
This function is used to update the timing operation. Since the start structure is not modified, it can be used multiple times with the same set of parameters.
Synopsis
void THR_UpdateTiming(const THR_TIME *start,
THR_TIME*elapsed);
Parameter | Description |
---|---|
start
|
Address of the THR_TIME structure that was passed to the THR_BeginTiming() function. The contents of the structure will not be modified. |
elapsed
|
Address of the THR_TIME structure, which will contain the elapsed time since THR_BeginTiming() was called. The contents of this structure will be overwritten. |
Return Code
N/A