print_time Subroutine

private subroutine print_time(time, message, color, rfmt, ok)

Uses

    • face
  • proc~~print_time~~UsesGraph proc~print_time print_time face face proc~print_time->face

This internal helper builds a runtime format from rfmt, colorizes the label and unit suffix with FACE, and writes to output_unit. Formatting errors are reported through error_unit; ok tells callers whether the write completed successfully.

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: time

Timing value in seconds.

character(len=*), intent(in) :: message

Label printed before time.

character(len=*), intent(in), optional :: color

Optional FACE foreground color; defaults to blue.

character(len=*), intent(in), optional :: rfmt

Optional Fortran real edit descriptor; defaults to F16.9.

logical, intent(out) :: ok

True when the formatted write completed successfully.


Calls

proc~~print_time~~CallsGraph proc~print_time print_time colorize colorize proc~print_time->colorize

Called by

proc~~print_time~~CalledByGraph proc~print_time print_time proc~finalize_timing finalize_timing proc~finalize_timing->proc~print_time proc~ctimer_stop timer%ctimer_stop proc~ctimer_stop->proc~finalize_timing proc~dtimer_stop timer%dtimer_stop proc~dtimer_stop->proc~finalize_timing proc~timer_stop timer%timer_stop proc~timer_stop->proc~finalize_timing 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_test16 run_test16 proc~run_test16->proc~ctimer_stop proc~run_test17 run_test17 proc~run_test17->proc~ctimer_stop proc~run_test18 run_test18 proc~run_test18->proc~ctimer_stop proc~run_test2 run_test2 proc~run_test2->proc~timer_stop proc~run_test25 run_test25 proc~run_test25->proc~dtimer_stop proc~run_test26 run_test26 proc~run_test26->proc~dtimer_stop proc~run_test27 run_test27 proc~run_test27->proc~dtimer_stop proc~run_test28 run_test28 proc~run_test28->proc~dtimer_stop proc~run_test29 run_test29 proc~run_test29->proc~dtimer_stop proc~run_test3 run_test3 proc~run_test3->proc~timer_stop proc~run_test30 run_test30 proc~run_test30->proc~dtimer_stop proc~run_test31 run_test31 proc~run_test31->proc~timer_stop proc~run_test32 run_test32 proc~run_test32->proc~timer_stop proc~run_test4 run_test4 proc~run_test4->proc~ctimer_stop proc~run_test5 run_test5 proc~run_test5->proc~ctimer_stop proc~run_test6 run_test6 proc~run_test6->proc~ctimer_stop program~example1 example1 program~example1->proc~timer_stop program~example2 example2 program~example2->proc~timer_stop program~example3 example3 program~example3->proc~ctimer_stop program~example4 example4 program~example4->proc~ctimer_stop program~example5 example5 program~example5->proc~dtimer_stop program~example6 example6 program~example6->proc~dtimer_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_test16 program~check->proc~run_test17 program~check->proc~run_test18 program~check->proc~run_test2 program~check->proc~run_test25 program~check->proc~run_test26 program~check->proc~run_test27 program~check->proc~run_test28 program~check->proc~run_test29 program~check->proc~run_test3 program~check->proc~run_test30 program~check->proc~run_test31 program~check->proc~run_test32 program~check->proc~run_test4 program~check->proc~run_test5 program~check->proc~run_test6

Source Code

   subroutine print_time(time, message, color, rfmt, ok)
      use face, only: colorize
      real(rk), intent(in) :: time
         !! Timing value in seconds.
      character(*), intent(in) :: message
         !! Label printed before `time`.
      character(*), intent(in), optional :: color
         !! Optional FACE foreground color; defaults to `blue`.
      character(*), intent(in), optional :: rfmt
         !! Optional Fortran real edit descriptor; defaults to `F16.9`.
      logical, intent(out) :: ok
         !! True when the formatted write completed successfully.

      character(len=:), allocatable :: color_
         !! Effective FACE color name.
      character(len=:), allocatable :: fmt
         !! Complete runtime format built from `rfmt_`.
      character(len=:), allocatable :: rfmt_
         !! Effective real edit descriptor after trimming and defaulting.
      integer :: ios
         !! I/O status returned by the formatted write.
      character(len=256) :: iomsg
         !! Diagnostic message returned by the formatted write.

      ok = .false.

      if (present(rfmt)) then
         rfmt_ = adjustl(trim(rfmt))
      else
         rfmt_ = 'F16.9'
      end if

      if (len_trim(rfmt_) == 0) then
         write(error_unit, '(A)') 'Error: rfmt must not be empty'
         return
      end if

      if (present(color)) then
         color_ = trim(color)
      else
         color_ = 'blue'
      end if

      fmt = '(A, ' // trim(rfmt_) // ', A)'
      write(output_unit, fmt, iostat=ios, iomsg=iomsg) &
         colorize(trim(message), color_fg=color_), time, colorize(' [s]', color_fg=color_)
      if (ios /= 0) then
         write(error_unit, '(A)') 'Error writing formatted time: ' // trim(iomsg)
         return
      end if

      ok = .true.
   end subroutine print_time