Re: Benchmark single page
| From: | Floyd Piedad | Date: | Thu, 22 Mar 2001 01:53:00 +0000 |
| Subject: | Re: Benchmark single page | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45052@lists.php.net to get a copy of this message | ||
Hi Jason,
At the very start of the page to be outputted, even before the HTML tags, put this in.
<? php
$time = microtime();
$time = explode(" ",$time);
$microtime = $time[1]+$time[0];
$transaction_start = $microtime;
?>
Then at the very bottom of the generated page, before the </BODY></HTML> tag:
<? php
$newtime = microtime();
$newtime = explode(" ",$newtime);
$newmicrotime = $newtime[1]+$newtime[0];
$elapsed_time = number_format(($newmicrotime - $transaction_start),3);
echo "Transaction completed in ".$elapsed_time." seconds!"
?>
This takes into account all of the php codes executed to generate all the contents inbetween these
two sections, including database extractions.
Regards,
Floyd Piedad
Jason Granum wrote:
> I'm wanting to benchmark a single PHP page to the millisecond (if possible) that basicly
> just will put a
>
> This page generated in X.XXX seconds
>
> at the bottom of every page.
>
> I've tried looking through the past messages on the group but havn't found any
> threads relating to this. Anyone have any ideas of how to do this simple thing simply?
>
> Thanks