timer_print_time Subroutine

private subroutine timer_print_time(self)

Prints the elapsed time at the time of calling

Usage: call my_timer%print_time()

Needs my_timer to be declared previously as type(pic_timer_type) :: my_timer

This function does not stop the timer, it will get the current time elapsed stopped or not

Type Bound

pic_timer_type

Arguments

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

Calls

proc~~timer_print_time~~CallsGraph proc~timer_print_time pic_timer_type%timer_print_time interface~to_string to_string proc~timer_print_time->interface~to_string proc~timer_get_elapsed_time pic_timer_type%timer_get_elapsed_time proc~timer_print_time->proc~timer_get_elapsed_time proc~to_string_char to_string_char interface~to_string->proc~to_string_char proc~to_string_dp to_string_dp interface~to_string->proc~to_string_dp proc~to_string_int32 to_string_int32 interface~to_string->proc~to_string_int32 proc~to_string_int64 to_string_int64 interface~to_string->proc~to_string_int64 proc~to_string_logical to_string_logical interface~to_string->proc~to_string_logical proc~to_string_sp to_string_sp interface~to_string->proc~to_string_sp

Variables

Type Visibility Attributes Name Initial
real(kind=dp), private :: elapsed

Source Code

   subroutine timer_print_time(self)
      !! Prints the elapsed time at the time of calling
      !!
      !! Usage: call my_timer%print_time()
      !!
      !! Needs my_timer to be declared previously as type(pic_timer_type) :: my_timer
      !!
      !! This function does not stop the timer, it will get the current time elapsed stopped or not
      class(pic_timer_type), intent(in) :: self
      real(dp) :: elapsed

      elapsed = self%get_elapsed_time()
      if (self%is_running) then
         print *, "Currently elapsed time: "//to_string(elapsed)//" seconds"
      else
         print *, "Elapsed time: "//to_string(elapsed)//" seconds"
      end if
   end subroutine timer_print_time