Tech and Academic things for Chianshin

Wednesday, April 26, 2006

Example Fortran program to measure elapsed time

Example Fortran program to measure elapsed time: "Example Fortran program to measure elapsed time
Tech Computer Center logo

c--
c etime.f: Demonstrate measurement of elapsed time
c--
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)
stop
end

Here is some sample output, run on a Sun SLC:

Start
End: total= 3.75000 user= 3.61667 system= 0.133333"

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home