forgex_cli_time_measurement_m Module

This module provides procedures to measure the time it takes to execute. cf. https://qiita.com/implicit_none/items/86c9117990798c1e8b3b



Variables

Type Visibility Attributes Name Initial
real(kind=real64), private :: begin_s
real(kind=real64), private :: end_s
integer(kind=c_long_long), private :: frequency
logical(kind=c_bool), private :: is_succeeded = .false.
logical(kind=c_bool), private :: is_supported = .false.
real(kind=real64), private :: last_s
integer(kind=c_long_long), private :: time_begin_qhc
integer(kind=c_long_long), private :: time_end_qhc

Interfaces

interface

For Windows, use high-resolution system call for timing.

  • private function QueryPerformanceCounter(PerformanceCount_count) result(is_succeeded_c) bind(c, name="QueryPerformanceCounter")

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=c_long_long), intent(out) :: PerformanceCount_count

    Return Value logical(kind=c_bool)

interface

For Windows, use high-resolution system call for timing.

  • private function QueryPerformanceFrequency(Frequency_countPerSec) result(is_supported_c) bind(c, name="QueryPerformanceFrequency")

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=c_long_long), intent(out) :: Frequency_countPerSec

    Return Value logical(kind=c_bool)


Functions

public function get_lap_time_in_appropriate_unit(lap_time) result(res)

This function takes a real number of seconds, converts it to the appropriate units, and returns a string with the unit for output.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: lap_time

Return Value character(len=NUM_DIGIT_TIME)

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)


Subroutines

public subroutine time_begin()

This subroutine is for timing purpose and starts a stopwatch.

Arguments

None