LMDZ
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 ! ----------------------------------------------------------
35 
36 
37 USE parkind1 ,ONLY : jpim ,jprb
38 
39 IMPLICIT NONE
40 
41 REAL(KIND=JPRB),INTENT(OUT) :: PELAPSED_TIME,PVECTOR_CP,PTOTAL_CP
42 REAL(KIND=JPRB),INTENT(INOUT) :: PELAPSED_TIME_SINCE
43 OPTIONAL pelapsed_time,pelapsed_time_since
44 OPTIONAL pvector_cp,ptotal_cp
45 REAL(KIND=JPRB) :: ZVECTOR_CP,ZTOTAL_CP,ZWALL
46 REAL(KIND=JPRB),EXTERNAL :: TIMEF
47 
48 
49 ! === END OF INTERFACE BLOCK ===
50 IF(PRESENT(pelapsed_time).OR. PRESENT(pelapsed_time_since)) THEN
51 
52  zwall=timef()
53 ! TIMEF returns milliseconds since first call to TIMEF
54  IF(PRESENT(pelapsed_time)) THEN
55  pelapsed_time=zwall*1.0e-3_jprb
56  ENDIF
57  IF(PRESENT(pelapsed_time_since)) THEN
58  pelapsed_time_since=zwall*1.0e-3_jprb - pelapsed_time_since
59  ENDIF
60 ENDIF
61 
62 IF( PRESENT(pvector_cp) .OR. PRESENT(ptotal_cp) ) THEN
63  CALL cptime(zvector_cp,ztotal_cp)
64 ENDIF
65 IF( PRESENT(pvector_cp) ) THEN
66  pvector_cp=zvector_cp
67 ENDIF
68 IF( PRESENT(ptotal_cp) ) THEN
69  ptotal_cp=ztotal_cp
70 ENDIF
71 
72 RETURN
73 END SUBROUTINE user_clock
74 
75 
76 
subroutine user_clock(PELAPSED_TIME, PELAPSED_TIME_SINCE, PVECTOR_CP, PTOTAL_CP)
Definition: user_clock.F90:2
integer, parameter jprb
Definition: parkind1.F90:31
integer, parameter jpim
Definition: parkind1.F90:13