C$Procedure GETCPU C REAL FUNCTION GETCPU C C C******************************************************************************* C C Copyright (C) 1993, California Institute of Technology. U.S. C Government Sponsorhip under NASA Contract NAS7-918 is C acknowledged. C C******************************************************************************* C C$ Purpose C C ** MACHINE DEPENDENT ** C C GETCPU returns the elapsed CPU time in seconds. C C$ Output_Arguments C C GETCPU - seconds of elapsed CPU time since last SETCPU call C C$ Log C C 01-Aug-1988 C Eric Cannell - creation C C$ References C C 1- VAX/VMS System Routines - Run-time Library Routines, Volume 5B. C C$ Restrictions C C 1- SETCPU must be called prior to using GETCPU. C C For example: C C REAL GETCPU C EXTERNAL GETCPU C C REAL SETCPU C EXTERNAL SETCPU C C CPU0 = SETCPU() ! time since initialization C . C C . C CPU1 = GETCPU() C SINC01 = CPU1 - CPU0 ! time since CPU0 C . C C . C CPU2 = GETCPU() C SINC12 = CPU2 - CPU1 ! time since CPU1 C . C C . C CPU3 = GETCPU() C SINC03 = CPU3 - CPU0 ! time since CPU0 C C 2- Of course, GETCPU itself takes a minor amount of CPU time after C the system calls... C C$ Declarations_of_Local_Variables C INTEGER CPU10M C C$ Method C-& C1 Use system run-time routine LIB$STAT_TIMER to get elapsed CPU C1 time. CALL LIB$STAT_TIMER( 2 , CPU10M , ) C1 Convert ten's of milliseconds of system time to seconds. GETCPU = FLOAT( CPU10M ) / 100.0 RETURN END