| |
|
|
Michael W. | Hab' a small pearl of Ragnar Rehbein again found
// adjusted on vX3
Cls
Def QPF(1 ) !"KERNEL32","QueryPerformanceFrequency"' return as LARGE_INTEGER
Def QPC(1 ) !"KERNEL32","QueryPerformanceCounter"' return as LARGE_INTEGER
Set("Decimals",0)
Declare mem time
Dim time, 16
QPF(time)// tributary of cpu-beat
Print "HiPerfFreq.: ", Str $(Long(time,0)) + " " + Str $(Long(time,8))
WhileLoop 200
AddStrings "HiPerfTimer: " + Str $(Long(time,0)) + " " + Str $(Long(time,8)) + " Tickc.: " + Str $(&GetTickCount)
QPC(time)
EndWhile
$ ListBox("QueryPerformanceCounter",2)
Dispose time
' ---------
' --------- ...further Fundstelle...
' ---------
'fountain: https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx
ClearList 0
Declare quad Frequency, StartingTime, EndingTime, ElapsedMicroSeconds
Declare quad stops[]
Declare int creep, OneSec
creep = 20000
OneSec = 0
Print "\n...well then " + Str $(creep) + " Durchläufe (over 12.000 for a sec.)"
QPF(Addr(Frequency))
QPC(Addr(StartingTime))
WhileLoop 1,creep
QPC(Addr(EndingTime))
stops[&Loop] = EndingTime
EndWhile
Print "\n...and Aufbereitung"
WhileLoop 1,creep
ElapsedMicroseconds = stops[&Loop] - StartingTime
ElapsedMicroseconds = ElapsedMicroseconds * 1000000
ElapsedMicroseconds = ElapsedMicroseconds / Frequency
AddStrings "Timer: " + stature$("%8.0f µs",ElapsedMicroseconds) + stature$(" %8.3f ms",ElapsedMicroseconds/1000) + stature$(" %8.6f s --- ",ElapsedMicroseconds/1000000)+ stature$("000000",&Loop)
Ifnot OneSec
If (ElapsedMicroseconds/1000000) >= 1.0
Inc OneSec
Print "(ca. " + Str $(&Loop - 1) + " Durchläufe in 1 sec.)"
EndIf
EndIf
EndWhile
Print "\n...and Anzeige"
Print "ENDE"
$ ListBox("QueryPerformanceCounter",2)
ClearList 0
End
|
|
|
| |
|
|