Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
;High-resolution elapsed timer. ; ; To quote from the Win32 Programmer's Reference: ; ; The QueryPerformanceCounter function retrieves the current value ; of the high-resolution performance counter (if one exists on the ; system). By calling this function at the beginning and end of a ; section of code, an application essentially uses the counter as ; a high-resolution timer. For example, suppose that ; QueryPerformanceFrequency indicates that the frequency of the ; high-resolution performance counter is 50,000 counts per second. ; If the application calls QueryPerformanceCounter immediately ; before and immediately after the section of code to be timed, ; the counter values might be 1500 counts and 3500 counts, ; respectively. These values would indicate that .04 seconds ; (2000 counts) elapsed while the code executed. start=BinaryAlloc(8) ended=BinaryAlloc(8) count=BinaryAlloc(8) dlllib=DllLoad(StrCat(DirWindows(1),"kernel32.dll")) x=DllCall(dlllib,long:"QueryPerformanceFrequency",lpbinary:count) If x DllCall(dlllib,long:"QueryPerformanceCounter",lpbinary:start) var=1 DllCall(dlllib,long:"QueryPerformanceCounter",lpbinary:ended) timing=(BinaryPeek4(ended,0)+0.0-BinaryPeek4(start,0))/BinaryPeek4(count,0) Message("var=1",StrCat("Took ",timing," seconds")) Else ; ! x. Message("","High-resolution performance counter not available") EndIf ; X. BinaryFree(start) BinaryFree(ended) BinaryFree(count) DllFree(dlllib)
Article ID: W17224
File Created: 2007:07:03:14:28:54
Last Updated: 2007:07:03:14:28:54