Вот простейший скрипт
<?
class timer {
var $start_time = 0;
var $stop_time = 0;
var $elapsed_time = 0;
function start()
{
$this->start_time = $this->getmicrotime();
}
function stop()
{
$this->stop_time = $this->getmicrotime();
if (function_exists('bcsub')) $this->elapsed_time = bcsub($this->stop_time,$this->start_time,6);
else $this->elapsed_time = $this->stop_time-$this->start_time;
return $this->elapsed_time;
}
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
}
$timer = new timer();
?>
в своем скрипте просто $timer->start(); $timer->stop();
и $timer->elapsed_time;