This alternative is :t a reposting from the old forum
Can you give a little example how to use it, like below?
include \masm32\MasmBasic\MasmBasic.inc ; download (http://www.masm32.com/board/index.php?topic=12460)
Init
NanoTimer()
invoke Sleep, 500
Inkey Str$("Your puter slept for %8f µs", NanoTimer(µs))
Exit
end start
Output: Your puter slept for 500015.00 µs
include masm32rt.inc
.586
CORRELATION EQU 14 ; correlation time in ticks
;COUNTTICKS EQU 1 ; use ticks counting
;DBGTIMING EQU 1 ; check for correct correlation
;WIN EQU 1 ; for windowed interface
include timing.mac
.DATA
ifDef WIN
string db 40 dup(?)
Endif
ms DD ?
ns DD ?
.STACK
.CODE
ifDef WIN
Start:
start_timing
invoke Sleep, 500
stop_timing , ms, ns
invoke wsprintf, ADDR string, chr$("%u ms %d ns"), ms, ns
invoke MessageBox, NULL, ADDR string, chr$("Sleep(500)"), MB_OK or MB_ICONASTERISK
invoke ExitProcess, NULL
Else
Start:
start_timing
invoke Sleep, 500
stop_timing "Sleep(500)"
invoke ExitProcess, NULL
Endif
END Start
Output : Sleep(500) : 5150 ms -276 ns - if nanoseconds is negative, them need to subtract, so 5149 ms 724 ns
CORRELATION possible determine with DBGTIMING - need result is more near to zero nanoseconds.
If ticks is not fit to given range, after get counter is need to divide to 10 sometime (it's depends on Windows build version, mostly not need)