Hi, I am thinking of proposing a class for measuring how much time different parts of scripts take. This would ofcourse be based on the microtime() function. The class could look somthing like this:
Profiler.php class Zend_Profiler { private $_points = array(); private $_start; public function __construct(){ $this->_start = microtime(true); } public function mark($name=''){ $trace = debug_backtrace(); $this->_points[] = new Zend_Profiler_Point($trace[0]['file'],$trace[0]['line'],$name); } public function getPoints(){ return $this->_points; } public function total(){ return microtime(true) - $this->_start; } } Point.php class Zend_Profiler_Point { public $file; public $line; public $time; public $name; public function __construct($file,$line,$name=''){ $this->time = microtime(true); $this->file = $file; $this->line = $line; $this->name = $name; } } My own thoughts/doubts are: Should it be called Profiler? (Alternatives Benchmark, Timer) Is the use of debug_backtrace() to log where the point was added a good idear, or should it only use the "point name"? Is the use of a Point object overkill, or should it simply be an array? Should it have public getters and private fields insted, thereby making it read only? So what are your thoughts? -- View this message in context: http://www.nabble.com/Proposal-Zend_Profiler--tf2689807s16154.html#a7500787 Sent from the Zend Framework mailing list archive at Nabble.com.