©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
The example illustrates the basic StopWatch class usage
Example #1 Measure several code blocks execution and get the total
<?php
$c = new HRTime \ StopWatch ;
$c -> start ();
for ( $i = 0 ; $i < 1024 * 1024 ; $i ++);
$c -> stop ();
$elapsed0 = $c -> getLastElapsedTime ( HRTime \ Unit :: NANOSECOND );
for ( $i = 0 ; $i < 1024 * 1024 ; $i ++);
$c -> start ();
for ( $i = 0 ; $i < 1024 * 1024 ; $i ++);
$c -> stop ();
$elapsed1 = $c -> getLastElapsedTime ( HRTime \ Unit :: NANOSECOND );
$elapsed_total = $c -> getElapsedTime ( HRTime \ Unit :: NANOSECOND );
?>