Book/hrtime-Phpdoc专题
High resolution timing
目录
- 简介
- 安装/配置
- 范例
- HRTime\PerformanceCounter
— The HRTime\PerformanceCounter class
- HRTime\PerformanceCounter::getFrequency — Timer frequency in ticks per second
- HRTime\PerformanceCounter::getTicks — Current ticks from the system
- HRTime\PerformanceCounter::getTicksSince — Ticks elapsed since the given value
- HRTime\StopWatch — The
HRTime\StopWatch class
- HRTime\StopWatch::getElapsedTicks — Get elapsed ticks for all intervals
- HRTime\StopWatch::getElapsedTime — Get elapsed time for all intervals
- HRTime\StopWatch::getLastElapsedTicks — Get elapsed ticks for the last interval
- HRTime\StopWatch::getLastElapsedTime — Get elapsed time for the last interval
- HRTime\StopWatch::isRunning — Whether the measurement is running
- HRTime\StopWatch::start — Start time measurement
- HRTime\StopWatch::stop — Stop time measurement
- HRTime\Unit — The HRTime\Unit class
简介
类摘要
HRTime\PerformanceCounter
class HRTime\PerformanceCounter {
/* 方法 */
public <span class="modifier">static int <span class="methodname">getFrequency ( <span class="methodparam">void )
public <span class="modifier">static int <span class="methodname">getTicks ( <span class="methodparam">void )
public <span
class="modifier">static int <span
class="methodname">getTicksSince ( <span
class="methodparam">int $start )
}
HRTime\PerformanceCounter::getFrequency
Timer frequency in ticks per second
说明
public <span class="modifier">static int <span class="methodname">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 int indicating the timer frequency.
HRTime\PerformanceCounter::getTicks
Current ticks from the system
说明
public <span class="modifier">static int <span class="methodname">HRTime\PerformanceCounter::getTicks ( <span class="methodparam">void )
Returns the ticks count.
参数
此函数没有参数。
返回值
Returns int indicating the ticks count.
HRTime\PerformanceCounter::getTicksSince
Ticks elapsed since the given value
说明
public <span
class="modifier">static int <span
class="methodname">HRTime\PerformanceCounter::getTicksSince (
int $start
)
Returns the ticks count elapsed since the given start value.
参数
start
Starting ticks value.
返回值
Returns int indicating the ticks count.
简介
类摘要
HRTime\StopWatch
class HRTime\StopWatch <span class="ooclass"> extends HRTime\PerformanceCounter {
/* 方法 */
public int <span class="methodname">getElapsedTicks ( <span class="methodparam">void )
public float
getElapsedTime ([ <span
class="methodparam">int $unit ] )
public int <span class="methodname">getLastElapsedTicks ( <span class="methodparam">void )
public float
getLastElapsedTime ([ <span
class="methodparam">int $unit ] )
public bool isRunning ( <span class="methodparam">void )
public void start ( <span class="methodparam">void )
public void stop ( <span class="methodparam">void )
/* 继承的方法 */
public <span class="modifier">static int <span class="methodname">HRTime\PerformanceCounter::getFrequency ( void )
public <span class="modifier">static int <span class="methodname">HRTime\PerformanceCounter::getTicks ( <span class="methodparam">void )
public <span
class="modifier">static int <span
class="methodname">HRTime\PerformanceCounter::getTicksSince (
int $start
)
}
HRTime\StopWatch::getElapsedTicks
Get elapsed ticks for all intervals
说明
public int <span class="methodname">HRTime\StopWatch::getElapsedTicks ( <span class="methodparam">void )
Get elapsed ticks for all the previously closed intervals.
参数
此函数没有参数。
返回值
Returns int 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 <span class="methodname">HRTime\StopWatch::getLastElapsedTicks ( <span class="methodparam">void )
Get elapsed ticks for the previously closed interval.
参数
此函数没有参数。
返回值
Returns int 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 ( <span class="methodparam">void )
Reveals whether the measurement was started.
参数
此函数没有参数。
返回值
Returns bool indicating whetehr the measurement is running.
HRTime\StopWatch::start
Start time measurement
说明
public void HRTime\StopWatch::start ( <span class="methodparam">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 ( <span class="methodparam">void )
Stop the time measurement for the previously started interval.
参数
此函数没有参数。
返回值
Returns void.
简介
类摘要
HRTime\Unit
class HRTime\Unit {
/* Constants */
const int
HRTime\Unit::SECOND = 0 ;
const int
HRTime\Unit::MILLISECOND = 1 ;
const int
HRTime\Unit::MICROSECOND = 2 ;
const int
HRTime\Unit::NANOSECOND = 3 ;
/* 方法 */
}
预定义常量
HRTime\Unit::SECOND
HRTime\Unit::MILLISECOND
HRTime\Unit::MICROSECOND
HRTime\Unit::NANOSECOND