示例#1
0
 /**
  * {@inheritdoc}
  */
 public function execute(Iteration $iteration, Config $config)
 {
     $subject = $iteration->getSubject();
     $tokens = array('class' => $subject->getBenchmarkMetadata()->getClass(), 'file' => $subject->getBenchmarkMetadata()->getPath(), 'subject' => $subject->getName(), 'revolutions' => $iteration->getRevolutions(), 'beforeMethods' => var_export($subject->getBeforeMethods(), true), 'afterMethods' => var_export($subject->getAfterMethods(), true), 'parameters' => var_export($iteration->getParameters()->getArrayCopy(), true), 'warmup' => $iteration->getWarmup() ?: 0);
     $payload = $this->launcher->payload(__DIR__ . '/template/microtime.template', $tokens);
     return $this->launch($payload, $iteration, $config);
 }
示例#2
0
 public static function filenameFromIteration(Iteration $iteration)
 {
     $name = sprintf('%s::%s.P%s.cachegrind', $iteration->getSubject()->getBenchmarkMetadata()->getClass(), $iteration->getSubject()->getName(), $iteration->getParameters()->getIndex());
     $name = str_replace('\\', '_', $name);
     $name = str_replace('/', '_', $name);
     return $name;
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function execute(Iteration $iteration, array $options = array())
 {
     $subject = $iteration->getSubject();
     $tokens = array('class' => $subject->getBenchmarkMetadata()->getClass(), 'file' => $subject->getBenchmarkMetadata()->getPath(), 'subject' => $subject->getName(), 'revolutions' => $iteration->getRevolutions(), 'beforeMethods' => var_export($subject->getBeforeMethods(), true), 'afterMethods' => var_export($subject->getAfterMethods(), true), 'parameters' => var_export($iteration->getParameters()->getArrayCopy(), true));
     $payload = $this->launcher->payload(__DIR__ . '/template/microtime.template', $tokens);
     $payload->setPhpConfig(array('max_execution_time' => 0));
     $result = $payload->launch();
     if (isset($result['buffer']) && $result['buffer']) {
         throw new \RuntimeException(sprintf('Benchmark made some noise: %s', $result['buffer']));
     }
     return new IterationResult($result['time'], $result['memory']);
 }
示例#4
0
 /**
  * {@inheritdoc}
  */
 public function iterationStart(Iteration $iteration)
 {
     $this->output->write(sprintf("    %-30s%sI%s P%s ", $iteration->getSubject()->getName(), $this->rejectionCount ? 'R' . $this->rejectionCount . ' ' : '', $iteration->getIndex(), $iteration->getParameters()->getIndex()));
 }