Saturday 29 October 2011

Its all in the timing!


Trying to get my head round how the code deals with real time aspects of the simulation and have come across yet another new function for me! The code uses the ETIME function to monitor the actual run time - still tying to figure out how this is used within the code thought!


Anyway in my search for what this function does I came across the following definition - which I believe is courtesy of my old boss at the University of Florida (thanks Bob!).


Though Bambofy - again - told me what this function did before I checked - apparently its used frequently in gaming programmes!

FORTRAN Timing

Two functions ETIME and DTIME. let FORTRAN programs measure time. This is useful for perfomance tuning. They are used as follows:
REAL TIMEARRAY (2)
REAL  ELAPSE
REAL DEI.APSE
ELAPSE = ETIME(TIMEARRAY)
DELAPSE=DTIME (TIMEARRAY)
ETIME returns a real number which is the total CPU time used for this process it began executing. DTIME returns a real number which is the running time for this process since the last call to DTIME. Both procedures use TIMEARRAY to return the user time and system time separately; TIMEARRAY(1) reports the user time, and TIMEARRAY(2) supports the system time. For example, the statements
REAL DELAPSE TIMEARRAY(2), X
INTEGER I
X=1
DELAPSE =DTIME(TIMEARRAY)
DO 10 I=1, 100000
X=X+1/X
10        CONTINUE
DELAPSE=DTIME (TIMEARRAY)
set DELAPSE to the time required to compute the loop DO 10 1=1,100000.

2 comments:

  1. DTIME and ETIME are Unix system API procedures. They are **NOT** Fortran standard intrinsic procedures. Thus, it is highly likely that they will not be available on any non-Unix OS or with any non-Unix development environment.

    ReplyDelete
  2. Craig

    Thanks for the comment - the code I am looking at has been developed in 'Compaq Fortran'. There are calls to ETIME but so far I have not found where it uses the time info. Could quite easily be a spurious call - the code has a few of these! Though I think the info could be used to measure the simulator performance in some way and not as part of the main code calculations.

    Cheers.....Gary

    ReplyDelete