profiler_get_time Function

public function profiler_get_time(name) result(t)

Get accumulated time for a named region

Returns 0.0 if the region does not exist.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

Return Value real(kind=dp)


Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: idx

Source Code

   function profiler_get_time(name) result(t)
      !! Get accumulated time for a named region
      !!
      !! Returns 0.0 if the region does not exist.
      character(len=*), intent(in) :: name
      real(dp) :: t
      integer(default_int) :: idx

      t = 0.0_dp

#ifdef PIC_DISABLE_PROFILER
      return
#endif

      do idx = 1, state%num_regions
         if (trim(state%regions(idx)%name) == trim(name)) then
            t = state%regions(idx)%total_time
            return
         end if
      end do
   end function profiler_get_time