FU_Timing Module

Tools to measure time spent by functions in Fortran programs. The user can use IntervalTime to get the time since the last measure or the time since the begining of the execution if no previous measuement is available. This point will be used as a starting point for the next interval. Use TotalTime to get the time since the beginning of the program or since the last time resetTotalTime is executed.


Uses


Contents


Interfaces

public interface TotalTime

TotalTime gets the time in seconds (with a precision of microseconds) since the beginning of the program or since the last time ResetTotalTime is executed.

You can use mold input argument to indicate the precision of the output number. Default precision is the default precision of your compiler.

Syntax

 t = TotalTime(mold)

Where:

  • mold: Real value to identify the kind of the output. Optional. It is only used to set the kind of the return value, so it can be any value.

Total time spent in seconds since the begining of the program or since the last time ResetTotalTime has been used. Uses precision set by mold.

Example

The following program prints the total time since the start of the program. A more detailed example can be found at here.

 PROGRAM totalTimeExample
    USE FU_Timing, ONLY: TotalTime
    USE FU_Prec, ONLY:dp
    IMPLICIT NONE
    WRITE(*,*) TotalTime()
    WRITE(*,*) TotalTime(1._dp)
 END PROGRAM totalTimeExample
  • private function TotalTime_def() result(res)

    Arguments

    None

    Return Value real

    Total time spent in seconds since the begining of the program or since the last time ResetTotalTime has been used. Uses default precision of the compiler used.

  • private function TotalTime_sp(mold) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: mold

    Real value to identify the kind of the output. It is only used to set the kind of the return value, so it can be any value.

    Return Value real(kind=sp)

    Total time spent in seconds since the begining of the program or since the last time ResetTotalTime has been used. Uses precision set by mold.

  • private function TotalTime_dp(mold) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: mold

    Real value to identify the kind of the output. It is only used to set the kind of the return value, so it can be any value.

    Return Value real(kind=dp)

    Total time spent in seconds since the begining of the program or since the last time ResetTotalTime has been used. Uses precision set by mold.

public interface IntervalTime

IntervalTime gets the time in seconds (with a precision of microseconds) since the last measurement or the time since the begining of the execution if no previous measuement is available. This point will be used as a starting point for the next interval. The starting point can be reset using ResetTotalTime.

You can use mold input argument to indicate the precision of the output number. Default precision is the default precision of your compiler.

Syntax

 t = IntervalTime(mold)

Where:

  • mold: Real value to identify the kind of the output. Optional. It is only used to set the kind of the return value, so it can be any value.

Time spent in seconds since the last measurement, or since the begining of the program if no previous measurement is available, or since the last time ResetTotalTime has been used. Uses precision set by mold.

Example

The following program prints the time since the start of the program and since the previous measurement. A more detailed example can be found at here.

 PROGRAM intervalTimeExample
    USE FU_Timing, ONLY: IntervalTime
    USE FU_Prec, ONLY:dp
    IMPLICIT NONE
    WRITE(*,*) IntervalTime()
    WRITE(*,*) IntervalTime(1._dp)
 END PROGRAM intervalTimeExample
  • private function IntervalTime_def() result(res)

    Arguments

    None

    Return Value real

    Time spent in seconds since the last measurement or since the begining of the program if no previous measurement is available. Uses default precision of the compiler used.

  • private function IntervalTime_sp(mold) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: mold

    Real value to identify the kind of the output. It is only used to set the kind of the return value, so it can be any value.

    Return Value real(kind=sp)

    Time spent in seconds since the last measurement or since the begining of the program if no previous measurement is available. Uses precision set by mold.

  • private function IntervalTime_dp(mold) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: mold

    Real value to identify the kind of the output. It is only used to set the kind of the return value, so it can be any value.

    Return Value real(kind=dp)

    Time spent in seconds since the last measurement or since the begining of the program if no previous measurement is available. Uses precision set by mold.


Subroutines

public subroutine ResetTotalTime()

Author
Emilio Castro.
Date
10/09/2020.
License
MIT.
Version
1.0.

Sets the starting point to count the total time.

Read more…

Arguments

None