示例#1
0
 /**
  * {@inheritdoc}
  */
 public function iterationStart(Iteration $iteration)
 {
     $this->drawIterations($iteration->getCollection(), $this->rejects, 'error', $iteration->getIndex());
     $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', $iteration->getCollection()->getSubject()->getName()), $iteration->getCollection()->count(), $iteration->getRevolutions()));
     $this->output->write(PHP_EOL);
     $this->output->write(sprintf('<info>parameters</info> %s', json_encode($iteration->getCollection()->getParameterSet()->getArrayCopy(), true)));
     $this->output->write("[" . ($this->depth + 3) . 'A');
     // put the cursor back to the line with the measurements
     $this->output->write("");
     // put the cursor back at col 0
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function execute(Iteration $iteration, Config $config)
 {
     $memory = 100;
     $collectionHash = spl_object_hash($iteration->getCollection());
     if (!$config['times']) {
         return new IterationResult(0, $memory);
     }
     if (isset($this->collectionTimes[$collectionHash])) {
         $time = $this->collectionTimes[$collectionHash];
     } else {
         $index = count($this->collectionTimes) % count($config['times']);
         $time = $config['times'][$index];
         $this->collectionTimes[$collectionHash] = $time;
     }
     if ($config['spread']) {
         $index = $iteration->getIndex() % count($config['spread']);
         $spreadDiff = $config['spread'][$index];
         $time = $time + $spreadDiff;
     }
     return new IterationResult($time, $memory);
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function iterationStart(Iteration $iteration)
 {
     $this->output->write(PHP_EOL);
     $this->output->write(PHP_EOL);
     $this->output->write(sprintf('<info>it</info>%3d/%-3d<info> (rej </info>%s<info>)</info>', $iteration->getIndex(), $iteration->getCollection()->count(), $iteration->getCollection()->getRejectCount()));
     $this->output->write("");
     $this->output->write("");
 }