All pastes #839455 Raw Edit

Stuff

public php v1 · immutable
#839455 ·published 2007-12-31 00:59 UTC
rendered paste body
<?php    class Benchmark    {        var $marks = array();                function mark($name)        {            $this->marks[$name] = microtime();        }                function calculate( $aName, $bName='', $decimals=4)        {            $aTime = $this->marks[$aName];            $bTime = $this->marks[$bName];                        if (!isset($aTime))            {                return '';            }                        if (!isset($bTime))            {                $bTime = microtime();            }                        list($sm, $ss) = explode(" ", $aTime);            list($em, $es) = explode(" ", $bTime);                        return number_format(($em + $es) - ($sm + $ss), $decimals);        }    }