next up previous contents
Next: Acknowledgments Up: StopWatch User's Guide Previous: Trouble Shooting

Subroutine cpu_second

 

Although Fortran 90 standardized an intrinsic function for wall clock time, it does not include a function for CPU time. At the time of this writing, it is anticipated that a CPU time intrinsic function will be added to the language in Fortran 95. If this happens, then StopWatch can become fully system independent once Fortran 95 compilers are widespread. Meanwhile, StopWatch requires that a system dependent CPU time subroutine be provided by the user. Several versions of this subroutine are included with the StopWatch package. One of these may work on your system. The current versions, systems they have been tested on, and clock precisions are shown in Table 7.1. The computers and version numbers of the operating systems and compilers can be found in Table 3.1. Those based on the Cray routine second and the Fortran 95 routine cpu_second do not provide the user and sys clocks. The version cpusec.nil.f contains no CPU clock information, and can be used on systems where there is no routine to measure CPU time. If this routine is used, only the wall clock will be available.

  
Table: Available versions of cpu_second with clock precisions.

If none of the cpu_second versions work on your system, you will have to write your own. The interface is

subroutine cpu_second(cpu,user,sys)
real, intent(OUT) :: cpu, user, sys

The first argument is for CPU time in seconds. Where available, the second and third arguments should break down the CPU time into ``user'' and ``system'' CPU time. If the underlying system does not provide for a way of accessing the breakdown (i.e., has only CPU time), then return a negative constant in user and sys (for example, user=-1.; sys=-1.). The value returned in cpu (and user and sys where available) should be a nonnegative real number such that the difference between two successive calls is the amount of elapsed CPU time in seconds.

If you write a new version of cpu_second because none of the supplied versions worked on your system, please send this information to the author so that it can be included in the next release.



next up previous contents
Next: Acknowledgments Up: StopWatch User's Guide Previous: Trouble Shooting



william.mitchell@nist.gov