The following are how to measure execution time of your PHP script. The script should take enough time for which the time of the measurement itself is inconsequential.
PHP スクリプトの実行時間を計測する方法。計測対象処理はそれなりの長さにしないといけないけどね。
- time command
% time php [your script].php
-
Use PHP: microtime - Manual
$start=microtime(true); // for PHP5 // for PHP4. use microtime_float() described in the manual /* do your codes */ $elapsed_time=microtime(true)-$start;
- or use PEAR :: Package :: Benchmark
require_once('Benchmark/Timer.php'); $timer=new Benchmark_Timer(true); // do something
The Benchmark package seems useful for various measurements.