Load the configuration for the timer output.
The user may specify how which timers are to be written. We use a timer table to describe the file to write to and the level of detail for each timer.
timer = {
file = 'timeinfo', -- this is the default
details = {
{'overall', 'details'}, -- will be written to
-- timeinfo_overall.details
{'init', 'summary'}, -- summary is the default
{'output', 'ignored'} -- will not be printed
}
}
You might list an arbitrary number of timers with their level of detail, those which are not stated will be printed in summary form. If no timer table is given, or the file name is an empty string, no timer information will be written.
Note
Names of the timers will only be checked during dumping, the names and verbosity settings are case insensitive. If the same name is provided multiple times, the first occurence will take precedence.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_timerconfig_type), | intent(out) | :: | timer_config |
Timer configuration to load from the Lua configuration script. |
||
type(flu_State) | :: | conf |
Handle to the Lua configuration script. |
|||
integer, | intent(in), | optional | :: | parent |
Handle of the table containing the requested table. |
subroutine tem_timer_loadconfig(timer_config, conf, parent) ! -------------------------------------------------------------------- ! !> Timer configuration to load from the Lua configuration script. type(tem_timerconfig_type), intent(out) :: timer_config !> Handle to the Lua configuration script. type(flu_state) :: conf !> Handle of the table containing the requested table. integer, intent(in), optional :: parent ! -------------------------------------------------------------------- ! integer :: timertab integer :: settingtab integer :: detailtab character(len=labelLen) :: label character(len=labelLen) :: verbosity character(len=labelLen) :: tmp integer :: verbconf integer :: pos logical :: wasAdded integer :: iError ! -------------------------------------------------------------------- ! call aot_table_open( L = conf, & & parent = parent, & & thandle = timertab, & & key = 'timer' ) if (timertab /= 0) then call aot_get_val( L = conf, & & thandle = timertab, & & key = 'file', & & default = 'timerinfo', & & errcode = iError, & & val = timer_config%filename ) write(logUnit(3),*) 'Timer info is written to file: ',& & trim(timer_config%filename) call aot_table_open( L = conf, & & parent = timertab, & & thandle = detailtab, & & key = 'details' ) if (aot_table_first(L = conf, thandle = detailtab)) then write(logunit(3),*) 'Reading timer configuration' do settingtab = aot_table_top(conf) call aot_get_val( L = conf, & & thandle = settingtab, & & pos = 1, & & errcode = iError, & & val = label ) call aot_get_val( L = conf, & & thandle = settingtab, & & pos = 2, & & errcode = iError, & & val = verbosity ) call aot_table_close(L = conf, thandle = settingtab) call append( me = timer_config%label, & & val = upper_to_lower(label), & & pos = pos, & & wasAdded = wasAdded ) if (wasAdded) then tmp = upper_to_lower(verbosity) select case(trim(tmp)) case ('ignore') verbconf = tem_timer_ignored case ('summary') verbconf = tem_timer_summary case ('details') verbconf = tem_timer_details case default write(logunit(1),*) 'WARNING: Unknown verbosity setting ' & & // trim(tmp) // ' for timer ' & & // trim(label) // ' !' write(logunit(1),*) 'Please set it to one of the following:' write(logunit(1),*) ' * ignore' write(logunit(1),*) ' * summary' write(logunit(1),*) ' * details' write(logunit(1),*) write(logunit(1),*) 'Using the default setting summary ' & & // 'for timer ' // trim(label) verbconf = tem_timer_summary end select call append( me = timer_config%verbosity, & & val = verbconf ) end if ! Get the next entry from the timer table or leave the loop, if there ! is none anymore. if ( .not. flu_next(L = conf, index = detailtab) ) EXIT end do end if end if call aot_table_close(L = conf, thandle = timertab) end subroutine tem_timer_loadconfig