Show / Hide Table of Contents

Class AutoWarmupStoppingCriteria

Automatically choose the best number of iterations during the warmup stage.

Inheritance
Object
StoppingCriteriaBase
AutoWarmupStoppingCriteria
Implements
IStoppingCriteria
Inherited Members
StoppingCriteriaBase.Title
StoppingCriteriaBase.MaxIterationCount
StoppingCriteriaBase.Warnings
Namespace: BenchmarkDotNet.Engines
Assembly: BenchmarkDotNet.dll
Syntax
public class AutoWarmupStoppingCriteria : StoppingCriteriaBase, IStoppingCriteria

Constructors

AutoWarmupStoppingCriteria(Int32, Int32, Int32)

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.

Declaration
public AutoWarmupStoppingCriteria(int minIterationCount, int maxIterationCount, int minFluctuationCount = 4)
Parameters
Type Name Description
Int32 minIterationCount

The minimum number of iterations. We are always going to do at least minIterationCount iterations regardless of fluctuations.

Int32 maxIterationCount

The maximum number of iterations. We are always going to do at most maxIterationCount iterations regardless of fluctuations.

Int32 minFluctuationCount

The 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 to maxIterationCount, we should stop the iterations.

Methods

Evaluate(IReadOnlyList<Measurement>)

Declaration
public override StoppingResult Evaluate(IReadOnlyList<Measurement> measurements)
Parameters
Type Name Description
IReadOnlyList<Measurement> measurements
Returns
Type Description
StoppingResult
Overrides
StoppingCriteriaBase.Evaluate(IReadOnlyList<Measurement>)

GetMaxIterationCount()

Declaration
protected override int GetMaxIterationCount()
Returns
Type Description
Int32
Overrides
StoppingCriteriaBase.GetMaxIterationCount()

GetTitle()

Declaration
protected override string GetTitle()
Returns
Type Description
String
Overrides
StoppingCriteriaBase.GetTitle()

GetWarnings()

Declaration
protected override IEnumerable<string> GetWarnings()
Returns
Type Description
IEnumerable<String>
Overrides
StoppingCriteriaBase.GetWarnings()

Implements

IStoppingCriteria
In This Article
Back to top Copyright © 2013–2021 .NET Foundation and contributors