Example #1
0
 /**
  * {@inheritdoc}
  */
 public function iterationsEnd(IterationCollection $iterations)
 {
     $stats = $iterations->getStats();
     $timeUnit = $iterations->getSubject()->getOutputTimeUnit();
     if (null === $timeUnit || $this->timeUnit->isOverridden()) {
         $timeUnit = $this->timeUnit->getDestUnit();
     }
     $suffix = TimeUnit::getSuffix($timeUnit);
     $this->output->write(sprintf("\tμ/r: %s%s\tμSD/r %s%s\tμRSD/r: %s%%", number_format(TimeUnit::convert($stats['mean'], TimeUnit::MICROSECONDS, $timeUnit), 3), $suffix, number_format(TimeUnit::convert($stats['stdev'], TimeUnit::MICROSECONDS, $timeUnit), 3), $suffix, number_format($stats['rstdev'], 2)));
     $this->output->write(PHP_EOL);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function iterationsEnd(IterationCollection $iterations)
 {
     if ($iterations->getRejectCount() > 0) {
         return;
     }
     $stats = $iterations->getStats();
     $subject = $iterations->getSubject();
     $timeUnit = $subject->getOutputTimeUnit();
     if (null === $timeUnit || $this->timeUnit->isOverridden()) {
         $timeUnit = $this->timeUnit->getDestUnit();
     }
     $suffix = TimeUnit::getSuffix($timeUnit);
     $this->output->writeln(sprintf("\t%-30s P%s\tμ/r: %s%s\tμSD/r %s%s\tμRSD/r: %s%%", $subject->getName(), $iterations->getParameterSet()->getIndex(), number_format(TimeUnit::convert($stats['mean'], TimeUnit::MICROSECONDS, $timeUnit), 3), $suffix, number_format(TimeUnit::convert($stats['stdev'], TimeUnit::MICROSECONDS, $timeUnit), 3), $suffix, number_format($stats['rstdev'], 2)));
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function format($subject, array $options)
 {
     return $this->timeUnit->format($subject, in_array('unit', $options['resolve']) ? $this->timeUnit->resolveDestUnit($options['unit']) : $options['unit'], in_array('mode', $options['resolve']) ? $this->timeUnit->resolveMode($options['mode']) : $options['mode'], $this->timeUnit->resolvePrecision($options['precision']));
 }
Example #4
0
 /**
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Expected string value
  */
 public function testInvalidUnitType()
 {
     TimeUnit::convertTo(100, new \stdClass(), TimeUnit::MINUTES);
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public function format($subject, array $options)
 {
     return TimeUnit::convert($subject, $options['from'], $options['to']);
 }