-
Notifications
You must be signed in to change notification settings - Fork 5
/
exec_time.f
50 lines (36 loc) · 1.04 KB
/
exec_time.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module execution_time_m
public :: start_clock , stop_clock
private
! module variables ...
real , save :: start_time
contains
!
!
!=======================
subroutine start_clock
!=======================
implicit none
! local variables ...
integer :: time_array_0(8)
call date_and_time(values=time_array_0)
start_time = time_array_0(5)*3600 + time_array_0(6)*60 + time_array_0(7) + 0.001*time_array_0(8)
end subroutine start_clock
!
!
!==============================
subroutine stop_clock( label )
!==============================
implicit none
character(*) , optional , intent(in) :: label
! local variables ...
integer :: time_array_0(8)
real :: finish_time
call date_and_time(values=time_array_0)
finish_time = time_array_0(5)*3600 + time_array_0(6)*60 + time_array_0(7) + 0.001*time_array_0(8)
if( present(label) ) then
Print*, " >> ",label," << Execution Time :", finish_time - start_time , " seconds"
else
Print*, " >> Execution Time :", finish_time - start_time , " seconds"
end if
end subroutine stop_clock
end module execution_time_m