25 integer mid, pmid, modid
26 character*(*) mname, mdscr
37 slena = len_trim(adjustl(mname))
39 slen = len_trim(mname) - slena + 1
40 if (slena.gt.mntr_lstl_mnm)
then
42 $
'too long timer name; shortenning')
43 slena = min(slena,mntr_lstl_mnm)
45 call blank(lname,mntr_lstl_mnm)
46 lname= mname(slen:slen+slena- 1)
47 call capit(lname,slena)
50 slena = len_trim(adjustl(mdscr))
52 slen = len_trim(mdscr) - slena + 1
53 if (slena.ge.mntr_lstl_mds)
then
55 $
'too long timer description; shortenning')
56 slena = min(slena,mntr_lstl_mnm)
58 call blank(ldscr,mntr_lstl_mds)
59 ldscr= mdscr(slen:slen + slena - 1)
65 if (nid.eq.mntr_pid0)
then
69 if (mntr_tmr_id(mntr_tmr_mark,il).ge.0.and.
70 $ mntr_tmr_name(il).eq.lname)
then
78 do il=1,mntr_tmr_id_max
79 if (mntr_tmr_id(mntr_tmr_mark,il).eq.-1)
then
88 call bcast(ipos,isize)
94 $
'timer ['//trim(lname)//
'] cannot be registered')
96 elseif (ipos.lt.0)
then
99 $
'timer ['//trim(lname)//
'] is already registered')
105 if (mntr_tmr_id(mntr_tmr_mark,pmid).ge.0)
then
106 mntr_tmr_id(mntr_tmr_mark,ipos) = pmid
108 mntr_tmr_id(mntr_tmr_mark,ipos) = 0
110 $
"timer's ["//trim(lname)//
"] parent not registered.")
113 mntr_tmr_id(mntr_tmr_mark,ipos) = 0
118 if (mntr_mod_id(modid).ge.0)
then
119 mntr_tmr_id(mntr_tmr_mod,ipos) = modid
121 mntr_tmr_id(mntr_tmr_mod,ipos) = 0
123 $
"timer's ["//trim(lname)//
"] module not registered.")
126 mntr_tmr_id(mntr_tmr_mod,ipos) = 0
129 mntr_tmr_name(ipos)=lname
130 mntr_tmr_dscr(ipos)=ldscr
131 mntr_tmr_sum(ipos)=ifsum
132 mntr_tmr_num = mntr_tmr_num + 1
133 if (mntr_tmr_mpos.lt.ipos) mntr_tmr_mpos = ipos
135 $
'Registered timer ['//trim(lname)//
']: '//trim(ldscr))
166 slena = len_trim(adjustl(mname))
168 slen = len_trim(mname) - slena + 1
169 if (slena.gt.mntr_lstl_mnm)
then
171 $
'too long timer name; shortenning')
172 slena = min(slena,mntr_lstl_mnm)
174 call blank(lname,mntr_lstl_mnm)
175 lname= mname(slen:slen+slena- 1)
176 call capit(lname,slena)
182 if (nid.eq.mntr_pid0)
then
184 do il=1,mntr_tmr_mpos
185 if (mntr_tmr_id(mntr_tmr_mark,il).ge.0.and.
186 $ mntr_tmr_name(il).eq.lname)
then
194 call bcast(ipos,isize)
199 $
'timer ['//trim(lname)//
'] not registered')
202 write(str,
'(I3)') ipos
204 $
'timer ['//trim(lname)//
'] registered with id='//str)
251 if (mntr_tmr_id(mntr_tmr_mark,mid).ge.0)
then
252 mntr_tmrv_timer(mntr_tmr_count,mid) =
253 $ mntr_tmrv_timer(mntr_tmr_count,mid) + icount
255 mntr_tmrv_timer(mntr_tmr_time,mid) =
256 $ mntr_tmrv_timer(mntr_tmr_time,mid) + time
258 write(str,
'(I3)') mid
260 $
'timer id='//trim(str)//
' in mntr_tmr_add not registered')
277 integer il, jl, maxlev, stride
279 integer olist(2,mntr_tmr_id_max), ierr, itmp
280 real timmin(mntr_tmr_id_max),timmax(mntr_tmr_id_max)
286 real glmax, glmin, dnekclock
289 $
'Summary of registered timers')
292 mntr_frame_tmini = dnekclock() - mntr_frame_tmini
297 ierr = iglmax(ierr,1)
299 call mntr_error(mntr_id,
"Inconsistent timer tree.")
307 maxlev = max(maxlev,olist(2,il))
312 if (olist(2,jl).eq.il.and.mntr_tmr_sum(olist(1,jl)))
then
313 itmp = mntr_tmr_id(mntr_tmr_mark,olist(1,jl))
315 mntr_tmrv_timer(mntr_tmr_count,itmp) =
316 $ mntr_tmrv_timer(mntr_tmr_count,itmp) +
317 $ mntr_tmrv_timer(mntr_tmr_count,olist(1,jl))
319 mntr_tmrv_timer(mntr_tmr_time,itmp) =
320 $ mntr_tmrv_timer(mntr_tmr_time,itmp) +
321 $ mntr_tmrv_timer(mntr_tmr_time,olist(1,jl))
328 do il=1,mntr_tmr_mpos
329 if (mntr_tmr_id(mntr_tmr_mark,il).ge.0)
then
330 timmin(il) = glmin(mntr_tmrv_timer(mntr_tmr_time,il),1)
331 timmax(il) = glmax(mntr_tmrv_timer(mntr_tmr_time,il),1)
335 if (nid.eq.mntr_pid0)
then
337 if(ierr.eq.0.and.mntr_lp_def.le.lp_prd)
then
343 if (mntr_iftdsc)
then
346 write(str,
'(I3)') stride*(olist(2,il))
347 ftm =
'("[",A,"]",'//trim(str)//
'X,A,'
348 write(str,
'(I3)') stride*(maxlev-olist(2,il))
349 ftm = trim(ftm)//trim(str)//
'X,": ",A)'
352 $ mntr_mod_name(mntr_tmr_id(mntr_tmr_mod,jl)),
353 $ mntr_tmr_name(jl), trim(mntr_tmr_dscr(jl))
359 write(str,
'(I3)') mntr_lstl_mnm +stride*maxlev-1
360 ftm=
'(A11,1X,A'//trim(adjustl(str))//
',1X,":",4A15)'
361 write(*,ftm)
'Module name',
'Timer name',
'Count',
'Min time',
362 $
'Max time',
'Max/count'
364 write(str,
'(I3)') stride*(olist(2,il))
365 ftm =
'("[",A,"]",'//trim(str)//
'X,A,'
366 write(str,
'(I3)') stride*(maxlev-olist(2,il))
367 ftm = trim(ftm)//trim(str)//
'X,":",4E15.8)'
369 write(*,ftm) mntr_mod_name(mntr_tmr_id(mntr_tmr_mod,jl)),
370 $ mntr_tmr_name(jl), mntr_tmrv_timer(mntr_tmr_count,jl),
371 $ timmin(jl),timmax(jl),
372 $ timmax(jl)/max(1.0,mntr_tmrv_timer(mntr_tmr_count,jl))
394 integer olist(2,mntr_tmr_id_max), ierr
397 integer ind(mntr_tmr_id_max), level, parent, ipos
398 integer slist(2,mntr_tmr_id_max), itmp1(2)
401 integer istart, in, itest
408 do il=1,mntr_tmr_mpos
409 if (mntr_tmr_id(mntr_tmr_mark,il).ge.0)
then
411 slist(1,npos) = mntr_tmr_id(mntr_tmr_mark,il)
415 if(npos.ne.mntr_tmr_num)
then
418 $
'Inconsistent timer number; return')
428 itest = slist(1,istart)
430 if(itest.ne.slist(1,il).or.il.eq.npos)
then
431 if (il.eq.npos.and.itest.eq.slist(1,il))
then
437 if (itest.eq.0.and.in.ne.1)
then
439 $
'Must be single root of the graph; return')
445 call ituple_sort(slist(1,istart),2,in,key,1,ind,itmp1)
subroutine bcast(buf, len)
subroutine mntr_tmr_is_name_reg(mid, mname)
Check if timer name is registered and return its id.
recursive subroutine mntr_build_ord_list(olist, slist, nlist, npos, parent, level)
Build ordered list reflecting graph structure.
subroutine mntr_tmr_add(mid, icount, time)
Check if timer id is registered. This operation is performed locally.
subroutine mntr_tmr_summary_print()
Print registered timers showing tree structure.
subroutine mntr_abort(mid, logs)
Abort simulation.
subroutine mntr_log(mid, priority, logs)
Write log message.
subroutine mntr_error(mid, logs)
Write error message.
subroutine mntr_tmr_get_olist(olist, ierr)
Provide ordered list of registered timers for printing.
logical function mntr_tmr_is_id_reg(mid)
Check if timer id is registered. This operation is performed locally.
subroutine mntr_tmr_reg(mid, pmid, modid, mname, mdscr, ifsum)
Register new timer.
subroutine capit(lettrs, n)
subroutine ituple_sort(a, lda, n, key, nkey, ind, aa)