English
Source / code snippets

QueryPerformanceCounter, Zeitmessung, GetTickCount

 

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
 
Alle Sprachen
System: Windows 8/10, XProfan X4
Programmieren, das spannendste Detektivspiel der Welt.
08/13/16  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.964 Views

Untitledvor 0 min.
p.specht07/06/22
Peter Max Müller11/18/21
Wilfried Friebe11/17/21
RudiB.11/17/21
More...

Themeninformationen

this Topic has 1 subscriber:

Michael W. (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie