TimeProfiler.F90 Source File


This file depends on

sourcefile~~timeprofiler.f90~~EfferentGraph sourcefile~timeprofiler.f90 TimeProfiler.F90 sourcefile~abstractmeter.f90 AbstractMeter.F90 sourcefile~timeprofiler.f90->sourcefile~abstractmeter.f90 sourcefile~advancedmeter.f90 AdvancedMeter.F90 sourcefile~timeprofiler.f90->sourcefile~advancedmeter.f90 sourcefile~baseprofiler.f90 BaseProfiler.F90 sourcefile~timeprofiler.f90->sourcefile~baseprofiler.f90 sourcefile~mapl_exceptionhandling.f90 MAPL_ExceptionHandling.F90 sourcefile~timeprofiler.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~mapl_keywordenforcer.f90 MAPL_KeywordEnforcer.F90 sourcefile~timeprofiler.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~meternode.f90 MeterNode.F90 sourcefile~timeprofiler.f90->sourcefile~meternode.f90 sourcefile~mpitimergauge.f90 MpiTimerGauge.F90 sourcefile~timeprofiler.f90->sourcefile~mpitimergauge.f90 sourcefile~mapl_errorhandling.f90 MAPL_ErrorHandling.F90 sourcefile~abstractmeter.f90->sourcefile~mapl_errorhandling.f90 sourcefile~advancedmeter.f90->sourcefile~abstractmeter.f90 sourcefile~abstractgauge.f90 AbstractGauge.F90 sourcefile~advancedmeter.f90->sourcefile~abstractgauge.f90 sourcefile~baseprofiler.f90->sourcefile~abstractmeter.f90 sourcefile~baseprofiler.f90->sourcefile~advancedmeter.f90 sourcefile~baseprofiler.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~baseprofiler.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~baseprofiler.f90->sourcefile~meternode.f90 sourcefile~abstractmeternode.f90 AbstractMeterNode.F90 sourcefile~baseprofiler.f90->sourcefile~abstractmeternode.f90 sourcefile~meternodeptr.f90 MeterNodePtr.F90 sourcefile~baseprofiler.f90->sourcefile~meternodeptr.f90 sourcefile~meternodestack.f90 MeterNodeStack.F90 sourcefile~baseprofiler.f90->sourcefile~meternodestack.f90 sourcefile~mapl_exceptionhandling.f90->sourcefile~mapl_errorhandling.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~mapl_exceptionhandling.f90->sourcefile~mapl_throw.f90 sourcefile~meternode.f90->sourcefile~abstractmeter.f90 sourcefile~meternode.f90->sourcefile~abstractmeternode.f90 sourcefile~meternodevector.f90 MeterNodeVector.F90 sourcefile~meternode.f90->sourcefile~meternodevector.f90 sourcefile~mpitimergauge.f90->sourcefile~abstractgauge.f90 sourcefile~abstractgauge.f90->sourcefile~abstractmeter.f90 sourcefile~abstractmeternode.f90->sourcefile~abstractmeter.f90 sourcefile~mapl_errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~meternodeptr.f90->sourcefile~abstractmeternode.f90 sourcefile~meternodestack.f90->sourcefile~meternodeptr.f90 sourcefile~meternodevector.f90->sourcefile~abstractmeternode.f90

Files dependent on this one

sourcefile~~timeprofiler.f90~~AfferentGraph sourcefile~timeprofiler.f90 TimeProfiler.F90 sourcefile~mapl_profiler.f90~2 MAPL_Profiler.F90 sourcefile~mapl_profiler.f90~2->sourcefile~timeprofiler.f90 sourcefile~abstractserver.f90 AbstractServer.F90 sourcefile~abstractserver.f90->sourcefile~mapl_profiler.f90~2 sourcefile~applicationsupport.f90 ApplicationSupport.F90 sourcefile~applicationsupport.f90->sourcefile~mapl_profiler.f90~2 sourcefile~demo.f90 demo.F90 sourcefile~demo.f90->sourcefile~mapl_profiler.f90~2 sourcefile~extdatadrivergridcomp.f90 ExtDataDriverGridComp.F90 sourcefile~extdatadrivergridcomp.f90->sourcefile~mapl_profiler.f90~2 sourcefile~mapl.f90 MAPL.F90 sourcefile~mapl.f90->sourcefile~mapl_profiler.f90~2 sourcefile~mapl_bundleio_test.f90 mapl_bundleio_test.F90 sourcefile~mapl_bundleio_test.f90->sourcefile~mapl_profiler.f90~2 sourcefile~mapl_capgridcomp.f90 MAPL_CapGridComp.F90 sourcefile~mapl_capgridcomp.f90->sourcefile~mapl_profiler.f90~2 sourcefile~mapl_generic.f90 MAPL_Generic.F90 sourcefile~mapl_generic.f90->sourcefile~mapl_profiler.f90~2 sourcefile~mapl_nuopcwrappermod.f90 MAPL_NUOPCWrapperMod.F90 sourcefile~mapl_nuopcwrappermod.f90->sourcefile~mapl_profiler.f90~2 sourcefile~mapl_verticalmethods.f90 MAPL_VerticalMethods.F90 sourcefile~mapl_verticalmethods.f90->sourcefile~mapl_profiler.f90~2 sourcefile~mpi_demo.f90 mpi_demo.F90 sourcefile~mpi_demo.f90->sourcefile~mapl_profiler.f90~2 sourcefile~mpiserver.f90 MpiServer.F90 sourcefile~mpiserver.f90->sourcefile~mapl_profiler.f90~2 sourcefile~multigroupserver.f90 MultiGroupServer.F90 sourcefile~multigroupserver.f90->sourcefile~mapl_profiler.f90~2 sourcefile~regrid_util.f90 Regrid_Util.F90 sourcefile~regrid_util.f90->sourcefile~mapl_profiler.f90~2 sourcefile~serverthread.f90 ServerThread.F90 sourcefile~serverthread.f90->sourcefile~mapl_profiler.f90~2 sourcefile~test_advancedmeter.pf test_AdvancedMeter.pf sourcefile~test_advancedmeter.pf->sourcefile~mapl_profiler.f90~2 sourcefile~test_column.pf test_Column.pf sourcefile~test_column.pf->sourcefile~mapl_profiler.f90~2 sourcefile~test_distributedmeter.pf test_DistributedMeter.pf sourcefile~test_distributedmeter.pf->sourcefile~mapl_profiler.f90~2 sourcefile~test_exclusivecolumn.pf test_ExclusiveColumn.pf sourcefile~test_exclusivecolumn.pf->sourcefile~mapl_profiler.f90~2 sourcefile~test_meternode.pf test_MeterNode.pf sourcefile~test_meternode.pf->sourcefile~mapl_profiler.f90~2 sourcefile~test_meternodeiterator.pf test_MeterNodeIterator.pf sourcefile~test_meternodeiterator.pf->sourcefile~mapl_profiler.f90~2 sourcefile~test_namecolumn.pf test_NameColumn.pf sourcefile~test_namecolumn.pf->sourcefile~mapl_profiler.f90~2 sourcefile~test_percentagecolumn.pf test_PercentageColumn.pf sourcefile~test_percentagecolumn.pf->sourcefile~mapl_profiler.f90~2 sourcefile~test_profilereporter.pf test_ProfileReporter.pf sourcefile~test_profilereporter.pf->sourcefile~mapl_profiler.f90~2 sourcefile~test_timeprofiler.pf test_TimeProfiler.pf sourcefile~test_timeprofiler.pf->sourcefile~mapl_profiler.f90~2

Source Code

#include "unused_dummy.H"
#include "MAPL_ErrLog.h"

module mapl_TimeProfiler_private
   use mapl_BaseProfiler, only: BaseProfiler
   use mapl_BaseProfiler, only: TimeProfilerIterator => BaseProfilerIterator

   use mapl_MpiTimerGauge
   use mapl_AdvancedMeter
   use mapl_AbstractMeter
   use mapl_MeterNode
   implicit none
   private

   public :: TimeProfiler
   public :: TimeProfilerIterator
   public :: get_global_time_profiler

   type, extends(BaseProfiler) :: TimeProfiler
      private
   contains
      procedure :: make_meter
      procedure :: copy
   end type TimeProfiler

   interface TimeProfiler
      module procedure new_TimeProfiler
   end interface TimeProfiler

   type(TimeProfiler), protected, target :: global_time_profiler

contains

   function new_TimeProfiler(name, comm_world) result(prof)
      type(TimeProfiler), target :: prof
      character(*), intent(in) :: name
      integer, optional,intent(in) :: comm_world

      call prof%set_comm_world(comm_world = comm_world)
      call prof%set_node(MeterNode(name, prof%make_meter()))

   end function new_TimeProfiler

   function make_meter(this) result(meter)
      class(AbstractMeter), allocatable :: meter
      class(TimeProfiler), intent(in) :: this
      _UNUSED_DUMMY(this)
      meter = AdvancedMeter(MpiTimerGauge())
   end function make_meter

   function get_global_time_profiler() result(time_profiler)
      type(TimeProfiler), pointer :: time_profiler

      time_profiler => global_time_profiler

   end function get_global_time_profiler

   subroutine copy(new, old)
      class(TimeProfiler), target, intent(inout) :: new
      class(BaseProfiler), target, intent(in) :: old

      call new%copy_profiler(old)

   end subroutine copy

end module mapl_TimeProfiler_Private

module mapl_TimeProfiler
   use mpi
   use mapl_BaseProfiler
   use mapl_TimeProfiler_private
   use mapl_KeywordEnforcerMod
   use mapl_ExceptionHandling

   implicit none
   private

   public :: TimeProfiler
   public :: TimeProfilerIterator
   public :: get_global_time_profiler
   public :: initialize_global_time_profiler
   public :: finalize_global_time_profiler
   public :: start_global_time_profiler
   public :: stop_global_time_profiler

contains

   subroutine initialize_global_time_profiler(unusable, name, comm)
      class (KeywordEnforcer), optional, intent(in) :: unusable
      character(*), optional, intent(in) :: name
      integer, optional, intent(in) :: comm

      type(TimeProfiler), pointer :: time_profiler
      character(:), allocatable :: name_
      integer :: world_comm

      if (present(name)) then
         name_ = name
      else
         name_ = 'All'
      end if

      if (present(comm)) then
         world_comm = comm
      else
         world_comm = MPI_COMM_WORLD
      end if

      time_profiler => get_global_time_profiler()
      time_profiler = TimeProfiler(name_, comm_world = world_comm)

      _UNUSED_DUMMY(unusable)
   end subroutine initialize_global_time_profiler

   subroutine finalize_global_time_profiler()

      type(TimeProfiler), pointer :: time_profiler

      time_profiler => get_global_time_profiler()
      call time_profiler%finalize()

   end subroutine finalize_global_time_profiler

   subroutine start_global_time_profiler(unusable, rc)
      class (KeywordEnforcer), optional, intent(in) :: unusable
      integer, optional, intent(out) :: rc
      type(TimeProfiler), pointer :: time_profiler
      integer :: status

      time_profiler => get_global_time_profiler()
      call time_profiler%start(rc=status)
      _VERIFY(status)
      _RETURN(_SUCCESS)
      _UNUSED_DUMMY(unusable)
   end subroutine start_global_time_profiler

   subroutine stop_global_time_profiler(unusable, rc)
      class (KeywordEnforcer), optional, intent(in) :: unusable
      integer, optional, intent(out) :: rc
      type(TimeProfiler), pointer :: time_profiler
      integer :: status

      time_profiler => get_global_time_profiler()
      call time_profiler%stop(rc=status)
      _VERIFY(status)
      _RETURN(_SUCCESS)
      _UNUSED_DUMMY(unusable)
   end subroutine stop_global_time_profiler

end module mapl_TimeProfiler