timer_type Derived Type

type, public :: timer_type

derived type for a timer, contains the start, stop, and count variables can work with or without omp. If PIC is compiled with OpenMP the default timer will be the omp time. This is mostly to minimize problems with threading and system clock


Inherited by

type~~timer_type~~InheritedByGraph type~timer_type timer_type type~flop_rate_type flop_rate_type type~flop_rate_type->type~timer_type m_timer

Components

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: count_rate = 1_default_int
logical, private :: is_running = .false.
integer(kind=default_int), private :: start_count = 0_default_int
real(kind=dp), private :: start_time = 0.0_dp
integer(kind=default_int), private :: stop_count = 0_default_int
real(kind=dp), private :: stop_time = 0.0_dp
real(kind=dp), private :: walltime

Type-Bound Procedures

procedure, public, non_overridable :: get_elapsed_time => timer_get_elapsed_time

  • private function timer_get_elapsed_time(self) result(elapsed)

    Returns the elapsed time as a real(dp) variable

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(timer_type), intent(in) :: self

    Return Value real(kind=dp)

procedure, public, non_overridable :: print_time => timer_print_time

procedure, public, non_overridable :: start => timer_start

  • private subroutine timer_start(self)

    starts the timer. If OMP is enabled, it will use omp_get_wtime() if not, it will use Fortran’s system_clock

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(timer_type), intent(inout) :: self

procedure, public, non_overridable :: stop => timer_stop

  • private subroutine timer_stop(self)

    stop the timer. If OMP is enabled, it will use omp_get_wtime() if not, it will use Fortran’s system_clock

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(timer_type), intent(inout) :: self

Source Code

   type :: timer_type
    !! derived type for a timer, contains the start, stop, and count variables
    !! can work with or without omp. If PIC is compiled with OpenMP the default
    !! timer will be the omp time. This is mostly to minimize problems with threading
    !! and system clock
      private
      real(dp) :: start_time = 0.0_dp
      real(dp) :: stop_time = 0.0_dp
      real(dp) :: walltime
      logical :: is_running = .false.
      integer(default_int) :: start_count = 0_default_int
      integer(default_int) :: stop_count = 0_default_int
      integer(default_int) :: count_rate = 1_default_int
   contains
      procedure, non_overridable :: start => timer_start
      procedure, non_overridable :: stop => timer_stop
      procedure, non_overridable :: print_time => timer_print_time
      procedure, non_overridable :: get_elapsed_time => timer_get_elapsed_time
   end type timer_type