getExecutor() публичный Метод

Return either an executor configuration name or an actual configuration.
public getExecutor ( ) : string | array
Результат string | array
Пример #1
0
 private function runIterations(ExecutorInterface $executor, RunnerContext $context, SubjectMetadata $subject, ParameterSet $parameterSet, \DOMElement $variantEl)
 {
     $iterationCount = $context->getIterations($subject->getIterations());
     $revolutionCount = $context->getRevolutions($subject->getRevs());
     $warmupCount = $context->getWarmup($subject->getWarmUp());
     $executorConfig = $this->executorRegistry->getConfig($context->getExecutor());
     $iterationCollection = new IterationCollection($subject, $parameterSet, $iterationCount, $revolutionCount, $warmupCount, $context->getRetryThreshold($this->retryThreshold));
     $this->logger->iterationsStart($iterationCollection);
     try {
         foreach ($iterationCollection as $iteration) {
             $this->runIteration($executor, $executorConfig, $iteration, $context->getSleep($subject->getSleep()));
         }
     } catch (\Exception $e) {
         $iterationCollection->setException($e);
         $this->logger->iterationsEnd($iterationCollection);
         $this->appendException($variantEl, $e);
         return;
     }
     $iterationCollection->computeStats();
     $this->logger->iterationsEnd($iterationCollection);
     while ($iterationCollection->getRejectCount() > 0) {
         $this->logger->retryStart($iterationCollection->getRejectCount());
         $this->logger->iterationsStart($iterationCollection);
         foreach ($iterationCollection->getRejects() as $reject) {
             $reject->incrementRejectionCount();
             $this->runIteration($executor, $executorConfig, $reject, $context->getSleep($subject->getSleep()));
         }
         $iterationCollection->computeStats();
         $this->logger->iterationsEnd($iterationCollection);
     }
     $stats = $iterationCollection->getStats();
     foreach ($iterationCollection as $iteration) {
         $iterationEl = $variantEl->ownerDocument->createElement('iteration');
         $iterationEl->setAttribute('net-time', $iteration->getResult()->getTime());
         $iterationEl->setAttribute('rev-time', $iteration->getResult()->getTime() / $iteration->getRevolutions());
         $iterationEl->setAttribute('z-value', $iteration->getZValue());
         $iterationEl->setAttribute('memory', $iteration->getResult()->getMemory());
         $iterationEl->setAttribute('deviation', $iteration->getDeviation());
         $iterationEl->setAttribute('rejection-count', $iteration->getRejectionCount());
         $variantEl->appendChild($iterationEl);
     }
     $statsEl = $variantEl->appendElement('stats');
     foreach ($stats as $statName => $statValue) {
         $statsEl->setAttribute($statName, $statValue);
     }
 }
Пример #2
0
 private function runVariant(ExecutorInterface $executor, RunnerContext $context, SubjectMetadata $subjectMetadata, Variant $variant)
 {
     $executorConfig = $this->executorRegistry->getConfig($context->getExecutor());
     $this->logger->variantStart($variant);
     $rejectCount = [];
     try {
         foreach ($variant->getIterations() as $iteration) {
             $rejectCount[spl_object_hash($iteration)] = 0;
             $this->runIteration($executor, $executorConfig, $iteration, $subjectMetadata);
         }
     } catch (\Exception $e) {
         $variant->setException($e);
         $this->logger->variantEnd($variant);
         if ($context->getStopOnError()) {
             throw new StopOnErrorException();
         }
         return;
     }
     $variant->computeStats();
     $this->logger->variantEnd($variant);
     while ($variant->getRejectCount() > 0) {
         $this->logger->retryStart($variant->getRejectCount());
         $this->logger->variantStart($variant);
         foreach ($variant->getRejects() as $reject) {
             $rejectCount[spl_object_hash($reject)]++;
             $this->runIteration($executor, $executorConfig, $reject, $subjectMetadata);
         }
         $variant->computeStats();
         $this->logger->variantEnd($variant);
         $reject->setResult(new RejectionCountResult($rejectCount[spl_object_hash($reject)]));
     }
 }