1 | # IGCM_add_out - filter of output of the job : |
---|
2 | # command : |
---|
3 | # IGCM_add_out.awk job_output.out REALTIME USERTIME SYSTIME |
---|
4 | |
---|
5 | #************************************************************** |
---|
6 | # Author: Martial.Mancip |
---|
7 | # Contact: Martial.Mancip__at__ipsl.jussieu.fr |
---|
8 | # $Revision:: $ Revision of last commit |
---|
9 | # $Author:: $ Author of last commit |
---|
10 | # $Date:: $ Date of last commit |
---|
11 | # IPSL (2006) |
---|
12 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
13 | # Modification: Patrick.Brockmann@cea.fr |
---|
14 | # |
---|
15 | #************************************************************** |
---|
16 | |
---|
17 | #========================== |
---|
18 | function myprint(str) { |
---|
19 | if (debug) { |
---|
20 | print str |
---|
21 | } |
---|
22 | } |
---|
23 | |
---|
24 | |
---|
25 | #========================== |
---|
26 | BEGIN { |
---|
27 | # print "traitement de " ARGV[1] |
---|
28 | |
---|
29 | nbarg=ARGC |
---|
30 | if (ARGV[1] == "-d") { |
---|
31 | debug=1 |
---|
32 | file=ARGV[2] |
---|
33 | delete ARGV[1] |
---|
34 | nbarg-- |
---|
35 | } else { |
---|
36 | debug=0 |
---|
37 | file=ARGV[1] |
---|
38 | } |
---|
39 | |
---|
40 | # When exit statement, 'END' rule is always executed, so defined a exit_value to manage this |
---|
41 | exit_value=0 |
---|
42 | if (nbarg != 2) { |
---|
43 | print "Usage: IGCM_add_out.awk [-d] file.output" |
---|
44 | print |
---|
45 | print "Args:" |
---|
46 | print " file.output = output file of at Job to be parsed" |
---|
47 | print |
---|
48 | print "Options:" |
---|
49 | print " -d = debug mode" |
---|
50 | print |
---|
51 | exit_value=1 |
---|
52 | exit |
---|
53 | } |
---|
54 | |
---|
55 | Information_found=0 |
---|
56 | Information_ksh_SX_found=0 |
---|
57 | vargas_found=0 |
---|
58 | |
---|
59 | RealTime=0. |
---|
60 | UserTime=-1. |
---|
61 | SysTime=0. |
---|
62 | VectorTime=0. |
---|
63 | InstCount=0. |
---|
64 | VInstCount=0. |
---|
65 | VElementCount=0. |
---|
66 | FLOPCount=0. |
---|
67 | MOPS=0. |
---|
68 | MFLOPS=0. |
---|
69 | AVLength=0. |
---|
70 | VOpRatio=0. |
---|
71 | MemorySize=0. |
---|
72 | MIPS=0. |
---|
73 | ICache=0. |
---|
74 | OCache=0. |
---|
75 | Bank=0. |
---|
76 | |
---|
77 | counter=0 |
---|
78 | |
---|
79 | RunDateBegin="2000-01-01T00:00:00" |
---|
80 | RunDateEnd="2000-01-01T00:00:00" |
---|
81 | |
---|
82 | } |
---|
83 | |
---|
84 | #========================== |
---|
85 | { |
---|
86 | myprint($0) |
---|
87 | |
---|
88 | # Get information with MPI Program Information output on NEC |
---|
89 | if (match($0, " \\*\\*\\*\\*\\*\\* Program Information \\*\\*\\*\\*\\*\\*")) |
---|
90 | { |
---|
91 | Information_found=1 |
---|
92 | counter=counter+1 |
---|
93 | # print $0 |
---|
94 | # print counter |
---|
95 | next |
---|
96 | } |
---|
97 | else if (Information_found == 1 && (match($0, ".*:.*"))) |
---|
98 | { |
---|
99 | where=(match($0,"[a-zA-Z]")) |
---|
100 | Length=(match($0, " *:"))-where |
---|
101 | whereDot=(match($0, ":")) |
---|
102 | info=substr($0,where,Length) |
---|
103 | whereNum=(match($0, "[0-9]")) |
---|
104 | Res=substr($0,whereNum) |
---|
105 | # print where "," Length "," whereDot "," whereNum " '" info "' :" Res |
---|
106 | |
---|
107 | if( info=="Real Time (sec)" ) { |
---|
108 | # print "|" Res "|" |
---|
109 | # printf("RealTime = %10.5f\n",0.037600) |
---|
110 | # printf("RealTime = %10.5f\n",Res) |
---|
111 | if ( Res > RealTime ) { |
---|
112 | RealTime=Res |
---|
113 | } |
---|
114 | next |
---|
115 | } |
---|
116 | |
---|
117 | if( info=="User Time (sec)" ) { |
---|
118 | UserTime=UserTime+Res |
---|
119 | next |
---|
120 | } |
---|
121 | |
---|
122 | if( info=="Sys Time (sec)" ) { |
---|
123 | SysTime=SysTime+Res |
---|
124 | next |
---|
125 | } |
---|
126 | |
---|
127 | if( info=="Vector Time (sec)" ) { |
---|
128 | VectorTime=VectorTime+Res |
---|
129 | next |
---|
130 | } |
---|
131 | |
---|
132 | if( info=="Inst. Count" ) { |
---|
133 | InstCount=InstCount+Res |
---|
134 | next |
---|
135 | } |
---|
136 | |
---|
137 | if( info=="V. Element Count" ) { |
---|
138 | VInstCount=VInstCount+Res |
---|
139 | next |
---|
140 | } |
---|
141 | |
---|
142 | if( info=="V. Element Count" ) { |
---|
143 | VElementCount=VElementCount+Res |
---|
144 | next |
---|
145 | } |
---|
146 | |
---|
147 | if( info=="FLOP Count" ) { |
---|
148 | FLOPCount=FLOPCount+Res |
---|
149 | next |
---|
150 | } |
---|
151 | |
---|
152 | if( info=="MOPS" ) { |
---|
153 | MOPS=MOPS+Res |
---|
154 | next |
---|
155 | } |
---|
156 | |
---|
157 | if( info=="MFLOPS" ) { |
---|
158 | MFLOPS=MFLOPS+Res |
---|
159 | next |
---|
160 | } |
---|
161 | |
---|
162 | if( info=="A.V. Length" ) { |
---|
163 | AVLength=AVLength+Res |
---|
164 | next |
---|
165 | } |
---|
166 | |
---|
167 | if( info=="V. Op. Ratio (%)" ) { |
---|
168 | VOpRatio=VOpRatio+Res |
---|
169 | next |
---|
170 | } |
---|
171 | |
---|
172 | if( info=="Memory Size (MB)" ) { |
---|
173 | MemorySize=MemorySize+Res |
---|
174 | next |
---|
175 | } |
---|
176 | |
---|
177 | if( info=="MIPS" ) { |
---|
178 | MIPS=MIPS+Res |
---|
179 | next |
---|
180 | } |
---|
181 | |
---|
182 | if( info=="I-Cache (sec)" ) { |
---|
183 | ICache=ICache+Res |
---|
184 | next |
---|
185 | } |
---|
186 | |
---|
187 | if( info=="O-Cache (sec)" ) { |
---|
188 | OCache=OCache+Res |
---|
189 | next |
---|
190 | } |
---|
191 | |
---|
192 | if( info=="Bank (sec)" ) { |
---|
193 | Bank=Bank+Res |
---|
194 | next |
---|
195 | } |
---|
196 | |
---|
197 | } |
---|
198 | # Get information with time output on other hosts |
---|
199 | # ksh time |
---|
200 | else if (match($0, ".*s real .*s user .*s system")) |
---|
201 | { |
---|
202 | myprint( "ksh" ) |
---|
203 | counter=counter+1 |
---|
204 | |
---|
205 | RealTime=(substr($1,1,match($1, "s")-1)) |
---|
206 | UserTime=(substr($3,1,match($3, "s")-1)) |
---|
207 | SysTime=(substr($5,1,match($5, "s")-1)) |
---|
208 | |
---|
209 | } |
---|
210 | |
---|
211 | # csh time |
---|
212 | else if (match($0, "[0-9.]+u [0-9.]+s .+")) |
---|
213 | { |
---|
214 | myprint( "csh" ) |
---|
215 | counter=counter+1 |
---|
216 | |
---|
217 | UserTime=(substr($1,1,match($1, "u")-1)) |
---|
218 | SysTime=(substr($2,1,match($2, "s")-1)) |
---|
219 | RealTime=(substr($3,1,match($3, ":")-1)*60. + substr($3,match($3, ":")+1)) |
---|
220 | |
---|
221 | } |
---|
222 | # linux system time |
---|
223 | else if (match($0, ".*user .*system .*elapsed .*CPU .*")) |
---|
224 | { |
---|
225 | myprint( "linux" ) |
---|
226 | counter=counter+1 |
---|
227 | |
---|
228 | UserTime=(substr($1,1,match($1, "user")-1)) |
---|
229 | SysTime=(substr($2,1,match($2, "system")-1)) |
---|
230 | RealTime=(substr($3,1,match($3, ":")-1)*60.+substr($3, match($3, ":")+1, match($3, "elapsed"))) |
---|
231 | |
---|
232 | } |
---|
233 | # AIX vargas system time |
---|
234 | else if (match($0, "real [0-9]*")) |
---|
235 | { |
---|
236 | myprint( "vargas" ) |
---|
237 | vargas_found=1 |
---|
238 | counter=counter+1 |
---|
239 | |
---|
240 | RealTime=substr($0,8) |
---|
241 | next |
---|
242 | } |
---|
243 | else if (vargas_found=1 ) |
---|
244 | { |
---|
245 | if (match($0, "user [0-9]*")) |
---|
246 | { |
---|
247 | UserTime=substr($0,8) |
---|
248 | next |
---|
249 | } |
---|
250 | if (match($0, "sys [0-9]*")) |
---|
251 | { |
---|
252 | SysTime=substr($0,7) |
---|
253 | next |
---|
254 | } |
---|
255 | } |
---|
256 | # Get information with time output on SX hosts |
---|
257 | # ksh time |
---|
258 | else if (match($0, "real *[0-9:.]*")) |
---|
259 | { |
---|
260 | myprint("ksh SX") |
---|
261 | Information_ksh_SX_found=1 |
---|
262 | counter=counter+1 |
---|
263 | |
---|
264 | RealTime=0 |
---|
265 | if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*")) |
---|
266 | { |
---|
267 | sub1=(match($2, ":")-1) |
---|
268 | sub2=sub1+2 |
---|
269 | fin=(substr($2,sub2)) |
---|
270 | sub3=(match(fin, ":")-1)+sub2 |
---|
271 | RealTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3)) |
---|
272 | } |
---|
273 | else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*")) |
---|
274 | { |
---|
275 | RealTime=(substr($2,1,match($2, ":")-1)) |
---|
276 | } |
---|
277 | } |
---|
278 | else if (Information_ksh_SX_found == 1 && match($0, "user *[0-9:.]*")) |
---|
279 | { |
---|
280 | myprint("ksh SX ") |
---|
281 | |
---|
282 | UserTime=0 |
---|
283 | if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*")) |
---|
284 | { |
---|
285 | sub1=(match($2, ":")-1) |
---|
286 | sub2=sub1+2 |
---|
287 | fin=(substr($2,sub2)) |
---|
288 | sub3=(match(fin, ":")-1)+sub2 |
---|
289 | UserTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3)) |
---|
290 | } |
---|
291 | else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*")) |
---|
292 | { |
---|
293 | UserTime=(substr($2,1,match($2, ":")-1)) |
---|
294 | } |
---|
295 | } |
---|
296 | else if (Information_ksh_SX_found == 1 && match($0, "sys *[0-9:.]*")) |
---|
297 | { |
---|
298 | myprint("ksh SX ") |
---|
299 | |
---|
300 | SysTime=0 |
---|
301 | if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*")) |
---|
302 | { |
---|
303 | sub1=(match($2, ":")-1) |
---|
304 | sub2=sub1+2 |
---|
305 | fin=(substr($2,sub2)) |
---|
306 | sub3=(match(fin, ":")-1)+sub2 |
---|
307 | SysTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3)) |
---|
308 | } |
---|
309 | else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*")) |
---|
310 | { |
---|
311 | SysTime=(substr($2,1,match($2, ":")-1)) |
---|
312 | } |
---|
313 | } |
---|
314 | |
---|
315 | # RUN_DATE_BEGIN |
---|
316 | if ($0 ~ /RunDateBegin.*=/) { |
---|
317 | myprint( "start date" ) |
---|
318 | split($0,a,"=") |
---|
319 | RunDateBegin=a[2] |
---|
320 | } |
---|
321 | |
---|
322 | # RUN_DATE_END |
---|
323 | if ($0 ~ /RunDateEnd.*=/) { |
---|
324 | myprint( "end date" ) |
---|
325 | split($0,a,"=") |
---|
326 | RunDateEnd=a[2] |
---|
327 | } |
---|
328 | |
---|
329 | } |
---|
330 | |
---|
331 | #========================== |
---|
332 | END { |
---|
333 | |
---|
334 | myprint("exit_value : " exit_value) |
---|
335 | myprint("counter : " counter) |
---|
336 | |
---|
337 | if (! exit_value ) { |
---|
338 | if (counter > 0) { |
---|
339 | myprint("=============================================") |
---|
340 | myprint("Additionnal results on Program Informations for " ARGV[1]) |
---|
341 | myprint("Real Time (sec) :" RealTime) |
---|
342 | myprint("User Time (sec) :" UserTime) |
---|
343 | myprint("Sys Time (sec) :" SysTime) |
---|
344 | myprint("Vector Time (sec) :" VectorTime) |
---|
345 | myprint("Inst. Count :" InstCount) |
---|
346 | myprint("V. Inst. Count :" VInstCount) |
---|
347 | myprint("V. Element Count :" VElementCount) |
---|
348 | myprint("FLOP Count :" FLOPCount) |
---|
349 | myprint("MOPS :" MOPS) |
---|
350 | myprint("MFLOPS :" MFLOPS) |
---|
351 | myprint("A.V. Length :" AVLength) |
---|
352 | myprint("V. Op. Ratio (%) :" VOpRatio) |
---|
353 | myprint("Memory Size (MB) :" MemorySize) |
---|
354 | myprint("MIPS :" MIPS) |
---|
355 | myprint("I-Cache (sec) :" ICache) |
---|
356 | myprint("O-Cache (sec) :" OCache) |
---|
357 | myprint("Bank (sec) :" Bank) |
---|
358 | |
---|
359 | myprint("Date of executables :") |
---|
360 | myprint("Start Time :" RunDateBegin) |
---|
361 | myprint("End Time :" RunDateEnd) |
---|
362 | |
---|
363 | printf("%s %s %.5f %.5f %.5f", RunDateBegin, RunDateEnd, RealTime, UserTime, SysTime) |
---|
364 | exit(0) |
---|
365 | } |
---|
366 | else |
---|
367 | { |
---|
368 | exit(1) |
---|
369 | } |
---|
370 | } |
---|
371 | else |
---|
372 | { |
---|
373 | exit(2) |
---|
374 | } |
---|
375 | |
---|
376 | } |
---|