Individual timer. Atomic timer that is associated to a particular 'event' by name which may be a procedure or a user-defined string at instantiation.
The timing information in gathered for each timer independently. The individual timers are gathered
into groups (relevant only for timing output) and managed by a central watch that is derived from
the abstract_watch
type. The individual timers are rarely user independently but all timing
actions are typically performed via procedures in the central timer.
A notable exception are the matvec
/rmatvec
as well as reponse
timers associated with the types
abstract_linop
and abstract_system
, respectively, which are managed via their parent types and the
corresponding type-bound procedures only.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=128), | public | :: | name | = | 'default_timer' |
Timer name. |
Aggregate data and prepare summary.
Type-bound to lightkrylov_timer: Prepare timer summary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lightkrylov_timer), | intent(inout) | :: | self | |||
logical, | intent(in), | optional | :: | if_silent |
No output |
Getter routine to access to all local data: etime, counts, etime_max, etime_min, etime_pause.
Type-bound to lightkrylov_timer: Getter routine to return the timer data. Note: If it is running, the timer is stopped.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lightkrylov_timer), | intent(inout) | :: | self | |||
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 |
Getter routine to access self%etime only.
Type-bound to lightkrylov_timer: Getter routine to return the current timer etime. Note: If it is running, the timer is stopped.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lightkrylov_timer) | :: | self | ||||
logical, | optional | :: | restart |
Type-bound to lightkrylov_timer: Pause timer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lightkrylov_timer), | intent(inout) | :: | self |
Print timing data.
Type-bound to lightkrylov_timer: Compute spimple statistics and print timing information to screen.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lightkrylov_timer), | intent(inout) | :: | self |
Reset timing data (soft/hard, clear/save data).
Type-bound to lightkrylov_timer: Reset timer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lightkrylov_timer), | intent(inout) | :: | self | |||
logical, | intent(in), | optional | :: | soft |
Save timing data and reset only if data was collected (i.e. timer was called), default = .true. |
|
logical, | intent(in), | optional | :: | clean |
Flush timing data as well as previously saved timing data, default = .false. |
|
logical, | intent(in), | optional | :: | verbose |
Always print information about the reset process. |
Transfer timing data to arrays.
Type-bound to lightkrylov_timer: Save current timing information. Note: This is done irrespective of the call/run status of the timer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lightkrylov_timer), | intent(inout) | :: | self |
Type-bound to lightkrylov_timer: Start timer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lightkrylov_timer), | intent(inout) | :: | self |
Type-bound to lightkrylov_timer: Stop timer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lightkrylov_timer), | intent(inout) | :: | self |
type, public :: lightkrylov_timer !! Individual timer. !! Atomic timer that is associated to a particular 'event' by name which may be a procedure or a !! user-defined string at instantiation. !! !! The timing information in gathered for each timer independently. The individual timers are gathered !! into groups (relevant only for timing output) and managed by a central watch that is derived from !! the `abstract_watch` type. The individual timers are rarely user independently but all timing !! actions are typically performed via procedures in the central timer. !! !! A notable exception are the `matvec`/`rmatvec` as well as `reponse` timers associated with the types !! `abstract_linop` and `abstract_system`, respectively, which are managed via their parent types and the !! corresponding type-bound procedures only. private character(len=128), public :: name = 'default_timer' !! Timer name. real(dp) :: etime = 0.0_dp !! Elapsed time since reset. real(dp) :: etime_pause = 0.0_dp !! Elapsed time up until most recent pause. real(dp) :: start_time = 0.0_dp !! Start time for comparison. real(dp) :: etime_max = 0.0_dp !! Maximum elapsed time since reset. real(dp) :: etime_min = huge(1.0_dp) !! Minimum elapsed time since reset. integer :: local_count = 0 !! Call counter since reset. integer :: reset_count = 0 !! Reset counter. integer :: count = 0 !! Global counter (only reset when data is flushed). logical :: running = .false. !! Protection against repeated starts. logical :: is_finalized = .false. !! Switch for printing. real(dp), dimension(:), allocatable :: etime_data real(dp), dimension(:), allocatable :: etavg_data real(dp), dimension(:), allocatable :: etmin_data real(dp), dimension(:), allocatable :: etmax_data integer, dimension(:), allocatable :: count_data contains private procedure, pass(self), public :: start => start_timer procedure, pass(self), public :: stop => stop_timer procedure, pass(self), public :: pause => pause_timer procedure, pass(self), public :: reset => reset_timer !! Reset timing data (soft/hard, clear/save data). procedure, pass(self), public :: finalize => finalize_timer !! Aggregate data and prepare summary. procedure, pass(self), public :: get_time => get_timer_etime !! Getter routine to access self%etime only. procedure, pass(self), public :: get_data => get_timer_data !! Getter routine to access to all local data: etime, counts, etime_max, etime_min, etime_pause. procedure, pass(self), public :: print_info => print_timer_info !! Print timing data. procedure, pass(self), public :: save_timer_data !! Transfer timing data to arrays. end type lightkrylov_timer