PhpBench\Model\Variant::getStats PHP Method

getStats() public method

See self::$stats. TODO: Rename to getDistribution
public getStats ( ) : Distribution
return PhpBench\Math\Distribution
    public function getStats()
    {
        if (null !== $this->errorStack) {
            throw new \RuntimeException(sprintf('Cannot retrieve stats when an exception was encountered ([%s] %s)', $this->errorStack->getTop()->getClass(), $this->errorStack->getTop()->getMessage()));
        }
        if (false === $this->computed) {
            throw new \RuntimeException('No statistics have yet been computed for this iteration set (::computeStats should be called)');
        }
        return $this->stats;
    }

Usage Example

Exemplo n.º 1
0
 public function formatIterationsShortSummary(Variant $variant)
 {
     $subject = $variant->getSubject();
     $stats = $variant->getStats();
     $timeUnit = $this->timeUnit->resolveDestUnit($variant->getSubject()->getOutputTimeUnit());
     $mode = $this->timeUnit->resolveMode($subject->getOutputMode());
     $precision = $this->timeUnit->resolvePrecision($subject->getOutputTimePrecision());
     return sprintf('[μ Mo]/r: %s %s μRSD/r: %s%%', $this->timeUnit->format($stats->getMean(), $timeUnit, $mode, $precision, false), $this->timeUnit->format($stats->getMode(), $timeUnit, $mode, $precision, false), number_format($stats->getRstdev(), 2));
 }
All Usage Examples Of PhpBench\Model\Variant::getStats