getSubject() public method

Return the subject metadata.
public getSubject ( ) : Subject
return Subject
コード例 #1
0
ファイル: PhpBenchLogger.php プロジェクト: dantleech/phpbench
 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));
 }
コード例 #2
0
ファイル: VerboseLogger.php プロジェクト: dantleech/phpbench
 /**
  * {@inheritdoc}
  */
 public function variantEnd(Variant $variant)
 {
     if ($variant->hasErrorStack()) {
         $this->output->write(sprintf("    %-30s<error>ERROR</error>", $variant->getSubject()->getName()));
         $this->output->write(PHP_EOL);
         return;
     }
     $this->output->write(sprintf("\t%s", $this->formatIterationsFullSummary($variant)));
     $this->output->write(PHP_EOL);
 }
コード例 #3
0
ファイル: TravisLogger.php プロジェクト: dantleech/phpbench
 /**
  * {@inheritdoc}
  */
 public function variantEnd(Variant $variant)
 {
     if ($variant->getRejectCount() > 0) {
         return;
     }
     $subject = $variant->getSubject();
     if ($variant->hasErrorStack()) {
         $this->output->writeln(sprintf('    t%-30s <error>ERROR</error>', $subject->getName()));
         return;
     }
     $this->output->writeln(sprintf("    %-30s I%s P%s\t%s", $subject->getName(), $variant->count(), $variant->getParameterSet()->getIndex(), $this->formatIterationsFullSummary($variant)));
 }
コード例 #4
0
ファイル: AnsiLogger.php プロジェクト: dantleech/phpbench
 protected function renderCollectionStatus(Variant $variant)
 {
     $this->output->write(PHP_EOL);
     $this->output->write("");
     // clear the line
     $this->output->write(PHP_EOL);
     $this->output->write(sprintf('<info>subject</info> %s<info> with </info>%s<info> iteration(s) of </info>%s<info> rev(s),</info>', sprintf('%s', $variant->getSubject()->getName()), count($variant), $variant->getRevolutions()));
     $this->output->write(PHP_EOL);
     $this->output->write(sprintf('<info>parameters</info> %s', json_encode($variant->getParameterSet()->getArrayCopy(), true)));
     $this->output->write(PHP_EOL);
     $this->output->write("[" . 4 . 'A');
     // put the cursor back to the line with the measurements
     $this->output->write("");
     // put the cursor back at col 0
 }
コード例 #5
0
 private function drawIterations(Variant $variant)
 {
     $subject = $variant->getSubject();
     $this->output->write("");
     // clear the whole line
     $this->output->write(PHP_EOL);
     $this->output->write("");
     // clear the whole line
     $this->output->write("");
     $sigma = 2;
     $bins = 16;
     if ($variant->isComputed()) {
         $times = $variant->getMetricValues(ComputedResult::class, 'z_value');
         $stats = $variant->getStats();
         $freqs = Statistics::histogram($times, $bins, -$sigma, $sigma);
     } else {
         $stats = new Distribution([0]);
         $freqs = array_fill(0, $bins + 1, null);
     }
     $this->output->write(sprintf('#%-2d (σ = %s ) -%sσ [', $subject->getIndex(), $this->timeUnit->format($stats->getStdev()), $sigma));
     $this->drawBlocks($freqs, $stats);
     $this->output->write(sprintf('] +%sσ <comment>%s</comment>', $sigma, $variant->isComputed() ? $this->formatIterationsShortSummary($variant) : ''));
     $this->output->write(PHP_EOL);
 }
コード例 #6
0
ファイル: BlinkenLogger.php プロジェクト: dantleech/phpbench
 private function drawIterations(Variant $variant, array $specials, $tag)
 {
     $this->output->write("");
     // clear line
     $timeUnit = $variant->getSubject()->getOutputTimeUnit();
     $outputMode = $variant->getSubject()->getOutputMode();
     $lines = [];
     $line = sprintf('%-' . self::INDENT . 's', '#' . $variant->getSubject()->getIndex());
     $nbIterations = $variant->count();
     for ($index = 0; $index < $nbIterations; $index++) {
         $iteration = $variant->getIteration($index);
         $displayTime = $this->formatIterationTime($iteration);
         if (isset($specials[$iteration->getIndex()])) {
             $displayTime = sprintf('<%s>%' . $this->colWidth . 's</%s>', $tag, $displayTime, $tag);
         }
         $line .= $displayTime;
         if ($index > 0 && $index < $nbIterations - 1 && ($index + 1) % self::NUMBER_COLS == 0) {
             $lines[] = $line;
             $line = str_repeat(' ', self::INDENT);
         }
     }
     $lines[] = $line;
     $this->currentLine = count($lines) - 1;
     $output = trim(implode(PHP_EOL, $lines));
     $output .= sprintf(' (%s)', $this->timeUnit->getDestSuffix($this->timeUnit->resolveDestUnit($timeUnit), $this->timeUnit->resolveMode($outputMode)));
     $this->output->write(sprintf("%s", $output));
     // clear rest of the line
 }