timer_start Subroutine

private subroutine timer_start(this)

timer_start resets the pause state, caches system_clock metadata when needed, validates that the clock rate can be converted to seconds, and then captures the start tick. The matching stop routine is timer_stop.

Type Bound

timer

Arguments

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

Timer instance whose wall-clock state is initialized.


Called by

proc~~timer_start~~CalledByGraph proc~timer_start timer%timer_start proc~run_test1 run_test1 proc~run_test1->proc~timer_start proc~run_test13 run_test13 proc~run_test13->proc~timer_start proc~run_test14 run_test14 proc~run_test14->proc~timer_start proc~run_test15 run_test15 proc~run_test15->proc~timer_start proc~run_test2 run_test2 proc~run_test2->proc~timer_start proc~run_test3 run_test3 proc~run_test3->proc~timer_start proc~run_test31 run_test31 proc~run_test31->proc~timer_start proc~run_test32 run_test32 proc~run_test32->proc~timer_start program~example1 example1 program~example1->proc~timer_start program~example2 example2 program~example2->proc~timer_start 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

   subroutine timer_start(this)
      class(timer), intent(inout) :: this
         !! Timer instance whose wall-clock state is initialized.

      this%is_started = .true.
      this%is_paused = .false.
      this%paused_ticks = 0_ik

      if (this%clock_rate <= 0_ik .or. this%clock_max <= 0_ik) then
         call system_clock(count_rate=this%clock_rate, count_max=this%clock_max)
      end if

      if (this%clock_rate <= 0_ik) then
         write(error_unit, '(A)') 'Error: system_clock count_rate <= 0; timer unavailable on this platform.'
         this%is_started = .false.
         return
      end if

      call system_clock(count=this%clock_start)
   end subroutine timer_start