class profiler
{
public $start_time;
public $debugMode;
function start($debugMode=false)
{
        $t = microtime(true);
        $this->start_time=$t;
        $this->debugMode=$debugMode;
}
 
function stamp($stampName) 
{
        $t = microtime(true);
        $stampTime=$t-$this->start_time;
        if ($debugMode)
        {
                echo("## $stampName completed in $stampTime seconds ##");
        }
        $this->start_time=$t;
}
}
$profile = new profiler;
$profile->start();
 
code code code
 
$profile->stamp('some descriptive text here');
 
more code code code
 
$profile->stamp('more  descriptive text here');