SURFEX v8.1
General documentation of Surfex
user_clock.F90
Go to the documentation of this file.
1 SUBROUTINE user_clock(PELAPSED_TIME,PELAPSED_TIME_SINCE,PVECTOR_CP,PTOTAL_CP)
2 
3 !**** *USER_CLOCK* - interface to system dependent timer routines
4 
5 ! Purpose.
6 ! --------
7 ! Returns elapsed and CP from the start of execution.
8 ! Elapsed time is made relative to the first call to USER_CLOCK.
9 
10 !** Interface.
11 ! ----------
12 ! ZTIME=USER_CLOCK(PELAPSED_TIME,PELAPSED_TIME_SINCE,
13 ! PVECTOR_CP,PTOTAL_CP)
14 
15 ! Explicit arguments: (All are optional arguments)
16 ! PELAPSED_TIME=wall clock time (seconds)
17 ! PELAPSED_TIME_SINCE=wall clock time (seconds)
18 ! change from input value of this parameter
19 ! PVECTOR_CP=CP vector time (seconds)
20 ! PTOTAL_CP=total CP time (seconds)
21 
22 ! Author.
23 ! -------
24 ! D.Dent *ECMWF*
25 
26 ! External References:
27 ! -------------------
28 
29 ! TIMEF,CPTIME
30 
31 ! Modifications.
32 ! --------------
33 ! Original : 97-09-25
34 ! F. Vana 05-Mar-2015 Support for single precision
35 ! ----------------------------------------------------------
36 
37 
38 USE parkind1 ,ONLY : jprd, jpim
39 
40 IMPLICIT NONE
41 
42 REAL(KIND=JPRD),INTENT(OUT) :: pelapsed_time,pvector_cp,ptotal_cp
43 REAL(KIND=JPRD),INTENT(INOUT) :: PELAPSED_TIME_SINCE
44 OPTIONAL pelapsed_time,pelapsed_time_since
45 OPTIONAL pvector_cp,ptotal_cp
46 REAL(KIND=JPRD) :: ZVECTOR_CP,ZTOTAL_CP,ZWALL
47 REAL(KIND=JPRD),EXTERNAL :: TIMEF
48 
49 
50 ! === END OF INTERFACE BLOCK ===
51 IF(PRESENT(pelapsed_time).OR. PRESENT(pelapsed_time_since)) THEN
52 
53  zwall=timef()
54 ! TIMEF returns milliseconds since first call to TIMEF
55  IF(PRESENT(pelapsed_time)) THEN
56  pelapsed_time=zwall*1.0e-3_jprd
57  ENDIF
58  IF(PRESENT(pelapsed_time_since)) THEN
59  pelapsed_time_since=zwall*1.0e-3_jprd - pelapsed_time_since
60  ENDIF
61 ENDIF
62 
63 IF( PRESENT(pvector_cp) .OR. PRESENT(ptotal_cp) ) THEN
64  CALL cptime(zvector_cp,ztotal_cp)
65 ENDIF
66 IF( PRESENT(pvector_cp) ) THEN
67  pvector_cp=zvector_cp
68 ENDIF
69 IF( PRESENT(ptotal_cp) ) THEN
70  ptotal_cp=ztotal_cp
71 ENDIF
72 
73 RETURN
74 END SUBROUTINE user_clock
75 
76 
77 
integer, parameter jpim
Definition: parkind1.F90:13
integer, parameter jprd
Definition: parkind1.F90:39
subroutine cptime(PVCP, PTCP)
Definition: cptime.F90:3
subroutine user_clock(PELAPSED_TIME, PELAPSED_TIME_SINCE, PVECTOR_CP, PTOTAL_CP)
Definition: user_clock.F90:2