otimer_stop Subroutine

private impure subroutine otimer_stop(this, nloops, message, print, color)

Uses

  • proc~~otimer_stop~~UsesGraph proc~otimer_stop timer%otimer_stop omp_lib omp_lib proc~otimer_stop->omp_lib

Stops the timer and calculates the OMP time. Optionally, it can print a message along with the OMP time.

Type Bound

timer

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this
integer, intent(in), optional :: nloops
character(len=*), intent(in), optional :: message
logical, intent(in), optional :: print
character(len=*), intent(in), optional :: color

Calls

proc~~otimer_stop~~CallsGraph proc~otimer_stop timer%otimer_stop omp_get_wtime omp_get_wtime proc~otimer_stop->omp_get_wtime proc~print_time print_time proc~otimer_stop->proc~print_time colorize colorize proc~print_time->colorize

Called by

proc~~otimer_stop~~CalledByGraph proc~otimer_stop timer%otimer_stop program~test19 test19 program~test19->proc~otimer_stop program~test20 test20 program~test20->proc~otimer_stop program~test21 test21 program~test21->proc~otimer_stop program~test7 test7 program~test7->proc~otimer_stop program~test8 test8 program~test8->proc~otimer_stop program~test9 test9 program~test9->proc~otimer_stop

Source Code

   impure subroutine otimer_stop(this, nloops, message, print, color)
      use omp_lib
      class(timer), intent(inout)        :: this
      integer,      intent(in), optional :: nloops
      character(*), intent(in), optional :: message
      character(:), allocatable          :: msg
      logical,      intent(in), optional :: print
      character(*), intent(in), optional :: color

      ! Stop the timer
      this%omp_end = omp_get_wtime()

      ! Calculate the elapsed OMP time
      this%omp_elapsed = this%omp_end - this%omp_start

      ! Convert OMP time to seconds
      if (.not.present(nloops)) this%omp_time = this%omp_elapsed
      if (     present(nloops)) this%omp_time = this%omp_elapsed / real(nloops, kind=rk)

      ! Print the elapsed time
      if (.not. present(message)) then
         msg = "OMP time:"
      else
         msg = message
      end if

      if (present(print)) then
         if (print) call print_time(this%omp_time, msg, color)
      else
         call print_time(this%omp_time, msg, color)
      end if

      ! Deallocate the message
      if (allocated(msg)) deallocate(msg)

   end subroutine otimer_stop