Re: Script Execution Time
| From: | Petya A Shushpanov | Date: | Mon, 28 Jul 2003 22:41:11 +0000 |
| Subject: | Re: Script Execution Time | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157253@lists.php.net to get a copy of this message | ||
<?
class jTimer {
var $start = 0;
var $stop = 0;
var $elapsed = 0;
function start() { $this->start = microtime(); }
function stop() { $this->stop = microtime(); }
function elapsed() {
if ($this->elapsed) {
return $this->elapsed;
} else {
$start_u = substr($this->start,0,10);
$start_s = substr($this->start,11,10);
$stop_u = substr($this->stop,0,10);
$stop_s = substr($this->stop,11,10);
$start_total = doubleval($start_u) + $start_s;
$stop_total = doubleval($stop_u) + $stop_s;
$this->elapsed = $stop_total - $start_total;
return $this->elapsed;
}
}
}
$timer = new jTimer;
$timer->start();
#your code here
$timer->stop();
echo round($timer->elapsed(),5);
?>
--
Petya A Shushpanov
tel.: (+7 916) 556 16 27
mail: shpa@eastof.ru
site: www.eastof.ru
----- Original Message -----
From: "Radek Zajkowski" <radekz@rogers.com>
To: "PHP GENERAL" <php-general@lists.php.net>
Sent: Tuesday, July 29, 2003 1:09 AM
Subject: [PHP] Script Execution Time
> Could someone pass on a snippet, a function or a technique for measuring
> script times. It appears the host I am with is having some PHP engine
> performance problems and I need to send them the figures.