Stops the timer and calculates the OMP time. Optionally, it can print a message along with the OMP time.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(timer), | intent(inout) | :: | this | |||
integer, | intent(in), | optional | :: | nloops | ||
character(len=*), | intent(in), | optional | :: | message | ||
logical, | intent(in), | optional | :: | |||
character(len=*), | intent(in), | optional | :: | color |
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