start_timer Function

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


Contents

Source Code


Source Code

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

    class(mimic_timer), intent(inout), target :: this
    !> pointer to parent stack entry
    type(mimic_stack_entry), pointer, intent(inout) :: parent
    !> name of the procedure
    character(len=*), intent(in) :: name

    !> Pointer to a created stack entry
    type(mimic_stack_entry), pointer :: res

    type(mimic_stack_entry), pointer :: temp_parent
    integer :: hash

    hash = hash_str(name)

    if (associated(parent)) then
        temp_parent => find_entry(this%entries, this%num_entries, parent%hash)
        if (.not. associated(temp_parent)) then
            stop "Invalid stack parent - something is not right"
        end if
        res => add_call(temp_parent%children, temp_parent%num_children, hash, name, temp_parent)
    else
        res => add_call(this%entries, this%num_entries, hash, name, null())
    end if

end function start_timer