timer_resume Subroutine

private subroutine timer_resume(this)

timer_resume measures the paused interval and adds it to paused_ticks. A later timer_stop subtracts those ticks from the wall-clock interval.

Type Bound

timer

Arguments

Type IntentOptional Attributes Name
class(timer), intent(inout) :: this

Paused wall-clock timer instance to resume.


Calls

proc~~timer_resume~~CallsGraph proc~timer_resume timer%timer_resume proc~ticks_diff ticks_diff proc~timer_resume->proc~ticks_diff

Called by

proc~~timer_resume~~CalledByGraph proc~timer_resume timer%timer_resume proc~run_test31 run_test31 proc~run_test31->proc~timer_resume program~check check program~check->proc~run_test31

Source Code

   subroutine timer_resume(this)
      class(timer), intent(inout) :: this
         !! Paused wall-clock timer instance to resume.

      integer(ik) :: clock_now
         !! Tick captured from `system_clock` at resume time.
      integer(ik) :: pause_dt
         !! Tick duration between `timer_pause` and this resume call.

      if (.not. this%is_started) then
         write(error_unit, '(A)') 'Warning: timer_resume called before timer_start.'
         return
      end if

      if (.not. this%is_paused) then
         write(error_unit, '(A)') 'Warning: timer is not paused.'
         return
      end if

      call system_clock(count=clock_now)
      pause_dt = ticks_diff(clock_now, this%pause_start, this%clock_max)
      if (pause_dt > 0_ik) this%paused_ticks = this%paused_ticks + pause_dt

      this%is_paused = .false.
   end subroutine timer_resume