<?php
class mixBenchmark{
protected $markPoint;
public function __construct(){
$this->markPoint = array();
$this->markPoint["start"] = microtime(true);
}
public function addMark($mark){
$this->markPoint[$mark] = microtime(true);
return $this;
}
public function getRunTime($mark){
return abs($this->markPoint[$mark] - $this->markPoint["start"]);
}
public function getInterval($mark1, $mark2){
return abs($this->markPoint[$mark1] - $this->markPoint[$mark2]);
}
public function dumpReport(){
if (count($this->markPoint) > 0){
foreach ($this->markPoint AS $mark => $time){
echo $mark . " Runtime:" . $this->getRunTime($mark) . "\r\n";
}
}
}
}
?>