Class AutoWarmupStoppingCriteria
- Namespace
- BenchmarkDotNet.Engines
- Assembly
- BenchmarkDotNet.dll
Automatically choose the best number of iterations during the warmup stage.
public class AutoWarmupStoppingCriteria : StoppingCriteriaBase, IStoppingCriteria
- Inheritance
-
AutoWarmupStoppingCriteria
- Implements
- Inherited Members
Constructors
AutoWarmupStoppingCriteria(int, int, int)
The idea of the implementation is simple: if measurements monotonously decrease or increase, the steady state is not achieved; we should continue the warmup stage. The evaluation method counts "fluctuations" (3 consecutive measurements A,B,C where (A>B AND B<C) OR (A<B AND B>C)) until the required amount of flotations is observed.
public AutoWarmupStoppingCriteria(int minIterationCount, int maxIterationCount, int minFluctuationCount = 4)
Parameters
minIterationCount
intThe minimum number of iterations. We are always going to do at least
minIterationCount
iterations regardless of fluctuations.maxIterationCount
intThe maximum number of iterations. We are always going to do at most
maxIterationCount
iterations regardless of fluctuations.minFluctuationCount
intThe required number of fluctuations. If the required number of fluctuations is achieved but the number of iterations less than
minIterationCount
, we need more iterations. If the required number of fluctuations is not achieved but the number of iterations equal tomaxIterationCount
, we should stop the iterations.
Methods
Evaluate(IReadOnlyList<Measurement>)
Checks do we have enough iterations
public override StoppingResult Evaluate(IReadOnlyList<Measurement> measurements)
Parameters
measurements
IReadOnlyList<Measurement>- Automatically choose the best number of iterations during the warmup stage.
Returns
- StoppingResult
- Automatically choose the best number of iterations during the warmup stage.
GetMaxIterationCount()
protected override int GetMaxIterationCount()
Returns
- int
- Automatically choose the best number of iterations during the warmup stage.
GetTitle()
protected override string GetTitle()
Returns
- string
- Automatically choose the best number of iterations during the warmup stage.
GetWarnings()
protected override IEnumerable<string> GetWarnings()
Returns
- IEnumerable<string>
- Automatically choose the best number of iterations during the warmup stage.