Used to be microtime () to tinker with, do not use, the display results are not clear enough.
Remember Pear has a benchmarking class can be done, has notTimeTry, and finally just tried, very easy to use, hehe
Install Benchmarking First
Pear Install benchmarking# the command line installation benchmarking
There are 3 PHP in benchmarkingfile, respectively:
Benchmark_timer the most basic class in this package. Perform a simplefunctionTo record the total time and the setCodeFragment time.
Benchmark_profiler is like the Benchmark_timer allows you to specify any node between the start and the end. He also provides a way to indicate the number and time of a function's execution through an inline timer.
Benchmark_iterate This is kind of likeMySQLInside the benchmark () function. Executes n times on a piece of code (typically a function), recording each and every execution time.
Example of the previous Benchmark_timer
<?php
Require_once "benchmark/timer.php";
$timer = new Benchmark_timer (TRUE);//contains class files,instanceof class
$timer->start ()/Start timing
Echo Php_sapi_name ();
$timer->setmarker (' Midway ');//Set breakpoints and names
Echo Php_uname ();
EchoPHP_os;
$timer->stop ()//Stop timing
$timer->display ()//Display results
?>
The results are similar to the following display
----------------------------------------------------
Marker Time Index ex-time PERCT
----------------------------------------------------
Start 1182558324.48638900-0.00%
----------------------------------------------------
Midway 1182558324.48655800 0.000169 62.13%
----------------------------------------------------
Stop 1182558324.48666100 0.000103 37.87%
----------------------------------------------------
total-0.000272 100%
----------------------------------------------------the rest of the talk, I read the manual