PHP Class PhpBench\Model\Variant

TODO: Remove array access?
Inheritance: implements IteratorAggregate, implements ArrayAccess, implements Countable
Mostrar archivo Open project: dantleech/phpbench Class Usage Examples

Public Methods

Method Description
__construct ( Subject $subject, ParameterSet $parameterSet, $revolutions, $warmup, array $computedStats = [] )
addIteration ( Iteration $iteration ) Add an iteration.
computeStats ( ) Calculate and set the deviation from the mean time for each iteration. If the deviation is greater than the rejection threshold, then mark the iteration as rejected.
count ( ) Return number of iterations.
createErrorStack ( array $errors ) Create and set the error stack from a list of Error instances.
createIteration ( array $results = [] ) : Iteration Create and add a new iteration.
getErrorStack ( ) : ErrorStack Should be called when rebuiling the object graph.
getIteration ( $index ) : Iteration Return the iteration at the given index.
getIterations ( ) : Iteration[] Return all the iterations.
getIterator ( )
getMetricValues ( $resultClass, $metricName ) : mixed[] Return result values by class and metric name.
getMetricValuesByRev ( $resultClass, $metric ) : mixed[] Return the average metric values by revolution.
getParameterSet ( ) : ParameterSet Return the parameter set.
getRejectCount ( ) : integer Return the number of rejected iterations.
getRejects ( ) : Iteration[] Return all rejected iterations.
getRevolutions ( ) : integer Return the number of revolutions for this variant.
getStats ( ) : Distribution Return statistics about this iteration collection.
getSubject ( ) : Subject Return the subject metadata.
getWarmup ( ) : integer Return the number of warmup revolutions.
hasErrorStack ( ) : boolean Return true if any of the iterations in this set encountered an error.
isComputed ( ) : boolean Return true if the collection has been computed (i.e. stats have been s set and rejects identified).
offsetExists ( $offset )
offsetGet ( $offset )
offsetSet ( $offset, $value )
offsetUnset ( $offset )
setException ( Exception $exception ) Create an error stack from an Exception.
spawnIterations ( integer $nbIterations ) Generate $nbIterations and add them to the variant.

Method Details

__construct() public method

public __construct ( Subject $subject, ParameterSet $parameterSet, $revolutions, $warmup, array $computedStats = [] )
$subject Subject
$parameterSet ParameterSet
$computedStats array

addIteration() public method

Add an iteration.
public addIteration ( Iteration $iteration )
$iteration Iteration

computeStats() public method

Calculate and set the deviation from the mean time for each iteration. If the deviation is greater than the rejection threshold, then mark the iteration as rejected.
public computeStats ( )

count() public method

public count ( )

createErrorStack() public method

Create and set the error stack from a list of Error instances.
public createErrorStack ( array $errors )
$errors array

createIteration() public method

Create and add a new iteration.
public createIteration ( array $results = [] ) : Iteration
$results array
return Iteration

getErrorStack() public method

Should be called when rebuiling the object graph.
public getErrorStack ( ) : ErrorStack
return ErrorStack

getIteration() public method

Return the iteration at the given index.
public getIteration ( $index ) : Iteration
return Iteration

getIterations() public method

Return all the iterations.
public getIterations ( ) : Iteration[]
return Iteration[]

getIterator() public method

public getIterator ( )

getMetricValues() public method

e.g. $variant->getMetricValues(ComputedResult::class, 'z_value');
public getMetricValues ( $resultClass, $metricName ) : mixed[]
return mixed[]

getMetricValuesByRev() public method

Return the average metric values by revolution.
public getMetricValuesByRev ( $resultClass, $metric ) : mixed[]
return mixed[]

getParameterSet() public method

Return the parameter set.
public getParameterSet ( ) : ParameterSet
return ParameterSet

getRejectCount() public method

Return the number of rejected iterations.
public getRejectCount ( ) : integer
return integer

getRejects() public method

Return all rejected iterations.
public getRejects ( ) : Iteration[]
return Iteration[]

getRevolutions() public method

Return the number of revolutions for this variant.
public getRevolutions ( ) : integer
return integer

getStats() public method

See self::$stats. TODO: Rename to getDistribution
public getStats ( ) : Distribution
return PhpBench\Math\Distribution

getSubject() public method

Return the subject metadata.
public getSubject ( ) : Subject
return Subject

getWarmup() public method

Return the number of warmup revolutions.
public getWarmup ( ) : integer
return integer

hasErrorStack() public method

Return true if any of the iterations in this set encountered an error.
public hasErrorStack ( ) : boolean
return boolean

isComputed() public method

Return true if the collection has been computed (i.e. stats have been s set and rejects identified).
public isComputed ( ) : boolean
return boolean

offsetExists() public method

public offsetExists ( $offset )

offsetGet() public method

public offsetGet ( $offset )

offsetSet() public method

public offsetSet ( $offset, $value )

offsetUnset() public method

public offsetUnset ( $offset )

setException() public method

Should be called when an Exception is encountered during the execution of any of the iteration processes. After an exception is encountered the results from this iteration set are invalid.
public setException ( Exception $exception )
$exception Exception

spawnIterations() public method

Generate $nbIterations and add them to the variant.
public spawnIterations ( integer $nbIterations )
$nbIterations integer