Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate Estimated Time Of Indexing
Message
From
30/06/2005 13:23:08
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01027589
Message ID:
01027766
Views:
10
>If you are trying to see how long your index code is taking to run you could use one of the methods described in my blog post today...
>
>http://www.sweetpotatosoftware.com/SPSBlog/PermaLink.aspx?guid=acb41ee7-bb3d-41a0-8574-044b6527ff4b
>

Hi Craig,
You can also consider the latency of the call and the error of the measure;
with this the precision sensitively reduces him.
CLEAR
FOR i = 1 TO 10000000
*!* Burn in
ENDFOR

SET DECIMALS TO 18 && maximum number of places********* USING SECONDS() **************
LOCAL lcBuffer1, lcBuffer2, lnTicksPerSecond, lnCurrentTickCount
DECLARE INTEGER QueryPerformanceFrequency IN kernel32 STRING @lpFrequency
DECLARE INTEGER QueryPerformanceCounter IN kernel32 STRING @lpPerformanceCount
lcBuffer1 = SPACE(8)
lcBuffer2 = SPACE(8)
=QueryPerformanceFrequency(@lcBuffer1)
lnTicksPerSecond = buf2num(SUBSTR(lcBuffer1, 1,4)) + buf2num(SUBSTR(lcBuffer1, 5,4)) * 2^32
DIMENSION testN(10000,2)
FOR I=1 TO ALEN(testN,1)
	=QueryPerformanceCounter(@m.lcBuffer1 )
	=QueryPerformanceCounter(@m.lcBuffer2 )

	testN(m.i,1) = m.lcBuffer1
	testN(m.i,2) = m.lcBuffer2
NEXT
CREATE CURSOR latency (start Q(8),stop Q(8))
APPEND FROM ARRAY testN
SELECT ((buf2num(SUBSTR(stop, 1,4)) - buf2num(SUBSTR(start , 1,4)));
					+ (buf2num(SUBSTR(stop, 5,4)) - buf2num(SUBSTR(start, 5,4))) * 2^32) callTime;
	FROM latency INTO CURSOR latency ORDER BY 1
BROWSE NOWAIT

CALCULATE AVG(callTime),STD(callTime),MAX(callTime),MIN(callTime) TO average,SDev,MaxDev,MinDev

? "HR Performance counter accurate to 1/" + TRANSFORM(lnTicksPerSecond) + " of a second"
? "Latency Accurate: "	,round(average,0)
? "  St. Deviation "	,round(SDev,0)
? " Max deviation"		,round(MAX(MaxDev-average,average-MinDev),0)

? "Then the precision is 1/" + TRANSFORM( ROUND(lnTicksPerSecond/SDev,0))
************************
FUNCTION buf2num(tcBuffer)
************************
    RETURN ASC(SUBSTR(tcBuffer, 1,1)) + ;
        ASC(SUBSTR(tcBuffer, 2,1)) * 2^8 + ;
        ASC(SUBSTR(tcBuffer, 3,1)) * 2^16 + ;
        ASC(SUBSTR(tcBuffer, 4,1)) * 2^24
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform