;----------------------------------------------------------------------------- ; ; Gather run time statistics from TROPoe log files. ; ; 2026-jan-23 Original version. By Dave Allured. ; 2026-jan-24 Fix handling for early log files with no time steps. ; Show only current runs. Insert the cutoff time manually. ; 2026-jan-25 Current conditions. Use only the N most recent samples. ; 2026-jan-27 Support restarted log files with repeated key messages. ; ; Go to the log file directory. Then run this script with no arguments. ; ; Restarted runs with appended log files: ; Timing statistics will not be accurate, until the number of new ; samples reaches the sample size "nsamples". This usually takes ; about 15 minutes, or longer under heavy CPU loading. ; ;----------------------------------------------------------------------------- begin nsamples = 30 cutoff = "2026-1-31\ 8:15" ;; files = systemfunc ("ls -1 mlog_tropoe*") files = systemfunc ("find mlog_tropoe_c1_* -newermt " + cutoff + " | sort") nfiles = dimsizes (files) if (ismissing (files(0))) then print ("*** No input files. Abort.") status_exit (1) end if print ("Time = " + systemfunc ("date")) print ("Cutoff = " + cutoff) print ("Recent averages only. Nsamples <= " + nsamples) print ("Nfiles = " + sprinti ("%3i", nfiles) \ + " Ntimes Min Mean Max Server") do i = 0, nfiles-1 lines := systemfunc ("grep 'compute Jacobian' " + files(i)) server = systemfunc ("grep Server " + files(i) \ + " | tail -1 | cut -f2 -d=") server = where (ismissing (server(:)), "--", server(:)) server = str_strip (str_get_field (server, 1, ".")) ;; print (files(i) + " nlines = " + dimsizes (lines)) ;; print (lines(0:2)) time_str := str_get_field (lines(:), 3, " ") ;; print (time_str(0:2)) if (ismissing (lines(0))) then ntimes = 0 tmin = " --" tavg = " --" tmax = " --" else times := tofloat (time_str(:)) ntimes = dimsizes (times) t1 = max ((/ 0, ntimes - nsamples /)) tmin = sprintf ("%8.1f", min (times(t1:))) tavg = sprintf ("%8.1f", avg (times(t1:))) tmax = sprintf ("%8.1f", max (times(t1:))) end if print (files(i) + sprinti ("%7i", ntimes) + tmin + tavg + tmax \ + " " + server) end do end