<?
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: [EMAIL PROTECTED]
site: www.eastof.ru

----- Original Message ----- 
From: "Radek Zajkowski" <[EMAIL PROTECTED]>
To: "PHP GENERAL" <[EMAIL PROTECTED]>
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.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to