コード例 #1
0
ファイル: Timer.php プロジェクト: nochso/benchmark
 /**
  * @return float The time it took to execute in milliseconds
  */
 private function measure()
 {
     $closure = $this->method->getMethod();
     if ($this->parameter !== null) {
         // Make sure getParameter() won't be measured.
         $parameterValue = $this->parameter->getParameter();
         $start = microtime(true);
         $closure($this->iterationCount, $parameterValue);
         return (microtime(true) - $start) * 1000.0;
     }
     // Have to omit the parameter because the closure won't accept it.
     $start = microtime(true);
     $closure($this->iterationCount);
     return (microtime(true) - $start) * 1000.0;
 }