Windows API Functions
Posted: Sat Sep 06, 2003 3:52 am
I was recently converting a little loop speed test program from IBasic and looked for a way to get ticks. After a fair amount of searching I came accross the GetTickCount_() function. What I find troubling is that I cannot find anything in the documentation about this shortcut. Is there something that I missed? I downloaded ApiViewer 2003 which had a PureBasic syntax plugin and it shows:
which was what I was going to use but GetTickCount_() is cleaner. Can anyone point to where it talks about this type of shortcut?
Code: Select all
OpenLibrary(0,"kernel32.dll")
CallFunction(0,"GetTickCount",)
Code: Select all
x.f = 1
y.f = 1.000001
; change to desired amount of loops
howManyLoops = 100000000
OpenConsole()
PrintN("")
PrintN("Running Benchmark of "+Str(howManyLoops)+" loops.")
starttime = GetTickCount_()
For i = 1 To howManyLoops
x = x * y
Next i
stoptime = GetTickCount_()
totalSeconds.f = stoptime - starttime
totalSeconds = totalSeconds / 1000
PrintN("")
PrintN("Computer ran through "+Str(howManyLoops)+" loops in "+StrF(totalSeconds,2)+" seconds.")
PrintN(""):PrintN(""):PrintN(""):PrintN(""):PrintN(""):PrintN("Press almost any key to continue.")
Repeat:Until Inkey()<>""
CloseConsole()
End