halt_timer Subroutine

public subroutine halt_timer(proc_timer)

Arguments

Type IntentOptional Attributes Name
type(timer), intent(inout) :: proc_timer

Contents

Source Code


Source Code

    subroutine halt_timer(proc_timer)
        != Halt the timer for the specified object.
        != In/Out:
        !=   proc_timer: the timer object of the procedure.  Must be intialised by
        !=               set_timer.  The timer is stopped and the total cpu and
        !=               system time spent in the procedure is updated with the time
        !=               spent for the current call.
        type(timer), intent(inout) :: proc_timer
        integer :: i
        real(dp) :: t
        real(dp) :: time_cpu

        if (time_at_all) then
            if (.not. proc_timer%time) then
                ! Not timing this object: its level is below that of the
                ! iGLobalTimerLevel given via the logging option TIMING.
            else if (.not. associated(proc_timer%store)) then
                call warning_neci('halt_timer', 'proc_timer not intialised: '//proc_timer%timer_name)
                timer_error = .true.
            else
                t = MPI_WTIME()
                time_cpu = t - proc_timer%store%time_cpu
                proc_timer%store%sum_time_cpu = proc_timer%store%sum_time_cpu + time_cpu
                ! Have to remove the time spent in this routine from the other
                ! timers, so that the currently active timers exclude time spent
                ! in other timed procedures.
                do i = 1, itimer
                    timers(i)%time_cpu = timers(i)%time_cpu + time_cpu
                end do
                ! Unset timer behaviour flags.
                proc_timer%store%timing_on = .false.
                proc_timer%time = .true.
            end if
        end if

    end subroutine halt_timer