createVariant() public method

Create and add a new variant based on this subject.
public createVariant ( ParameterSet $parameterSet, integer $revolutions, integer $warmup, array $computedStats = [] ) : Variant.
$parameterSet ParameterSet
$revolutions integer
$warmup integer
$computedStats array
return Variant.
コード例 #1
0
ファイル: Loader.php プロジェクト: dantleech/phpbench
 private function getVariant(\ArrayObject $context, Subject $subject, $row)
 {
     $key = $row['variant.id'];
     if (isset($context[self::VARIANTS][$key])) {
         return $context[self::VARIANTS][$key];
     }
     $variant = $subject->createVariant(new ParameterSet(0, $this->repository->getParameters($row['variant.id'])), $row['variant.revolutions'], $row['variant.warmup']);
     $context[self::VARIANTS][$key] = $variant;
     return $variant;
 }
コード例 #2
0
ファイル: XmlDecoder.php プロジェクト: dantleech/phpbench
 private function processSubject(Subject $subject, \DOMElement $subjectEl, array $resultClasses)
 {
     $groups = [];
     foreach ($subjectEl->query('./group') as $groupEl) {
         $groups[] = $groupEl->getAttribute('name');
     }
     $subject->setGroups($groups);
     // TODO: These attributes should be on the subject, see
     // https://github.com/phpbench/phpbench/issues/307
     foreach ($subjectEl->query('./variant') as $variantEl) {
         $subject->setSleep($variantEl->getAttribute('sleep'));
         $subject->setOutputTimeUnit($variantEl->getAttribute('output-time-unit'));
         $subject->setOutputTimePrecision($variantEl->getAttribute('output-time-precision'));
         $subject->setOutputMode($variantEl->getAttribute('output-mode'));
         $subject->setRetryThreshold($variantEl->getAttribute('retry-threshold'));
         break;
     }
     foreach ($subjectEl->query('./variant') as $index => $variantEl) {
         $parameters = $this->getParameters($variantEl);
         $parameterSet = new ParameterSet($index, $parameters);
         $stats = $this->getComputedStats($variantEl);
         $variant = $subject->createVariant($parameterSet, $variantEl->getAttribute('revs'), $variantEl->getAttribute('warmup'), $stats);
         $this->processVariant($variant, $variantEl, $resultClasses);
     }
 }
コード例 #3
0
ファイル: Runner.php プロジェクト: dantleech/phpbench
 private function runSubject(ExecutorInterface $executor, RunnerContext $context, Subject $subject, SubjectMetadata $subjectMetadata)
 {
     $parameterSets = $context->getParameterSets($subjectMetadata->getParameterSets());
     $paramsIterator = new CartesianParameterIterator($parameterSets);
     // create the variants.
     foreach ($paramsIterator as $parameterSet) {
         foreach ($subjectMetadata->getIterations() as $nbIterations) {
             foreach ($subjectMetadata->getRevs() as $revolutions) {
                 foreach ($subjectMetadata->getWarmup() as $warmup) {
                     $variant = $subject->createVariant($parameterSet, $revolutions, $warmup);
                     $variant->spawnIterations($nbIterations);
                 }
             }
         }
     }
     // run the variants.
     foreach ($subject->getVariants() as $variant) {
         $this->runVariant($executor, $context, $subjectMetadata, $variant);
     }
     return $subject;
 }