RE: [PHP-WIN] MySQL Query from PHP - CPU Cost?
| From: | Ross Fleming | Date: | Tue, 07 May 2002 18:47:02 +0000 |
| Subject: | RE: [PHP-WIN] MySQL Query from PHP - CPU Cost? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13603@lists.php.net to get a copy of this message | ||
Simple, get the time before you execute the script, the time after, and
subtract. You may find it more accurate to do an average though (ie, loop x
times and divide the time taken by x)
Ross
<?
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
// your script/query here
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Executed script in $time seconds";
?>
-----Original Message-----
From: Matt Babineau [mailto:mbabineau@illuminatistudios.com]
Sent: 07 May 2002 14:53
To: 'Php-Win (E-mail)'
Subject: [PHP-WIN] MySQL Query from PHP - CPU Cost?
Is there a way to get the cost in cpu cycles or the milliseconds it
takes to process a query and output that statistic in PHP? Or maybe the
processing time of the whole page?
Matt Babineau
Freelance Internet Developer
-----------------------------------------
e: <mailto:mbabineau@illuminatistudios.com>
mbabineau@illuminatistudios.com
p: 603.943.4237
w: <http://www.illuminatistudios.com/> http:/www.illuminatistudios.com