| |
|
|
Michael W. | Hab' eine kleine Perle von Ragnar Rehbein wieder gefunden
// angepasst an vX3
Cls
Def QPF(1 ) !"KERNEL32","QueryPerformanceFrequency"' rückgabe als LARGE_INTEGER
Def QPC(1 ) !"KERNEL32","QueryPerformanceCounter"' rückgabe als LARGE_INTEGER
Set("Decimals",0)
Declare mem time
Dim time, 16
QPF(time)// abhängig vom cpu-takt
Print "HiPerfFreq.: ", Str$(Long(time,0)) + " " + Str$(Long(time,8))
WhileLoop 200
AddString "HiPerfTimer: " + Str$(Long(time,0)) + " " + Str$(Long(time,8)) + " Tickc.: " + Str$(&GetTickCount)
QPC(time)
EndWhile
ListBox$("QueryPerformanceCounter",2)
Dispose time
' ---------
' --------- ...weitere Fundstelle...
' ---------
'Quelle: 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 schleifen, OneSec
schleifen = 20000
OneSec = 0
Print "\n...und nun " + Str$(schleifen) + " Durchläufe (über 12.000 für eine sec.)"
QPF(Addr(Frequency))
QPC(Addr(StartingTime))
WhileLoop 1,schleifen
QPC(Addr(EndingTime))
stops[&Loop] = EndingTime
EndWhile
Print "\n...und Aufbereitung"
WhileLoop 1,schleifen
ElapsedMicroseconds = stops[&Loop] - StartingTime
ElapsedMicroseconds = ElapsedMicroseconds * 1000000
ElapsedMicroseconds = ElapsedMicroseconds / Frequency
AddString "Timer: " + Format$("%8.0f µs",ElapsedMicroseconds) + Format$(" %8.3f ms",ElapsedMicroseconds/1000) + Format$(" %8.6f s --- ",ElapsedMicroseconds/1000000)+ Format$("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...und Anzeige"
Print "ENDE"
ListBox$("QueryPerformanceCounter",2)
ClearList 0
End
|
|
|
| |
|
|