Next / Previous / Index / TCC Help System / Publications / Site map / NM Tech homepage

Example Fortran program to measure elapsed time

Tech Computer Center logo
c etime.f: Demonstrate measurement of elapsed time
      program etimetest
      real etime          ! Declare the type of etime()
      real elapsed(2)     ! For receiving user and system time
      real total          ! For receiving total time
      integer i, j

      print *, 'Start'

      do i = 1, 5000000   ! That's five million
         j = j + 1
      end do

      total = etime(elapsed)
      print *, 'End: total=', total, ' user=', elapsed(1),
     &         ' system=', elapsed(2)
Here is some sample output, run on a Sun SLC:
 End: total=    3.75000 user=    3.61667 system=   0.133333

See also: Hints for Fortran programmers
Previous: Measuring elapsed time in a Fortran program
Site map
Index: Keyword index to help pages
Help: New Mexico Tech Computer Center: Help System
TCC Publications
Home: About New Mexico Tech

John Shipman,

Last updated: 2001/02/01 00:15:32 UT