load loop (clear start . . Ready; t=24.0/24.15The first number, 24.0, is the processtime for executing the program. The second number, 24.15, is the sum of the processtime plus system overhead time (.15 seconds). Under UNIX, the same information can be obtained from the time command. For example,
time loop.exe . . 24.0u .15s 1:55 77% 0+496k 0+0io 0pf+0wThe "u" denotes user time, which is the processtime for executing the user's program. The "s" denotes the system overhead time. The total processtime is the sum of the user and system times, or 24.15 seconds for this example.
On UDelVM, the elapsed processtime of a section of code is measured by calling "cputime" before and after the code section. For example,
real*8 accum, accum2 . . call cputime(accum,rcode) . (section of code being timed is here) . call cputime(accum2,rcode) print *, 'Processtime = ', (accum2-accum)/1.0d6, ' sec.' . .Under UNIX, the same thing can be accomplished by using either the "etime" or the "dtime" functions. Etime computes the elapsed processtime since the start of execution; dtime computes the processtime since the last call to dtime or from the start of execution if there wasn't a previous call to dtime. Like cputime, computing etime requires subtracting its value before the code section from its value after the code section. Use of dtime does not require this subtraction. In addition, both dtime and etime use an array of length 2 for an argument. This argument contains a breakdown of the processtime into user and system times. For example,
c** Code Using Function etime c dimension xtime(2) . etime0=etime(xtime) utime0=xtime(1) stime0=xtime(2) . (code segment to be timed) . etimef=etime(xtime) utimef=xtime(1) stimef=xtime(2) print *,'Elapsed processtime over code segment = ', 1 etimef-etime0,' seconds' print *,'Elapsed user time over code segment = ', 1 utimef-utime0,' seconds' print *,'Elapsed system time over code segment = ', 1 stimef-stime0,' seconds' . . end c** Code Using Function dtime c dimension xtime(2) . dummy=dtime(xtime) . (code segment to be timed) . print *, 'Elapsed processtime over code segment = ', 1 dtime(xtime),' seconds' print *, 'Elapsed user time over code segment = ', xtime(1),' seconds' print *,'Elapsed system time over code segment = ', 1 xtime(2),' seconds' . . end
****************************************************************** * * * Correspondence to VS FORTRAN * * * ****************************************************************** * * * VS FORTRAN UNIX * * ========== ==== * * * * Total Processtime * * ================= * * * * load main time main.exe * * Ready; t=54.4/55.1 54.4u 1.3s ..... * * * * (processtime = 55.1 sec) (processtime = 55.7 sec) * * * * * * Computing the Processtime of a Section of Code * * ============================================== * * * * real*8 accum, accum2 dimension xtime(2) * * . . * * call cputime(accum,rcode) dummy=dtime(xtime) * * . . * * (code section to be timed) (code segment to be timed) * * . . * * call cputime(accum2,rcode) prtime = dtime(xtime) * * prtime = accum2-accum utime = xtime(1) * * . stime = xtime(2) * * . . * * * ******************************************************************