How to calculate time required by PHP file to open using wget?
I want to find out the time required by a php file to open(download) inside a Perl script.开发者_开发技巧 I want to use wget here.
You could use microtime
to calculate the time:
/**
* Simple function to replicate PHP 5 behaviour
*/
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
// do stuff
$time_end = microtime_float();
$time = $time_end - $time_start;
echo "Execution time was $time seconds\n";
精彩评论