SUBROUTINE TP_CPUTIM(tim)

Purpose

Returns a processor-dependent time index that can be used to compute the amount of CPU time (s) used between subsequent calls. This routine is a stub for the Fortran 95 intrinsic CPU_TIME routine.

Input

       N/A

Output

          tim: time index (s)                  [R8]

Source Code: Fortran 1995

Example

 USE TIMPAK
 REAL(R8K) T1,T2
 LOGICAL again

  CALL TP_ETIME(t1)
  again=yes
  DO WHILE (again)
    CALL TP_ETIME(t2)
    AGAIN=(T2-T1.LT.ONE)
  ENDDO
  WRITE(*,*) '! ELAPSED TIME (s):',T2-T1

  CALL TP_CPUTIM(t1)
  again=yes
  DO WHILE (again)
    CALL TP_CPUTIM(t2)
    AGAIN=(T2-T1.LT.ONE)
  ENDDO
  WRITE(*,*) '! ELAPSED TIME (s):',T2-T1

STOP
END

Program Output
     ! ELAPSED TIME (s):   1.00000000000728
     ! ELAPSED TIME (s):   1.00000000000000

Comments

In general, the TP_CPUTIM will provide a more accurate method of timing code execution than the TP_ETIME routine, especially in a multi-tasking operating system with several jobs executing *simultaneously* If your compiler does not support the Fortran '95 language standard, replace
     CALL CPU_TIME(tim)
with
     CALL TP_ETIME(tim)
in the TP_CPUTIM source code (click here to view the TP_CPUTIM source code). By default, the Fortran Library is distributed with the Fortran 90 standard version of TP_CPUTIM enabled.


Return to FLIB webpage FLIB Manual Table of Contents FLIB Manual: TimPak

Website maintained by Rob Stewart (trebor@purdue.edu).
Last Updated: 03-Nov-1999
Disclaimer