Re: Script Execution Time
| From: | Jome | Date: | Thu, 19 Jul 2001 15:51:58 +0000 |
| Subject: | Re: Script Execution Time | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58734@lists.php.net to get a copy of this message | ||
> I have a php script that returns about 1.5Mb of data in text format to the
> user. I am wondering if there is a way for php to display the time it took
> to execute the script at the end of the file.
Put this at the top of the script:
<code>
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
</code>
..and this at the end:
<code>
$time_end = getmicrotime();
$time = $time_end - $time_start;
$foo = round ($time, 2);
echo "Execution took $foo seconds.";
</code>
Hope this helps.
Best regards,
Jome