RosettaCodeData/Task/Time-a-function/Fortran/time-a-function.f

19 lines
491 B
FortranFixed
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
c The subroutine to analyze
subroutine do_something()
c For testing we just do nothing for 3 seconds
call sleep(3)
return
end
c Main Program
program timing
2015-02-20 00:35:01 -05:00
integer(kind=8) start,finish,rate
call system_clock(count_rate=rate)
call system_clock(start)
2013-04-11 01:07:29 -07:00
c Here comes the function we want to time
call do_something()
2015-02-20 00:35:01 -05:00
call system_clock(finish)
write(6,*) 'Elapsed Time in seconds:',float(finish-start)/rate
2013-04-11 01:07:29 -07:00
return
end