tem_timer_loadconfig Subroutine

public subroutine tem_timer_loadconfig(timer_config, conf, parent)

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.

Arguments

Type IntentOptional 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.


Calls

proc~~tem_timer_loadconfig~~CallsGraph proc~tem_timer_loadconfig tem_timer_loadconfig aot_get_val aot_get_val proc~tem_timer_loadconfig->aot_get_val aot_table_close aot_table_close proc~tem_timer_loadconfig->aot_table_close aot_table_first aot_table_first proc~tem_timer_loadconfig->aot_table_first aot_table_open aot_table_open proc~tem_timer_loadconfig->aot_table_open aot_table_top aot_table_top proc~tem_timer_loadconfig->aot_table_top flu_next flu_next proc~tem_timer_loadconfig->flu_next interface~append~29 append proc~tem_timer_loadconfig->interface~append~29 proc~upper_to_lower upper_to_lower proc~tem_timer_loadconfig->proc~upper_to_lower proc~append_da_label append_da_label interface~append~29->proc~append_da_label proc~append_da_veclabel append_da_veclabel interface~append~29->proc~append_da_veclabel interface~expand~27 expand proc~append_da_label->interface~expand~27 interface~sortedposofval~5 sortedposofval proc~append_da_label->interface~sortedposofval~5 proc~append_da_veclabel->interface~expand~27 proc~expand_da_label expand_da_label interface~expand~27->proc~expand_da_label proc~sortposofval_label sortposofval_label interface~sortedposofval~5->proc~sortposofval_label

Called by

proc~~tem_timer_loadconfig~~CalledByGraph proc~tem_timer_loadconfig tem_timer_loadconfig proc~tem_timer_loadconfig_glob tem_timer_loadconfig_glob proc~tem_timer_loadconfig_glob->proc~tem_timer_loadconfig proc~tem_load_general tem_load_general proc~tem_load_general->proc~tem_timer_loadconfig_glob

Source Code

  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