Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Milliseconds
Message
From
01/01/2018 13:52:42
 
 
To
01/01/2018 12:50:55
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Miscellaneous
Thread ID:
01656863
Message ID:
01656871
Views:
64
>I am sure this has been addressed before. But I would appreciate some quick help.
>
>I am performing some performance testing and have discovered that the Seconds() function may not be actuate. I discovered a UDF based on the SYS(2015), but I question its return. I would like to use the WinAPI GetTickCount(), but it only returns True, no tick count.
>
>Any other suggestions?

Based on code Mike Yearwood once wrote, while we were discussing performance issues:
#DEFINE LOOP_LENGTH 100000000

LOCAL Start AS Datetime
LOCAL Stop AS Datetime
LOCAL LoopIndex AS Number

LOCAL Buffer1 AS String
LOCAL Buffer2 AS String
LOCAL CurrentTickCount AS Number
LOCAL ElapsedSeconds AS Number

DECLARE INTEGER QueryPerformanceFrequency IN kernel32 STRING @Frequency
DECLARE INTEGER QueryPerformanceCounter IN kernel32 STRING @PerformanceCount

m.Buffer1 = SPACE(8)
m.Buffer2 = SPACE(8)

QueryPerformanceFrequency(@m.Buffer1)

m.TicksPerSecond = CTOBIN(m.Buffer1, "8")

m.Start = DATETIME()
QueryPerformanceCounter(@m.Buffer1)

FOR m.LoopIndex = 1 TO LOOP_LENGTH
	* dummy
ENDFOR

m.Stop = DATETIME() - m.Start
QueryPerformanceCounter(@m.Buffer2)

m.ElapsedSeconds = (CTOBIN(m.Buffer2, "8") - CTOBIN(m.Buffer1, "8")) / m.TicksPerSecond

? TEXTMERGE("<<m.Stop>> (based on DateTime) versus <<m.ElapsedSeconds>> (based on Win32)")
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform