コード例 #1
0
ファイル: Result.php プロジェクト: nochso/benchmark
 public function getNormalizedOperationsPerUnit(UnitResult $unitResult)
 {
     $allResults = Arrays::flatten($unitResult->getResults());
     $minOpsPerSec = PHP_INT_MAX;
     /** @var Result $result */
     foreach ($allResults as $result) {
         $minOpsPerSec = min($minOpsPerSec, $result->getOperationsPerSecond());
     }
     $opsPerUnit = $this->getOperationsPerSecond();
     $unit = 's';
     if ($minOpsPerSec < 1) {
         $minOpsPerSec *= 60;
         $opsPerUnit *= 60;
         $unit = 'm';
     }
     if ($minOpsPerSec < 1) {
         $opsPerUnit *= 60;
         $unit = 'h';
     }
     return $this->formatNumber($opsPerUnit) . '/' . $unit;
 }