timer_stop Subroutine

private subroutine timer_stop(self)

stop the timer. If OMP is enabled, it will use omp_get_wtime() if not, it will use Fortran’s system_clock

Usage: call my_timer%stop()

Usage assumes a declaration of type(pic_timer_type) :: my_timer will fail if a timer has not been started!

Type Bound

pic_timer_type

Arguments

Type IntentOptional Attributes Name
class(pic_timer_type), intent(inout) :: self

Source Code

   subroutine timer_stop(self)
      !! stop the timer. If OMP is enabled, it will use omp_get_wtime()
      !! if not, it will use Fortran's system_clock
      !!
      !! Usage: call my_timer%stop()
      !!
      !! Usage assumes a declaration of type(pic_timer_type) :: my_timer
      !! will fail if a timer has not been started!
      class(pic_timer_type), intent(inout) :: self
      if (.not. self%is_running) then
         error stop "Cannot stop a timer that has not been started!"
      end if
#ifdef _OPENMP
      self%stop_time = omp_get_wtime()
#else
      call system_clock(self%stop_count)
#endif
      ! if someone stops the timer, we stop !
      self%is_running = .false.
   end subroutine timer_stop