Reputation: 255
I am working on is a website which features:
I have created all of these things and they all work how they should. How I can test the php scripts--not the load time of the page, but the actual runtime of each script on each page?
Upvotes: 1
Views: 224
Reputation: 7504
The best tool with web interface for profiling php is XHPROF. Look at http://www.mirror.facebook.net/facebook/xhprof/doc.html . However xdebug gets more accurate results than xprof. But in this case you will have to download a special program to look through xdebug report and on production this one is not applicable. Because you will download xdebug report to local machine but with xhprof you will look at profiler page in real time.
Upvotes: 1
Reputation: 2406
You'll want to invoke micro time.
At the beginning of your script:
$startTime = microtime( true );
At the end of the script, and be sure to use this variable method or else you may get a negative:
$endTime = microtime( true );
echo( "Time taken: " . ( $endTime - $startTime ) );
To get this time in miliseconds, you can do:
$parseTime = $endTime - $startTime;
$timeTaken = number_format( ( $parseTime * 1000 ), 3 );
echo( $timeTaken . "ms" );
One good way to benchmark is just take a look at the average run time of some of the more popular PHP applications. Many put parse time in the footer.
Upvotes: 7