1 |
cnh |
1.10 |
C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/timers.F,v 1.9 2001/02/04 14:38:44 cnh Exp $ |
2 |
|
|
C $Name: $ |
3 |
adcroft |
1.1 |
|
4 |
|
|
#include "CPP_EEOPTIONS.h" |
5 |
|
|
|
6 |
|
|
C-- File utils.F: General purpose support routines |
7 |
|
|
C-- Contents |
8 |
|
|
C-- TIMER_INDEX - Returns index associated with timer name. |
9 |
|
|
C-- M TIMER_CONTROL - Implements timer functions for given machine. |
10 |
|
|
C-- TIMER_PRINT - Print CPU timer statitics. |
11 |
|
|
C-- TIMER_PRINTALL - Prints all CPU timers statistics. |
12 |
|
|
C-- TIMER_START - Starts CPU timer for code section. |
13 |
|
|
C-- TIMER_STOP - Stop CPU tier for code section. |
14 |
|
|
C-- Routines marked "M" contain specific machine dependent code. |
15 |
|
|
C-- Routines marked "U" contain UNIX OS calls. |
16 |
|
|
|
17 |
cnh |
1.10 |
CBOP |
18 |
|
|
C !ROUTINE: TIMER_INDEX |
19 |
|
|
|
20 |
|
|
C !INTERFACE: |
21 |
adcroft |
1.1 |
INTEGER FUNCTION TIMER_INDEX ( |
22 |
|
|
I name,timerNames,maxTimers,nTimers ) |
23 |
adcroft |
1.5 |
IMPLICIT NONE |
24 |
cnh |
1.10 |
|
25 |
|
|
C !DESCRIPTION: |
26 |
|
|
C *==========================================================* |
27 |
|
|
C | FUNCTION TIMER_INDEX |
28 |
|
|
C | o Timing support routine. |
29 |
|
|
C *==========================================================* |
30 |
|
|
C | Return index in timer data structure of timer named |
31 |
|
|
C | by the function argument "name". |
32 |
|
|
C *==========================================================* |
33 |
|
|
IMPLICIT NONE |
34 |
|
|
|
35 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
36 |
|
|
C == Routine arguements == |
37 |
|
|
C maxTimers :: Total number of timers allowed |
38 |
|
|
C nTimers :: Current number of timers |
39 |
|
|
C name :: Name of timer to find |
40 |
|
|
C timerNames :: List of valid timer names |
41 |
adcroft |
1.1 |
INTEGER maxTimers |
42 |
|
|
INTEGER nTimers |
43 |
|
|
CHARACTER*(*) name |
44 |
|
|
CHARACTER*(*) timerNames(maxTimers) |
45 |
cnh |
1.10 |
|
46 |
|
|
C !LOCAL VARIABLES: |
47 |
|
|
C == Local variables == |
48 |
|
|
C I :: Index variable |
49 |
adcroft |
1.1 |
INTEGER I |
50 |
cnh |
1.10 |
CEOP |
51 |
adcroft |
1.1 |
C |
52 |
|
|
TIMER_INDEX = 0 |
53 |
|
|
IF ( name .EQ. ' ' ) THEN |
54 |
|
|
TIMER_INDEX = -1 |
55 |
|
|
ELSE |
56 |
|
|
DO 10 I = 1, nTimers |
57 |
|
|
IF ( name .NE. timerNames(I) ) GOTO 10 |
58 |
|
|
TIMER_INDEX = I |
59 |
|
|
GOTO 11 |
60 |
|
|
10 CONTINUE |
61 |
|
|
11 CONTINUE |
62 |
|
|
ENDIF |
63 |
|
|
RETURN |
64 |
|
|
END |
65 |
|
|
|
66 |
cnh |
1.10 |
CBOP |
67 |
|
|
C !ROUTINE: TIMER_CONTROL |
68 |
|
|
|
69 |
|
|
C !INTERFACE: |
70 |
adcroft |
1.1 |
SUBROUTINE TIMER_CONTROL ( name , action , callProc , myThreadId ) |
71 |
cnh |
1.10 |
IMPLICIT NONE |
72 |
|
|
|
73 |
|
|
C !DESCRIPTION: |
74 |
|
|
C *==========================================================* |
75 |
adcroft |
1.1 |
C | SUBROUTINE TIMER_CONTROL | |
76 |
|
|
C | o Timing routine. | |
77 |
cnh |
1.10 |
C *==========================================================* |
78 |
adcroft |
1.1 |
C | User callable interface to timing routines. Timers are | |
79 |
|
|
C | created, stopped, started and queried only through this | |
80 |
|
|
C | rtouine. | |
81 |
cnh |
1.10 |
C *==========================================================* |
82 |
|
|
|
83 |
|
|
C !USES: |
84 |
adcroft |
1.1 |
#include "SIZE.h" |
85 |
|
|
#include "EEPARAMS.h" |
86 |
|
|
#include "EESUPPORT.h" |
87 |
|
|
INTEGER TIMER_INDEX |
88 |
|
|
INTEGER IFNBLNK |
89 |
|
|
INTEGER ILNBLNK |
90 |
|
|
EXTERNAL TIMER_INDEX |
91 |
|
|
EXTERNAL IFNBLNK |
92 |
|
|
EXTERNAL ILNBLNK |
93 |
cnh |
1.10 |
|
94 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
95 |
|
|
C name :: name of the timer |
96 |
|
|
C action :: operation to perform with this timer |
97 |
|
|
C callProc :: procedure calling this routine |
98 |
|
|
C myThreadId :: instance number of this thread |
99 |
|
|
CHARACTER*(*) name |
100 |
|
|
CHARACTER*(*) action |
101 |
|
|
CHARACTER*(*) callProc |
102 |
|
|
INTEGER myThreadId |
103 |
adcroft |
1.1 |
C |
104 |
cnh |
1.10 |
C !LOCAL VARIABLES: |
105 |
|
|
C maxTimers :: Total numer of timer allowed |
106 |
|
|
C maxString :: Max length of a timer name |
107 |
adcroft |
1.1 |
INTEGER maxTimers |
108 |
|
|
INTEGER maxString |
109 |
|
|
PARAMETER ( maxTimers = 40 ) |
110 |
|
|
PARAMETER ( maxString = 80 ) |
111 |
cnh |
1.10 |
C timerStarts :: Timer counters for each timer and each thread |
112 |
|
|
C timerStops |
113 |
|
|
C timerUser |
114 |
|
|
C timerWall |
115 |
|
|
C timerSys |
116 |
|
|
C timerT0User |
117 |
|
|
C timerT0Wall |
118 |
|
|
C timerT0Sys |
119 |
|
|
C timerStatus :: START/STOP/RUNNING Status of the timer |
120 |
|
|
C timerNameLen :: Length of timer name |
121 |
|
|
C timerNames :: Table of timer names |
122 |
|
|
C nTimers :: Number of active timers |
123 |
adcroft |
1.1 |
INTEGER timerStarts( maxTimers , MAX_NO_THREADS) |
124 |
|
|
SAVE timerStarts |
125 |
|
|
INTEGER timerStops ( maxTimers , MAX_NO_THREADS) |
126 |
|
|
SAVE timerStops |
127 |
|
|
Real*8 timerUser ( maxTimers , MAX_NO_THREADS) |
128 |
|
|
SAVE timerUser |
129 |
|
|
Real*8 timerWall ( maxTimers , MAX_NO_THREADS) |
130 |
|
|
SAVE timerWall |
131 |
|
|
Real*8 timerSys ( maxTimers , MAX_NO_THREADS) |
132 |
|
|
SAVE timerSys |
133 |
|
|
Real*8 timerT0User( maxTimers , MAX_NO_THREADS) |
134 |
|
|
SAVE timerT0User |
135 |
|
|
Real*8 timerT0Wall( maxTimers , MAX_NO_THREADS) |
136 |
|
|
SAVE timerT0Wall |
137 |
|
|
Real*8 timerT0Sys ( maxTimers , MAX_NO_THREADS) |
138 |
|
|
SAVE timerT0Sys |
139 |
|
|
INTEGER timerStatus( maxTimers , MAX_NO_THREADS) |
140 |
|
|
SAVE timerStatus |
141 |
|
|
INTEGER timerNameLen( maxTimers , MAX_NO_THREADS) |
142 |
|
|
SAVE timerNameLen |
143 |
|
|
CHARACTER*(maxString) timerNames( maxTimers , MAX_NO_THREADS) |
144 |
|
|
SAVE timerNames |
145 |
|
|
INTEGER nTimers(MAX_NO_THREADS) |
146 |
|
|
CHARACTER*(maxString) tmpName |
147 |
|
|
CHARACTER*(maxString) tmpAction |
148 |
|
|
INTEGER iTimer |
149 |
|
|
INTEGER ISTART |
150 |
|
|
INTEGER IEND |
151 |
|
|
INTEGER STOPPED |
152 |
|
|
PARAMETER ( STOPPED = 0 ) |
153 |
|
|
INTEGER RUNNING |
154 |
|
|
PARAMETER ( RUNNING = 1 ) |
155 |
|
|
CHARACTER*(*) STOP |
156 |
|
|
PARAMETER ( STOP = 'STOP' ) |
157 |
|
|
CHARACTER*(*) START |
158 |
|
|
PARAMETER ( START = 'START' ) |
159 |
|
|
CHARACTER*(*) PRINT |
160 |
|
|
PARAMETER ( PRINT = 'PRINT' ) |
161 |
|
|
CHARACTER*(*) PRINTALL |
162 |
|
|
PARAMETER ( PRINTALL = 'PRINTALL' ) |
163 |
|
|
INTEGER I |
164 |
|
|
Real*8 userTime |
165 |
|
|
Real*8 systemTime |
166 |
|
|
Real*8 wallClockTime |
167 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuffer |
168 |
|
|
DATA nTimers /MAX_NO_THREADS*0/ |
169 |
|
|
SAVE nTimers |
170 |
cnh |
1.10 |
CEOP |
171 |
adcroft |
1.1 |
C |
172 |
|
|
ISTART = IFNBLNK(name) |
173 |
|
|
IEND = ILNBLNK(name) |
174 |
|
|
IF ( IEND - ISTART + 1 .GT. maxString ) GOTO 901 |
175 |
|
|
IF ( ISTART .NE. 0 ) THEN |
176 |
|
|
tmpName = name(ISTART:IEND) |
177 |
|
|
CALL UCASE( tmpName ) |
178 |
|
|
ELSE |
179 |
|
|
tmpName = ' ' |
180 |
|
|
ENDIF |
181 |
|
|
ISTART = IFNBLNK(action) |
182 |
|
|
IEND = ILNBLNK(action) |
183 |
|
|
IF ( ISTART .EQ. 0 ) GOTO 902 |
184 |
|
|
IF ( IEND - ISTART + 1 .GT. maxString ) GOTO 903 |
185 |
|
|
tmpAction = action(ISTART:IEND) |
186 |
|
|
CALL UCASE( tmpAction ) |
187 |
|
|
C |
188 |
cnh |
1.4 |
iTimer=TIMER_INDEX(tmpName,timerNames(1,myThreadId), |
189 |
|
|
& maxTimers,nTimers(myThreadId)) |
190 |
adcroft |
1.1 |
C |
191 |
|
|
IF ( tmpAction .EQ. START ) THEN |
192 |
|
|
IF ( iTimer .EQ. 0 ) THEN |
193 |
|
|
IF ( nTimers(myThreadId) .EQ. maxTimers ) GOTO 904 |
194 |
|
|
nTimers(myThreadId) = nTimers(myThreadId) + 1 |
195 |
|
|
iTimer = nTimers(myThreadId) |
196 |
|
|
timerNames(iTimer,myThreadId) = tmpName |
197 |
cnh |
1.4 |
timerNameLen(iTimer,myThreadId) = |
198 |
|
|
& ILNBLNK(tmpName)-IFNBLNK(tmpName)+1 |
199 |
adcroft |
1.1 |
timerUser(iTimer,myThreadId) = 0. |
200 |
|
|
timerSys (iTimer,myThreadId) = 0. |
201 |
|
|
timerWall(iTimer,myThreadId) = 0. |
202 |
|
|
timerStarts(iTimer,myThreadId) = 0 |
203 |
|
|
timerStops (iTimer,myThreadId) = 0 |
204 |
|
|
timerStatus(iTimer,myThreadId) = STOPPED |
205 |
|
|
ENDIF |
206 |
|
|
IF ( timerStatus(iTimer,myThreadId) .NE. RUNNING ) THEN |
207 |
|
|
CALL TIMER_GET_TIME( userTime, systemTime, wallClockTime ) |
208 |
|
|
timerT0User(iTimer,myThreadId) = userTime |
209 |
|
|
timerT0Sys(iTimer,myThreadId) = systemTime |
210 |
|
|
timerT0Wall(iTimer,myThreadId) = wallClockTime |
211 |
|
|
timerStatus(iTimer,myThreadId) = RUNNING |
212 |
cnh |
1.4 |
timerStarts(iTimer,myThreadId) = |
213 |
|
|
& timerStarts(iTimer,myThreadId)+1 |
214 |
adcroft |
1.1 |
ENDIF |
215 |
|
|
ELSEIF ( tmpAction .EQ. STOP ) THEN |
216 |
|
|
IF ( iTimer .EQ. 0 ) GOTO 905 |
217 |
|
|
IF ( timerStatus(iTimer,myThreadId) .EQ. RUNNING ) THEN |
218 |
|
|
CALL TIMER_GET_TIME( userTime, systemTime, wallClockTime ) |
219 |
cnh |
1.4 |
timerUser(iTimer,myThreadId) = |
220 |
|
|
& timerUser(iTimer,myThreadId) + |
221 |
adcroft |
1.1 |
& userTime - |
222 |
|
|
& timerT0User(iTimer,myThreadId) |
223 |
cnh |
1.4 |
timerSys (iTimer,myThreadId) = |
224 |
|
|
& timerSys(iTimer,myThreadId) + |
225 |
adcroft |
1.1 |
& systemTime - |
226 |
|
|
& timerT0Sys(iTimer,myThreadId) |
227 |
cnh |
1.4 |
timerWall(iTimer,myThreadId) = |
228 |
|
|
& timerWall(iTimer,myThreadId) + |
229 |
adcroft |
1.1 |
& wallClockTime - |
230 |
|
|
& timerT0Wall(iTimer,myThreadId) |
231 |
|
|
timerStatus(iTimer,myThreadId) = STOPPED |
232 |
cnh |
1.4 |
timerStops (iTimer,myThreadId) = |
233 |
|
|
& timerStops (iTimer,myThreadId)+1 |
234 |
adcroft |
1.1 |
ENDIF |
235 |
|
|
ELSEIF ( tmpAction .EQ. PRINT ) THEN |
236 |
|
|
IF ( iTimer .EQ. 0 ) GOTO 905 |
237 |
|
|
WRITE(msgBuffer,*) |
238 |
|
|
& ' Seconds in section "', |
239 |
cnh |
1.4 |
& timerNames(iTimer,myThreadId)(1:timerNameLen(iTimer,myThreadId)) |
240 |
|
|
& ,'":' |
241 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
242 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
243 |
|
|
WRITE(msgBuffer,*) ' User time:', |
244 |
|
|
& timerUser(iTimer,myThreadId) |
245 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
246 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
247 |
|
|
WRITE(msgBuffer,*) ' System time:', |
248 |
|
|
& timerSys(iTimer,myThreadId) |
249 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
250 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
251 |
|
|
WRITE(msgBuffer,*) ' Wall clock time:', |
252 |
|
|
& timerWall(iTimer,myThreadId) |
253 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
254 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
255 |
|
|
WRITE(msgBuffer,*) ' No. starts:', |
256 |
|
|
& timerStarts(iTimer,myThreadId) |
257 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
258 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
259 |
|
|
WRITE(msgBuffer,*) ' No. stops:', |
260 |
|
|
& timerStops(iTimer,myThreadId) |
261 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
262 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
263 |
adcroft |
1.1 |
ELSEIF ( tmpAction .EQ. PRINTALL ) THEN |
264 |
|
|
DO 10 I = 1, nTimers(myThreadId) |
265 |
|
|
WRITE(msgBuffer,*) ' Seconds in section "', |
266 |
cnh |
1.4 |
& timerNames(I,myThreadId)(1:timerNameLen(I,myThreadId)) |
267 |
|
|
& ,'":' |
268 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
269 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
270 |
|
|
WRITE(msgBuffer,*) ' User time:', |
271 |
|
|
& timerUser(I,myThreadId) |
272 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
273 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
274 |
|
|
WRITE(msgBuffer,*) ' System time:', |
275 |
|
|
& timerSys(I,myThreadId) |
276 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
277 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
278 |
|
|
WRITE(msgBuffer,*) ' Wall clock time:', |
279 |
|
|
& timerWall(I,myThreadId) |
280 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
281 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
282 |
|
|
WRITE(msgBuffer,*) ' No. starts:', |
283 |
|
|
& timerStarts(I,myThreadId) |
284 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
285 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
286 |
|
|
WRITE(msgBuffer,*) ' No. stops:', |
287 |
|
|
& timerStops(I,myThreadId) |
288 |
|
|
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
289 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
290 |
adcroft |
1.1 |
10 CONTINUE |
291 |
|
|
ELSE |
292 |
|
|
GOTO 903 |
293 |
|
|
ENDIF |
294 |
|
|
C |
295 |
|
|
1000 CONTINUE |
296 |
|
|
C |
297 |
|
|
RETURN |
298 |
|
|
901 CONTINUE |
299 |
|
|
WRITE(msgBuffer,'(A)') |
300 |
|
|
&' ' |
301 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
302 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
303 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
304 |
|
|
&'*** WARNING WARNING WARNING WARNING WARNING WARNING ***' |
305 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
306 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
307 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
308 |
|
|
&'procedure: "',callProc,'".' |
309 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
310 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
311 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
312 |
|
|
&'Timer name "',name(ISTART:IEND),'" is invalid.' |
313 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
314 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
315 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
316 |
|
|
&' Names must have fewer than',maxString+1,' characters.' |
317 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
318 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
319 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
320 |
|
|
&'*******************************************************' |
321 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
322 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
323 |
adcroft |
1.1 |
GOTO 1000 |
324 |
|
|
902 CONTINUE |
325 |
|
|
WRITE(msgBuffer,*) |
326 |
|
|
&' ' |
327 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
328 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
329 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
330 |
|
|
&'*** WARNING WARNING WARNING WARNING WARNING WARNING ***' |
331 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
332 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
333 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
334 |
|
|
&'procedure: "',callProc,'".' |
335 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
336 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
337 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
338 |
|
|
&' No timer action specified.' |
339 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
340 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
341 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
342 |
|
|
&' Valid actions are:' |
343 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
344 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
345 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
346 |
|
|
&' "START", "STOP", "PRINT" and "PRINTALL".' |
347 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
348 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
349 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
350 |
|
|
&'*******************************************************' |
351 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
352 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
353 |
adcroft |
1.1 |
GOTO 1000 |
354 |
|
|
903 CONTINUE |
355 |
|
|
WRITE(msgBuffer,*) |
356 |
|
|
&' ' |
357 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
358 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
359 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
360 |
|
|
&'*** WARNING WARNING WARNING WARNING WARNING WARNING ***' |
361 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
362 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
363 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
364 |
|
|
&'procedure: "',callProc,'".' |
365 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
366 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
367 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
368 |
|
|
&'Timer action"',name(ISTART:IEND),'" is invalid.' |
369 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
370 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
371 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
372 |
|
|
&' Valid actions are:' |
373 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
374 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
375 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
376 |
|
|
&' "START", "STOP", "PRINT" and "PRINTALL".' |
377 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
378 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
379 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
380 |
|
|
&'*******************************************************' |
381 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
382 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
383 |
adcroft |
1.1 |
GOTO 1000 |
384 |
|
|
904 CONTINUE |
385 |
|
|
WRITE(msgBuffer,*) |
386 |
|
|
&' ' |
387 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
388 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
389 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
390 |
|
|
&'*** WARNING WARNING WARNING WARNING WARNING WARNING ***' |
391 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
392 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
393 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
394 |
|
|
&'procedure: "',callProc,'".' |
395 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
396 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
397 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
398 |
|
|
&'Timer "',name(ISTART:IEND),'" cannot be created.' |
399 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
400 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
401 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
402 |
|
|
&' Only ',maxTimers,' timers are allowed.' |
403 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
404 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
405 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
406 |
|
|
&'*******************************************************' |
407 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
408 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
409 |
adcroft |
1.1 |
GOTO 1000 |
410 |
|
|
905 CONTINUE |
411 |
|
|
WRITE(msgBuffer,*) |
412 |
|
|
&' ' |
413 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
414 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
415 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
416 |
|
|
&'*** WARNING WARNING WARNING WARNING WARNING WARNING ***' |
417 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
418 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
419 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
420 |
|
|
&'procedure: "',callProc,'".' |
421 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
422 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
423 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
424 |
|
|
&'Timer name is blank.' |
425 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
426 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
427 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
428 |
|
|
&' A name must be used with "START", "STOP" or "PRINT".' |
429 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
430 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
431 |
adcroft |
1.1 |
WRITE(msgBuffer,*) |
432 |
|
|
&'*******************************************************' |
433 |
cnh |
1.4 |
CALL PRINT_MESSAGE(msgBuffer,standardMessageUnit, |
434 |
|
|
& SQUEEZE_RIGHT,myThreadId) |
435 |
adcroft |
1.1 |
GOTO 1000 |
436 |
|
|
END |
437 |
|
|
|
438 |
cnh |
1.10 |
CBOP |
439 |
|
|
C !ROUTINE: TIMER_GET_TIME |
440 |
|
|
|
441 |
|
|
C !INTERFACE: |
442 |
adcroft |
1.1 |
SUBROUTINE TIMER_GET_TIME( |
443 |
|
|
O userTime, |
444 |
|
|
O systemTime, |
445 |
|
|
O wallClockTime ) |
446 |
adcroft |
1.5 |
IMPLICIT NONE |
447 |
cnh |
1.10 |
|
448 |
|
|
C !DESCRIPTION: |
449 |
|
|
C *==========================================================* |
450 |
|
|
C | SUBROUTINE TIMER_GET_TIME |
451 |
|
|
C | o Query system timer routines. |
452 |
|
|
C *==========================================================* |
453 |
|
|
C | Routine returns total elapsed time for program so far. |
454 |
|
|
C | Three times are returned that conventionally are used as |
455 |
|
|
C | user time, system time and wall-clock time. Not all these |
456 |
|
|
C | numbers are available on all machines. |
457 |
|
|
C *==========================================================* |
458 |
|
|
|
459 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
460 |
|
|
C userTime :: User time returned |
461 |
|
|
C systemTime :: System time returned |
462 |
|
|
C wallClockTime :: Wall clock time returned |
463 |
adcroft |
1.1 |
Real*8 userTime |
464 |
|
|
Real*8 systemTime |
465 |
|
|
Real*8 wallClockTime |
466 |
cnh |
1.10 |
|
467 |
|
|
C !USES: |
468 |
adcroft |
1.6 |
#ifndef TARGET_T3E |
469 |
heimbach |
1.8 |
#ifndef TARGET_CRAY_VECTOR |
470 |
cnh |
1.10 |
Real*4 ETIME |
471 |
adcroft |
1.1 |
EXTERNAL ETIME |
472 |
adcroft |
1.6 |
#endif |
473 |
heimbach |
1.8 |
#endif |
474 |
cnh |
1.10 |
|
475 |
|
|
C !LOCAL VARIABLES: |
476 |
|
|
C ACTUAL, TARRAY, :: Temps. to hold times |
477 |
|
|
C wTime |
478 |
|
|
Real*4 ACTUAL, TARRAY(2) |
479 |
adcroft |
1.1 |
Real*8 wtime |
480 |
cnh |
1.10 |
CEOP |
481 |
|
|
|
482 |
cnh |
1.4 |
C Real*8 MPI_Wtime |
483 |
|
|
C EXTERNAL MPI_Wtime |
484 |
adcroft |
1.1 |
|
485 |
heimbach |
1.8 |
#if (defined (TARGET_T3E) || defined (TARGET_CRAY_VECTOR)) |
486 |
adcroft |
1.6 |
userTime = 0. |
487 |
|
|
systemTime = 0. |
488 |
|
|
#else |
489 |
adcroft |
1.1 |
ACTUAL = ETIME(TARRAY) |
490 |
|
|
userTime = TARRAY(1) |
491 |
|
|
systemTime = TARRAY(2) |
492 |
adcroft |
1.6 |
#endif |
493 |
|
|
|
494 |
heimbach |
1.8 |
#if (defined (TARGET_T3E) || defined (TARGET_CRAY_VECTOR)) |
495 |
adcroft |
1.6 |
wallClockTime = 0. |
496 |
|
|
#else |
497 |
cnh |
1.3 |
CALL CLOC(wTime) |
498 |
|
|
wallClockTime = wtime |
499 |
adcroft |
1.6 |
#endif |
500 |
cnh |
1.3 |
|
501 |
adcroft |
1.1 |
#ifdef ALLOW_USE_MPI |
502 |
cnh |
1.3 |
C wtime = MPI_Wtime() |
503 |
|
|
C wallClockTime = wtime |
504 |
adcroft |
1.1 |
#endif /* ALLOW_USE_MPI */ |
505 |
|
|
#ifndef ALLOW_USE_MPI |
506 |
cnh |
1.3 |
C wallClockTime = 0. |
507 |
adcroft |
1.1 |
#endif |
508 |
|
|
|
509 |
|
|
RETURN |
510 |
|
|
END |
511 |
|
|
|
512 |
cnh |
1.10 |
CBOP |
513 |
|
|
|
514 |
|
|
C !ROUTINE: TIMER_PRINTALL |
515 |
|
|
|
516 |
|
|
C !INTERFACE: |
517 |
adcroft |
1.1 |
SUBROUTINE TIMER_PRINTALL( myThreadId ) |
518 |
adcroft |
1.5 |
IMPLICIT NONE |
519 |
cnh |
1.10 |
|
520 |
|
|
C !DESCRIPTION: |
521 |
|
|
C *==========================================================* |
522 |
|
|
C | SUBROUTINE TIMER_PRINTALL |
523 |
|
|
C | o Print timer information |
524 |
|
|
C *==========================================================* |
525 |
|
|
C | Request print out of table of timing from all timers. |
526 |
|
|
C *==========================================================* |
527 |
|
|
|
528 |
|
|
C !INPUT PARAMETERS: |
529 |
|
|
C myThreadId :: This threads number |
530 |
adcroft |
1.1 |
INTEGER myThreadId |
531 |
cnh |
1.10 |
CEOP |
532 |
|
|
|
533 |
cnh |
1.4 |
CALL TIMER_CONTROL( ' ', 'PRINTALL', 'TIMER_PRINTALL' , |
534 |
|
|
& myThreadId ) |
535 |
adcroft |
1.1 |
C |
536 |
|
|
RETURN |
537 |
|
|
END |
538 |
cnh |
1.10 |
|
539 |
|
|
CBOP |
540 |
|
|
C !ROUTINE: TIMER_START |
541 |
|
|
|
542 |
|
|
C !INTERFACE: |
543 |
adcroft |
1.1 |
SUBROUTINE TIMER_START ( string , myThreadId ) |
544 |
adcroft |
1.5 |
IMPLICIT NONE |
545 |
cnh |
1.10 |
|
546 |
|
|
C !DESCRIPTION: |
547 |
|
|
C Start timer named "string". |
548 |
|
|
|
549 |
|
|
C !INPUT PARAMETERS: |
550 |
|
|
C string :: Name of timer |
551 |
|
|
C myThreadId :: My thread number |
552 |
adcroft |
1.1 |
CHARACTER*(*) string |
553 |
|
|
INTEGER myThreadId |
554 |
cnh |
1.10 |
CEOP |
555 |
adcroft |
1.1 |
C |
556 |
|
|
CALL TIMER_CONTROL( string, 'START', 'TIMER_START' , myThreadId) |
557 |
|
|
C |
558 |
|
|
RETURN |
559 |
|
|
END |
560 |
cnh |
1.10 |
CBOP |
561 |
|
|
C !ROUTINE: TIMER_STOP |
562 |
|
|
|
563 |
|
|
C !INTERFACE: |
564 |
adcroft |
1.1 |
SUBROUTINE TIMER_STOP ( string , myThreadId) |
565 |
adcroft |
1.5 |
IMPLICIT NONE |
566 |
cnh |
1.10 |
|
567 |
|
|
C !DESCRIPTION: |
568 |
|
|
C Stop timer named "string". |
569 |
|
|
|
570 |
|
|
C !INPUT PARAMETERS: |
571 |
|
|
C string :: Name of timer |
572 |
|
|
C myThreadId :: My thread number |
573 |
adcroft |
1.1 |
CHARACTER*(*) string |
574 |
|
|
INTEGER myThreadId |
575 |
cnh |
1.10 |
CEOP |
576 |
adcroft |
1.1 |
C |
577 |
|
|
CALL TIMER_CONTROL( string, 'STOP', 'TIMER_STOP' , myThreadId ) |
578 |
|
|
C |
579 |
|
|
RETURN |
580 |
|
|
END |
581 |
|
|
C*********************************************************************** |