ticks_diff Function

private pure function ticks_diff(t_end, t_start, t_max) result(dt)

The routine handles a single system_clock wrap when t_max is positive. If t_max is unavailable or non-positive, the routine falls back to direct subtraction because wrap-safe reconstruction is not possible. The function result, dt, is the tick distance from t_start to t_end.

Arguments

Type IntentOptional Attributes Name
integer(kind=ik), intent(in) :: t_end

End tick captured from system_clock.

integer(kind=ik), intent(in) :: t_start

Start tick captured from system_clock.

integer(kind=ik), intent(in) :: t_max

Maximum count returned by system_clock; non-positive means unknown.

Return Value integer(kind=ik)


Called by

proc~~ticks_diff~~CalledByGraph proc~ticks_diff ticks_diff proc~timer_resume timer%timer_resume proc~timer_resume->proc~ticks_diff proc~timer_stop timer%timer_stop proc~timer_stop->proc~ticks_diff proc~run_test1 run_test1 proc~run_test1->proc~timer_stop proc~run_test13 run_test13 proc~run_test13->proc~timer_stop proc~run_test14 run_test14 proc~run_test14->proc~timer_stop proc~run_test15 run_test15 proc~run_test15->proc~timer_stop proc~run_test2 run_test2 proc~run_test2->proc~timer_stop proc~run_test3 run_test3 proc~run_test3->proc~timer_stop proc~run_test31 run_test31 proc~run_test31->proc~timer_resume proc~run_test31->proc~timer_stop proc~run_test32 run_test32 proc~run_test32->proc~timer_stop program~example1 example1 program~example1->proc~timer_stop program~example2 example2 program~example2->proc~timer_stop program~check check program~check->proc~run_test1 program~check->proc~run_test13 program~check->proc~run_test14 program~check->proc~run_test15 program~check->proc~run_test2 program~check->proc~run_test3 program~check->proc~run_test31 program~check->proc~run_test32

Source Code

   pure integer(ik) function ticks_diff(t_end, t_start, t_max) result(dt)
      integer(ik), intent(in) :: t_end
         !! End tick captured from `system_clock`.
      integer(ik), intent(in) :: t_start
         !! Start tick captured from `system_clock`.
      integer(ik), intent(in) :: t_max
         !! Maximum count returned by `system_clock`; non-positive means unknown.

      if (t_max > 0_ik) then
         if (t_end >= t_start) then
            dt = t_end - t_start
         else
            dt = (t_max - t_start + 1_ik) + t_end
         end if
      else
         dt = t_end - t_start
      end if
   end function ticks_diff