profile_stop_timer Subroutine

private subroutine profile_stop_timer(self, label)

Type Bound

type_time

Arguments

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

Called by

proc~~profile_stop_timer~~CalledByGraph proc~profile_stop_timer type_time%profile_stop_timer proc~initialize_type_ftdss type_ftdss%initialize_type_ftdss proc~initialize_type_ftdss->proc~profile_stop_timer

Source Code

    subroutine profile_stop_timer(self, label)
        class(type_time), intent(inout) :: self
        character(len=*), intent(in) :: label
        integer :: i
        real(real64) :: duration
#ifdef _OPENMP
        real(real64) :: end_time_wtime
        end_time_wtime = omp_get_wtime()
#else
        integer(kind=int64) :: end_tick
        call system_clock(count=end_tick)
#endif
        do i = 1, size(self%sections)
            if (trim(self%sections(i)%label) == trim(label)) then
#ifdef _OPENMP
                duration = end_time_wtime - self%sections(i)%start_time_wtime
#else
                if (self%tick_rate > 0) then
                    duration = real(end_tick - self%sections(i)%start_tick, real64) / real(self%tick_rate, real64)
                else
                    duration = 0.0d0
                end if
#endif
                self%sections(i)%total_time = self%sections(i)%total_time + duration
                return
            end if
        end do
        write (*, '(3a)') "Error: Profiling section '", trim(label), "' not found. Timer not stopped."
    end subroutine profile_stop_timer