| |
|
|
Michael W. | Hab' una kleine Perle de Ragnar Rehbein otra vez gefunden
// adaptado a vX3
Cls
Def QPF(1 ) !"KERNEL32","QueryPerformanceFrequency"' rückgabe como LARGE_INTEGER
Def QPC(1 ) !"KERNEL32","QueryPerformanceCounter"' rückgabe como LARGE_INTEGER
Conjunto("Decimals",0)
Declarar mem time
Dim time, 16
QPF(time)// abhängig vom cpu-takt
Imprimir "HiPerfFreq.: ", Str$(Largo(time,0)) + " " + Str$(Largo(time,8))
WhileLoop 200
AddStrings "HiPerfTimer: " + Str$(Largo(time,0)) + " " + Str$(Largo(time,8)) + " Tickc.: " + Str$(&GetTickCount)
QPC(time)
EndWhile
ListBox$("QueryPerformanceCounter",2)
Disponer time
' ---------
' --------- ...weitere Fundstelle...
' ---------
'Quelle: https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx
ClearList 0
Declarar quad Frequency, StartingTime, EndingTime, ElapsedMicroSeconds
Declarar quad stops[]
Declarar int schleifen, OneSec
schleifen = 20000
OneSec = 0
Imprimir "\n...y nun " + Str$(schleifen) + " Durchläufe (encima 12.000 para una sec.)"
QPF(Addr(Frequency))
QPC(Addr(StartingTime))
WhileLoop 1,schleifen
QPC(Addr(EndingTime))
stops[&Loop] = EndingTime
EndWhile
Imprimir "\n...y Aufbereitung"
WhileLoop 1,schleifen
ElapsedMicroseconds = stops[&Loop] - StartingTime
ElapsedMicroseconds = ElapsedMicroseconds * 1000000
ElapsedMicroseconds = ElapsedMicroseconds / Frequency
AddStrings "Timer: " + Formato$("%8.0f µs",ElapsedMicroseconds) + Formato$(" %8.3f ms",ElapsedMicroseconds/1000) + Formato$(" %8.6f s --- ",ElapsedMicroseconds/1000000)+ Formato$("000000",&Loop)
Caso negativo OneSec
If (ElapsedMicroseconds/1000000) >= 1.0
Inc OneSec
Imprimir "(ca. " + Str$(&Loop - 1) + " Durchläufe en 1 sec.)"
EndIf
EndIf
EndWhile
Imprimir "\n...y Anzeige"
Imprimir "ENDE"
ListBox$("QueryPerformanceCounter",2)
ClearList 0
End
|
|
|
| |
|
|