time_lap Function

public function time_lap() result(res)

This function is for timing purposes and returns the lap time since the last call of time_begin or time_lap.

Arguments

None

Return Value real(kind=real64)


Source Code

   function time_lap() result(res)
      implicit none
      real(real64) :: res

      if (get_os_type()== OS_WINDOWS) then
         if (is_supported) then
            is_succeeded = QueryPerformanceCounter(time_end_qhc)
            res = dble(time_end_qhc - time_begin_qhc)/dble(frequency)
            time_begin_qhc = time_end_qhc
         else
            !$ end_s = omp_get_wtime()
            !$ res = end_s - last_s
            !$ last_s = end_s
            !$ return
            call use_cpu_time_end
         end if
      else
         !$ end_s = omp_get_wtime()
         !$ res = end_s - last_s
         !$ last_s = end_s
         !$ return
         call use_cpu_time_end
      end if
   contains

      subroutine use_cpu_time_end
         implicit none
         call cpu_time(end_s)
         res = end_s - last_s
         last_s = end_s
      end subroutine use_cpu_time_end

   end function time_lap