Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function iterationsEnd(IterationCollection $iterations)
 {
     if ($iterations->getRejectCount() > 0) {
         return;
     }
     $subject = $iterations->getSubject();
     if ($iterations->hasException()) {
         $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(), $iterations->count(), $iterations->getParameterSet()->getIndex(), $this->formatIterationsFullSummary($iterations)));
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function iterationsEnd(IterationCollection $iterations)
 {
     if ($iterations->getRejectCount() > 0) {
         return;
     }
     $subject = $iterations->getSubject();
     if ($iterations->hasException()) {
         $this->output->writeln(sprintf("\t%-30s <error>ERROR</error>", $subject->getName()));
         return;
     }
     $stats = $iterations->getStats();
     $timeUnit = $subject->getOutputTimeUnit();
     $outputMode = $subject->getOutputMode();
     $this->output->writeln(sprintf("\t%-30s I%s P%s\tμ/r: %s\tμSD/r %s\tμRSD/r: %s%%", $subject->getName(), $iterations->count(), $iterations->getParameterSet()->getIndex(), $this->timeUnit->format($stats['mean'], $timeUnit, $outputMode), $this->timeUnit->format($stats['stdev'], $timeUnit, TimeUnit::MODE_TIME), number_format($stats['rstdev'], 2)));
 }
Пример #3
0
 private function drawIterations(IterationCollection $collection, $specials, $tag, $current = null)
 {
     $subject = $collection->getSubject();
     $timeUnit = $subject->getOutputTimeUnit();
     $outputMode = $subject->getOutputMode();
     $this->output->write("");
     // put cursor at column 0
     $this->output->write(sprintf('#%-2s', $subject->getIndex()));
     $padding = 1;
     $depth = 0;
     for ($index = 0; $index < $collection->count(); $index++) {
         $otherIteration = $collection->getIteration($index);
         $time = 0;
         if ($otherIteration->hasResult()) {
             $time = $otherIteration->getResult()->getTime() / $otherIteration->getRevolutions();
         }
         $displayTime = number_format($this->timeUnit->toDestUnit($time, $this->timeUnit->resolveDestUnit($timeUnit), $this->timeUnit->resolveMode($outputMode)), $this->timeUnit->getPrecision());
         if (strlen($displayTime) > $padding) {
             $padding = strlen($displayTime);
         }
         $output = sprintf('%' . ($padding + 2) . 's', $displayTime);
         if ($current === $index) {
             $output = sprintf('<bg=green>%s</>', $output);
         } elseif (isset($specials[$otherIteration->getIndex()])) {
             $output = sprintf('<%s>%s</%s>', $tag, $output, $tag);
         }
         $this->output->write($output);
         if ($index > 0 && ($index + 1) % self::NUMBER_COLS == 0) {
             $depth++;
             $this->output->write(PHP_EOL);
             $this->output->write('   ');
         }
     }
     $this->depth = $depth;
     $this->output->write(sprintf(' (%s)', $this->timeUnit->getDestSuffix($this->timeUnit->resolveDestUnit($timeUnit), $this->timeUnit->resolveMode($outputMode))));
     $this->output->write("");
     // clear rest of the line
 }
Пример #4
0
 private function drawIterations(IterationCollection $collection, array $specials, $tag)
 {
     $this->output->write("");
     // put cursor at column 0
     $timeUnit = $collection->getSubject()->getOutputTimeUnit();
     $outputMode = $collection->getSubject()->getOutputMode();
     $lines = array();
     $line = sprintf('%-' . self::INDENT . 's', '#' . $collection->getSubject()->getIndex());
     for ($index = 0; $index < $collection->count(); $index++) {
         $iteration = $collection->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 + 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
 }