High resolution timing

目录

简介

类摘要

HRTime\PerformanceCounter

class HRTime\PerformanceCounter {

/* 方法 */

public static int getFrequency ( void )

public static int getTicks ( void )

public static int getTicksSince ( int $start )

}

HRTime\PerformanceCounter::getFrequency

Timer frequency in ticks per second

说明

public static int HRTime\PerformanceCounter::getFrequency ( void )

Returns the timer frequency in ticks per second. This value is constant after the system start on almost any operating system.

参数

此函数没有参数。

返回值

Returns integer indicating the timer frequency.

HRTime\PerformanceCounter::getTicks

Current ticks from the system

说明

public static int HRTime\PerformanceCounter::getTicks ( void )

Returns the ticks count.

参数

此函数没有参数。

返回值

Returns integer indicating the ticks count.

HRTime\PerformanceCounter::getTicksSince

Ticks elapsed since the given value

说明

public static int HRTime\PerformanceCounter::getTicksSince ( int $start )

Returns the ticks count elapsed since the given start value.

参数

start
Starting ticks value.

返回值

Returns integer indicating the ticks count.

简介

类摘要

HRTime\StopWatch

class HRTime\StopWatch extends HRTime\PerformanceCounter {

/* 方法 */

public int getElapsedTicks ( void )

public float getElapsedTime ([ int $unit ] )

public int getLastElapsedTicks ( void )

public float getLastElapsedTime ([ int $unit ] )

public bool isRunning ( void )

public void start ( void )

public void stop ( void )

/* 继承的方法 */

public static int HRTime\PerformanceCounter::getFrequency ( void )

public static int HRTime\PerformanceCounter::getTicks ( void )

public static int HRTime\PerformanceCounter::getTicksSince ( int $start )

}

HRTime\StopWatch::getElapsedTicks

Get elapsed ticks for all intervals

说明

public int HRTime\StopWatch::getElapsedTicks ( void )

Get elapsed ticks for all the previously closed intervals.

参数

此函数没有参数。

返回值

Returns integer indicating elapsed ticks.

HRTime\StopWatch::getElapsedTime

Get elapsed time for all intervals

说明

public float HRTime\StopWatch::getElapsedTime ([ int $unit ] )

Get elapsed time for all the previously closed intervals.

参数

unit
Time unit represented by a HRTime\Unit constant. Default is HRTime\Unit::SECOND.

返回值

Returns float indicating elapsed time.

HRTime\StopWatch::getLastElapsedTicks

Get elapsed ticks for the last interval

说明

public int HRTime\StopWatch::getLastElapsedTicks ( void )

Get elapsed ticks for the previously closed interval.

参数

此函数没有参数。

返回值

Returns integer indicating elapsed ticks.

HRTime\StopWatch::getLastElapsedTime

Get elapsed time for the last interval

说明

public float HRTime\StopWatch::getLastElapsedTime ([ int $unit ] )

Get elapsed time for the previously closed interval.

参数

unit
Time unit represented by a HRTime\Unit constant. Default is HRTime\Unit::SECOND.

返回值

Returns float indicating elapsed time.

HRTime\StopWatch::isRunning

Whether the measurement is running

说明

public bool HRTime\StopWatch::isRunning ( void )

Reveals whether the measurement was started.

参数

此函数没有参数。

返回值

Returns boolean indicating whetehr the measurement is running.

HRTime\StopWatch::start

Start time measurement

说明

public void HRTime\StopWatch::start ( void )

Starts the time measurement. It has no effect if the measurement was already started. The measurement will be continued if it was previously stopped.

参数

此函数没有参数。

返回值

Returns void.

HRTime\StopWatch::stop

Stop time measurement

说明

public void HRTime\StopWatch::stop ( void )

Stop the time measurement for the previously started interval.

参数

此函数没有参数。

返回值

Returns void.

简介

类摘要

HRTime\Unit

class HRTime\Unit {

/* Constants */

const integer HRTime\Unit::SECOND = 0 ;

const integer HRTime\Unit::MILLISECOND = 1 ;

const integer HRTime\Unit::MICROSECOND = 2 ;

const integer HRTime\Unit::NANOSECOND = 3 ;

/* 方法 */

}

预定义常量

HRTime\Unit::SECOND

HRTime\Unit::MILLISECOND

HRTime\Unit::MICROSECOND

HRTime\Unit::NANOSECOND