/** * @param Method $method * * @return Result */ public function getAverageMethodResult(Method $method) { $opsPer = 0; $count = 0; foreach ($this->results[$method->getName()] as $result) { $opsPer += $result->getOperationsPerSecond(); $count++; } $opsPer = $opsPer / $count; $duration = 1 / $opsPer * 1000; $operations = 1; $averageResult = new Result($duration, $operations, $method, new Parameter(null, 'Average')); return $averageResult; }
/** * @param Method $method */ private function fetchMethodResults(Method $method) { $params = $this->params; if (count($params) === 0) { $params[] = null; } foreach ($params as $paramKey => $parameter) { $this->notifyText($method->getName() . ' / ' . $parameter->getName()); $result = $method->time($parameter); $this->result->add($result); $this->notifyProgress(); } }