<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > BuiltIn Functions > Timing functions > HiResTimer_Delta |
Description
Retrieves the current value of the high-resolution performance counter and compute the delta time between current time and previous call of any of the HiResTimer_... functions.
Syntax
n = HiResTimer_Delta
Returns
Number
Returned value are the microseconds elapsed.
Parameters
Name |
Type |
Optional |
Meaning |
Remarks
This function also internally store the last execution timer in order to be able to compute delta timing.
Restrictions
Attention: the function calling itself add some few microseconds overhead.
See also
Examples
USES "Console"
Dim T1, T2 As QUAD
'---Initialize hi resolution timer
HiResTimer_Init
'---Do whatever needed to be measured.
'---Here just sleep for 100 millisecs
SLEEP 100
'---Measure delta
T1 = HiResTimer_Delta
'---Do something else
'---Here just sleep for other 200 millisecs
SLEEP 200
'---Measure delta
T2 = HiResTimer_Delta
PRINTL "Elapsed time for step 1 is " & T1 & "(microseconds)"
PRINTL "Elapsed time for step 2 is " & T2 & "(microseconds)"
WAITKEY