mimic_timer Derived Type

type, public :: mimic_timer

Timer class storing all function calls


Contents

Source Code


Components

TypeVisibilityAttributesNameInitial
type(mimic_stack_entry), private, dimension(:), pointer:: entries

List of top-level function calls

integer, private :: num_entries =0

Number of entries


Type-Bound Procedures

procedure, private :: start => start_timer

  • public function start_timer(this, parent, name) result(res)

    Start a timer for a given function

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_timer), intent(inout), target:: this
    type(mimic_stack_entry), intent(inout), pointer:: parent

    pointer to parent stack entry

    character(len=*), intent(in) :: name

    name of the procedure

    Return Value type(mimic_stack_entry),pointer

    Pointer to a created stack entry

procedure, private :: stop => stop_timer

  • public subroutine stop_timer(this, entry)

    Stop a timer for a given function (invalidates the pointer)

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_timer), intent(inout), target:: this
    type(mimic_stack_entry), intent(inout), pointer:: entry

    Function timing of which is currently measured

procedure, private :: print => print_timings

  • public subroutine print_timings(this)

    Print measured timings of function calls

    Arguments

    TypeIntentOptionalAttributesName
    class(mimic_timer), intent(inout) :: this

Source Code

    type :: mimic_timer
        private
        !> List of top-level function calls
        type(mimic_stack_entry), dimension(:), pointer :: entries
        !> Number of entries
        integer :: num_entries = 0
    contains
        private
        procedure :: start => start_timer
        procedure :: stop => stop_timer
        procedure :: print => print_timings
    end type mimic_timer