lightkrylov_watch Derived Type

type, public, extends(abstract_watch) :: lightkrylov_watch

Global timing structure to contain all timers within Lightkrylov


Type-Bound Procedures

procedure, public, pass(self) :: add_group

Add new timer group to the watch.

  • private subroutine add_group(self, name, istart, iend, count)

    Type-bound to abstract_watch: Add timer group to watch. Note: The new group name must be unique. This is a quick hack and should be done better.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    character(len=*), intent(in) :: name
    integer, intent(in) :: istart
    integer, intent(in) :: iend
    integer, intent(out), optional :: count

procedure, public, pass(self) :: add_timer

Add new timer to the watch.

  • private subroutine add_timer(self, name, start, count)

    Type-bound to abstract_watch: Add timer to watch and optionally start it immediately. Note: The new timer name must be unique.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    character(len=*), intent(in) :: name
    logical, intent(in), optional :: start
    integer, intent(out), optional :: count

procedure, public, pass(self) :: enumerate

Print summary of registered timers and their current status.

  • private subroutine enumerate(self, only_user)

    Type-bound to abstract_watch: Summarize registered timers and their status.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(in) :: self
    logical, intent(in), optional :: only_user

    Summarize only user defined timers? default: .false.

procedure, public, pass(self) :: finalize

Gather timing information and print it to screen/logfile.

  • private subroutine finalize(self, write_to_file)

    Finalize global watch within LightKrylov and print used timers.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    logical, intent(in), optional :: write_to_file

    Print timer summary to a dedicated timer logfile as well as the general log file? default: .true.

procedure, public, pass(self) :: get_data => get_timer_data_by_name

  • private subroutine get_timer_data_by_name(self, name, restart, etime, etmin, etmax, etimp, lcount, rcount, gcount)

    Type-bound to abstract_watch: Getter routine to return the data for timer referenced by name. Notes: Wrapper of the corresponding routine from lightkrylov_timer. If it is running, the timer is stopped.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    character(len=*), intent(in) :: name
    logical, intent(in), optional :: restart
    real(kind=dp), intent(out), optional :: etime
    real(kind=dp), intent(out), optional :: etmin
    real(kind=dp), intent(out), optional :: etmax
    real(kind=dp), intent(out), optional :: etimp
    integer, intent(out), optional :: lcount
    integer, intent(out), optional :: rcount
    integer, intent(out), optional :: gcount

procedure, public, pass(self) :: get_group_id

  • private function get_group_id(self, name) result(id)

    Type-bound to abstract_watch: Getter routine to return the group id based on name.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch) :: self
    character(len=*) :: name

    Timer name

    Return Value integer

procedure, public, pass(self) :: get_time => get_timer_etime_by_name

  • private function get_timer_etime_by_name(self, name, restart) result(etime)

    Type-bound to abstract_watch: Getter routine to return the current etime for timer referenced by name. Notes: Wrapper of the corresponding routine from lightkrylov_timer. If it is running, the timer is stopped.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch) :: self
    character(len=*) :: name
    logical, optional :: restart

    Return Value real(kind=dp)

procedure, public, pass(self) :: get_timer_id

  • private function get_timer_id(self, name) result(id)

    Type-bound to abstract_watch: Getter routine to return the timer id based on name.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch) :: self
    character(len=*) :: name

    Timer name

    Return Value integer

procedure, public, pass(self) :: initialize

Set up private timers, flags and counters. Switch on timing.

  • private subroutine initialize(self)

    Initialize global watch within LightKrylov and define private system timers.

    Arguments

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

procedure, public, pass(self) :: pause => pause_timer_by_name

  • private subroutine pause_timer_by_name(self, name)

    Type-bound to abstract_watch: Pause timer referenced by name. Note: Wrapper of the corresponding routine from lightkrylov_timer.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    character(len=*), intent(in) :: name

procedure, public, pass(self) :: print_info => print_timer_info_by_name

  • private subroutine print_timer_info_by_name(self, name)

    Type-bound to abstract_watch: Print timing information for timer referenced by name. Note: Wrapper of the corresponding routine from lightkrylov_timer.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    character(len=*), intent(in) :: name

procedure, public, pass(self) :: remove_timer

Remove existing timer from the watch.

  • private subroutine remove_timer(self, name, count)

    Type-bound to abstract_watch: Remove timer from watch. Note: Timers considered private (defined during initialisation) cannot be removed.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    character(len=*), intent(in) :: name
    integer, intent(out), optional :: count

procedure, public, pass(self) :: reset => reset_timer_by_name

  • private subroutine reset_timer_by_name(self, name, soft, clean)

    Type-bound to abstract_watch: Reset timer referenced by name. Note: Wrapper of the corresponding routine from lightkrylov_timer.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    character(len=*), intent(in) :: name
    logical, intent(in), optional :: soft
    logical, intent(in), optional :: clean

procedure, public, pass(self) :: reset_all

Reset all timers in watch.

  • private subroutine reset_all(self, soft, clean)

    Type-bound to abstract_watch: Utility function to reset all timers at once. Note: Wrapper of the corresponding routine from lightkrylov_timer.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    logical, intent(in), optional :: soft
    logical, intent(in), optional :: clean

procedure, public, pass(self) :: set_private_timers_and_name => set_lightkrylov_timers

  • private subroutine set_lightkrylov_timers(self)

    Initialize global watch within LightKrylov and define private system timers.

    Arguments

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

procedure, public, pass(self) :: set_watch_name

  • private subroutine set_watch_name(self, name)

    Type-bound to abstract_watch: Set name of watch

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    character(len=*), intent(in) :: name

    Watch name

procedure, public, pass(self) :: start => start_timer_by_name

  • private subroutine start_timer_by_name(self, name)

    Type-bound to abstract_watch: Start timer referenced by name. Note: Wrapper of the corresponding routine from lightkrylov_timer.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    character(len=*), intent(in) :: name

procedure, public, pass(self) :: stop => stop_timer_by_name

  • private subroutine stop_timer_by_name(self, name)

    Type-bound to abstract_watch: Stop timer referenced by name. Note: Wrapper of the corresponding routine from lightkrylov_timer.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_watch), intent(inout) :: self
    character(len=*), intent(in) :: name

Source Code

   type, extends(abstract_watch), public :: lightkrylov_watch
      !! Global timing structure to contain all timers within Lightkrylov
   contains
      private
      procedure, pass(self), public :: set_private_timers_and_name => set_lightkrylov_timers
   end type lightkrylov_watch