Is there a way to test the elapsed time in milli seconds?

Is there a way to test the elapsed time in milli seconds?

Postby RAMESHBABU » Fri Mar 17, 2006 12:37 pm

Hi all

Is there any way do it in in FWH ?

Regards,

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Re: Is there a way to test the elapsed time in milli seconds

Postby Enrico Maria Giordano » Fri Mar 17, 2006 1:32 pm

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL i, j, a[ 10 ]

    FOR i = 1 TO 10
        FOR j = 1 TO 10000; j = j; NEXT
        a[ i ] = MILLISECS()
//        a[ i ] = GETTICKCOUNT()
    NEXT

    WQOUT( a )

    RETURN NIL


STATIC FUNCTION MILLISECS()

    LOCAL cPerformanceCount := SPACE( 8 )

    LOCAL nCount

    STATIC nFreq

    QPCOUNTER( cPerformanceCount )

    nCount = BIN2NUM( cPerformanceCount )

    IF nFreq = NIL
        QPFREQUENCY( cPerformanceCount )
        nFreq = BIN2NUM( cPerformanceCount )
    ENDIF

    RETURN ROUND( nCount / nFreq * 1000, 0 )


STATIC FUNCTION BIN2NUM( cBinData )

    LOCAL nLow  := BIN2L( LEFT( cBinData, 4 ) )
    LOCAL nHigh := BIN2L( RIGHT( cBinData, 4 ) )

    IF nLow < 0; nLow += 4294967296; ENDIF

    RETURN nLow + 4294967296 * nHigh


DLL32 STATIC FUNCTION QPCOUNTER( cPerformanceCount AS LPSTR ) AS BOOL;
      PASCAL FROM "QueryPerformanceCounter" LIB "kernel32.dll"

DLL32 STATIC FUNCTION QPFREQUENCY( cPerformanceCount AS LPSTR ) AS BOOL;
      PASCAL FROM "QueryPerformanceFrequency" LIB "kernel32.dll"

DLL32 STATIC FUNCTION GETTICKCOUNT() AS DWORD;
      PASCAL FROM "GetTickCount" LIB "kernel32.dll"


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby RAMESHBABU » Sun Mar 19, 2006 3:24 am

Hi Enrico

Thank you very much for your set of functions to measure the
milli seconds. :D

Regards,

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests