Clock.F
#ifdef aix
#define ETIME ETIME_
#endif
c****************************************************************
#include "author.inc"
c* $Id: Clock.F,v 1.11 1995/09/08 17:48:37 turner Exp $
c*
c* Subroutine to return elapsed or CPU times in seconds.
c*
#ifdef cray
c* This version can be used on Cray machines under UNICOS.
#else
c* This version works with many UNIX machines.
#endif
c*
c* <PARAMETER LIST>
c*
c* Input:
#ifdef cray
c* mode - ignored
#else
c* mode - control integer:
c* 0 ==> ETIME is called 80 times to "warm it up"
c* (supposedly a good idea on some machines)
c* non-zero ==> returns user + system time used since
c* program start
#endif
c*
c* Output:
c* time - time in seconds
c* status - return status
c*
#include "copyright.inc"
c****************************************************************
#ifdef hpux
c
c ... Have to manually override autodbl on HP, or it promotes
c the real*4 variables and ETIME returns garbage.
$AUTODBL OFF
#endif
subroutine JT_Clock (mode, time, status)
implicit none
c
c ... Input:
integer mode
c
c ... Output:
integer status
real*bytes_per_real time
c
c ... Local:
real*bytes_per_real user, syst
#ifndef cray
integer i
real*4 cputot, cpu(2)
real*4 ETIME
#endif
c
#ifdef cray
call SECOND(time)
#else
if (mode .eq. 0) then
do i=1,80
cputot = ETIME(cpu)
enddo
else
cputot = ETIME(cpu)
user = REAL(cpu(1))
syst = REAL(cpu(2))
time = user + syst
endif
#endif
c
status = 0
return
end