F.1.12 Stop_Timer Procedure

The main documentation of the Stop_Timer Procedure contains additional explanation of this code listing.

  subroutine Stop_Timer (Timer)

    ! Input/Output variable.

    type(Timer_type), intent(inout) :: Timer  ! Timer to be stopped.

    ! Internal variables.

    type(real) :: CPU_Time_Stop, Wall_Clock_Time_Stop

    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ! Verify requirements.

    VERIFY(Valid_State(Timer),5)  ! Timer is valid.
    VERIFY(Timer%Running,5)       ! Timer is running.

    ! Set stop times.

    CPU_Time_Stop = Get_CPU_Time()
    Wall_Clock_Time_Stop = Get_Wall_Clock_Time()

    ! Update statistics.

    call Add_Value (Timer%CPU_Time%Statistics, &
                    CPU_Time_Stop - Timer%CPU_Time%Start)
    call Add_Value (Timer%Wall_Clock_Time%Statistics, &
                    Wall_Clock_Time_Stop - Timer%Wall_Clock_Time%Start)

    ! Reset start time.

    Timer%CPU_Time%Start = zero
    Timer%Wall_Clock_Time%Start = zero

    ! Set status.

    Timer%Running = .false.

    ! Verify guarantees.

    VERIFY(Valid_State(Timer),5)  ! Timer is valid.
    VERIFY(.not.Timer%Running,5)  ! Timer is not running.

    return
  end subroutine Stop_Timer



Michael L. Hall