- question UtilTime

From: Frans-PieterVonck <"Frans-PieterVonck">
Date: Thu, 21 Apr 2005 23:18:44 +0200

nu.&I8y
z{mʗ{V
z{S}ĝxjǺThere is something I don't understand in the program UtilTime
What is the function of these lines?
 
dt := MAX(REAL);
dt := MIN(t1 - t0, dt);

If a discard the statement I get the following output
 
dt = 1.117463398259133E-6
 
instead of the previous 0,83 s
 
-----Oorspronkelijk bericht-----
Van: blackbox{([at]})nowhere.xyonck
Verzonden: do 21-4-2005 22:47
Aan: BlackBox Mailing List
CC:
Onderwerp: [BlackBox] - System time in BB - Athlon 1200



        I Get a 0,83 s on my Athlon 1200 Mhz Win2k, using the program UtilTime.
        
        
        
        
        
                -----Oorspronkelijk bericht-----
                Van: blackbox{([at]})nowhere.xych namens Grard Meunier
                Verzonden: do 21-4-2005 21:52
                Aan: BlackBox Mailing List
                CC:
                Onderwerp: [BlackBox] - System time in BB
               
               
        
                Doug,
               
                With this test program, I get a resolution of 3.4 s on WIN98 600 MHz, and
                0.83 s on XP 1700 MHz:
               
                MODULE UtilTime;
               
                 IMPORT
               
                  StdLog, WinApi;
               
                 VAR
               
                  freq: LONGINT;
               
                 PROCEDURE GetTime* (): REAL;
               
                  VAR
               
                   count: LONGINT;
                   ok: INTEGER;
               
                  BEGIN (*GetTime*)
                   ok := WinApi.QueryPerformanceCounter(count); ASSERT(ok # 0, 100);
                   RETURN count / freq;
                  END GetTime;
               
                 PROCEDURE TestTime*;
               
                  CONST
               
                   loops = 10000;
               
                  VAR
               
                   dt, t0, t1: REAL;
                   i: INTEGER;
               
                  BEGIN (*TestTime*)
                   dt := MAX(REAL);
                   t0 := GetTime();
                   FOR i := 1 TO loops DO
                    t1 := GetTime();
                    IF t1 > t0 THEN
                     dt := MIN(t1 - t0, dt);
                    END;
                    t0 := t1;
                   END;
                   StdLog.String("dt = ");
                   StdLog.Real(dt);
                   StdLog.Ln;
                  END TestTime;
               
                 PROCEDURE Init;
               
                  VAR
               
                   ok: INTEGER;
               
                  BEGIN (*Init*)
                   ok := WinApi.QueryPerformanceFrequency(freq); ASSERT(ok # 0, 100);
                  END Init;
               
                 BEGIN (*UtilTime*)
                  Init;
                 END UtilTime.
               
                <Ctrl-Q> UtilTime.TestTime;
               
                --- BlackBox
                --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})oberon.ch
               
               
        
        


nu.&I8y
z{mʗbqb
z{m}ޝxjǺ
z{Ch+bv!~)^{\rtf1\ansi\ansicpg1252\fromtext \deff0{\fonttbl
{\f0\fswiss\fcharset0 Arial;}
{\f1\fmodern Courier New;}
{\f2\fnil\fcharset2 Symbol;}
{\f3\fmodern\fcharset0 Courier New;}}
{\colortbl\red0\green0\blue0;\red0\green0\blue255;}
\uc1\pard\plain\deftab360 \f0\fs20 There is something I don't understand in the program UtilTime\par
What is the function of these lines?\par
 \par
dt := MAX(REAL);\par
dt := MIN(t1 - t0, dt);\par
\par
If a discard the statement I get the following output\par
 \par
dt = 1.117463398259133E-6\par
 \par
instead of the previous 0,83 \'b5s \par
 \par
-----Oorspronkelijk bericht----- \par
Van: blackbox{([at]})nowhere.xyr
Verzonden: do 21-4-2005 22:47 \par
Aan: BlackBox Mailing List \par
CC: \par
Onderwerp: [BlackBox] - System time in BB - Athlon 1200\par
\par
\par
\par
\tab I Get a 0,83 \'b5s on my Athlon 1200 Mhz Win2k, using the program UtilTime.\par
\tab \par
\tab \par
\tab \par
\tab \par
\tab \par
\tab -----Oorspronkelijk bericht-----\par
\tab Van: blackbox{([at]})nowhere.xy'e9rard Meunier\par
\tab Verzonden: do 21-4-2005 21:52\par
\tab Aan: BlackBox Mailing List\par
\tab CC:\par
\tab Onderwerp: [BlackBox] - System time in BB\par
\tab \par
\tab \par
\tab \par
\tab Doug,\par
\tab \par
\tab With this test program, I get a resolution of 3.4 \'b5s on WIN98 600 MHz, and\par
\tab 0.83 \'b5s on XP 1700 MHz:\par
\tab \par
\tab MODULE UtilTime;\par
\tab \par
\tab IMPORT\par
\tab \par
\tab StdLog, WinApi;\par
\tab \par
\tab VAR\par
\tab \par
\tab freq: LONGINT;\par
\tab \par
\tab PROCEDURE GetTime* (): REAL;\par
\tab \par
\tab VAR\par
\tab \par
\tab count: LONGINT;\par
\tab ok: INTEGER;\par
\tab \par
\tab BEGIN (*GetTime*)\par
\tab ok := WinApi.QueryPerformanceCounter(count); ASSERT(ok # 0, 100);\par
\tab RETURN count / freq;\par
\tab END GetTime;\par
\tab \par
\tab PROCEDURE TestTime*;\par
\tab \par
\tab CONST\par
\tab \par
\tab loops = 10000;\par
\tab \par
\tab VAR\par
\tab \par
\tab dt, t0, t1: REAL;\par
\tab i: INTEGER;\par
\tab \par
\tab BEGIN (*TestTime*)\par
\tab dt := MAX(REAL);\par
\tab t0 := GetTime();\par
\tab FOR i := 1 TO loops DO\par
\tab t1 := GetTime();\par
\tab IF t1 > t0 THEN\par
\tab dt := MIN(t1 - t0, dt);\par
\tab END;\par
\tab t0 := t1;\par
\tab END;\par
\tab StdLog.String("dt = ");\par
\tab StdLog.Real(dt);\par
\tab StdLog.Ln;\par
\tab END TestTime;\par
\tab \par
\tab PROCEDURE Init;\par
\tab \par
\tab VAR\par
\tab \par
\tab ok: INTEGER;\par
\tab \par
\tab BEGIN (*Init*)\par
\tab ok := WinApi.QueryPerformanceFrequency(freq); ASSERT(ok # 0, 100);\par
\tab END Init;\par
\tab \par
\tab BEGIN (*UtilTime*)\par
\tab Init;\par
\tab END UtilTime.\par
\tab \par
\tab <Ctrl-Q> UtilTime.TestTime;\par
\tab \par
\tab --- BlackBox\par
\tab --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})oberon.ch\par
\tab \par
\tab \par
\tab \par
\tab \par
\}}nu.&I8y
Received on Thu Apr 21 2005 - 23:18:44 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:28:17 UTC