private function buildSubject(SubjectMetadata $subject, $annotations) { foreach ($annotations as $annotation) { if ($annotation instanceof BeforeClassMethods) { throw new \InvalidArgumentException(sprintf('@BeforeClassMethods annotation can only be applied at the class level (%s)', $subject->getBenchmark()->getClass() . '::' . $subject->getName())); } if ($annotation instanceof AfterClassMethods) { throw new \InvalidArgumentException(sprintf('@AfterClassMethods annotation can only be applied at the class level (%s)', $subject->getBenchmark()->getClass() . '::' . $subject->getName())); } $this->processSubject($subject, $annotation); } }
/** * {@inheritdoc} */ public function execute(SubjectMetadata $subjectMetadata, Iteration $iteration, Config $config) { $tokens = ['class' => $subjectMetadata->getBenchmark()->getClass(), 'file' => $subjectMetadata->getBenchmark()->getPath(), 'subject' => $subjectMetadata->getName(), 'revolutions' => $iteration->getVariant()->getRevolutions(), 'beforeMethods' => var_export($subjectMetadata->getBeforeMethods(), true), 'afterMethods' => var_export($subjectMetadata->getAfterMethods(), true), 'parameters' => var_export($iteration->getVariant()->getParameterSet()->getArrayCopy(), true), 'warmup' => $iteration->getVariant()->getWarmup() ?: 0]; $payload = $this->launcher->payload(__DIR__ . '/template/microtime.template', $tokens); return $this->launch($payload, $iteration, $config); }