C# Class NBench.Sdk.Benchmark

Executor class for running a single PerfBenchmarkAttribute Exposes the BenchmarkContext, which allows developers to register custom metrics and counters for the use of their personal benchmarks.
Afficher le fichier Open project: petabridge/NBench Class Usage Examples

Méthodes publiques

Свойство Type Description
StopWatch Stopwatch

Protected Properties

Свойство Type Description
Builder NBench.Sdk.BenchmarkBuilder
WarmupData WarmupData

Méthodes publiques

Méthode Description
AssertResults ( NBench.Reporting.BenchmarkResults result ) : NBench.Reporting.BenchmarkFinalResults
Benchmark ( NBench.Sdk.BenchmarkSettings settings, IBenchmarkInvoker invoker, IBenchmarkOutput writer ) : System

Backwards-compatible constructor for NBench 0.1.6 and earlier.

Uses the DefaultBenchmarkAssertionRunner to assert benchmark data.

Benchmark ( NBench.Sdk.BenchmarkSettings settings, IBenchmarkInvoker invoker, IBenchmarkOutput writer, IBenchmarkAssertionRunner benchmarkAssertions ) : System

Backwards-compatible constructor for NBench 0.1.6 and earlier.

CompileResults ( ) : NBench.Reporting.BenchmarkResults

Compiles all of the completed BenchmarkRuns into reports

Finish ( ) : void

Complete the benchmark

PrepareForRun ( ) : void

Performs any final GC needed before we start a test run

Run ( ) : void
Shutdown ( ) : void

Méthodes protégées

Méthode Description
PostRun ( ) : void

NOTE: We don't reset the Stopwatch on purpose here, so we can collect the value of it and use it for auto-tuning and reporting. It'll be started at the beginning of the next run.

PreRun ( ) : void
RunBenchmark ( ) : void

Private Methods

Méthode Description
Allocate ( ) : void

Pre-allocate all of the objects we're going to need for this benchmark

Complete ( bool isEstimate = false ) : void

Complete the current run

HandleBenchmarkRunException ( Exception ex, string formatMsg ) : void
PrintWarmupOrRun ( bool isWarmup ) : string

Helper method for printing out the correct label to trace

RunSingleBenchmark ( ) : void
WarmUp ( ) : void

Warmup phase

Method Details

AssertResults() public méthode

public AssertResults ( NBench.Reporting.BenchmarkResults result ) : NBench.Reporting.BenchmarkFinalResults
result NBench.Reporting.BenchmarkResults
Résultat NBench.Reporting.BenchmarkFinalResults

Benchmark() public méthode

Backwards-compatible constructor for NBench 0.1.6 and earlier.
Uses the DefaultBenchmarkAssertionRunner to assert benchmark data.
public Benchmark ( NBench.Sdk.BenchmarkSettings settings, IBenchmarkInvoker invoker, IBenchmarkOutput writer ) : System
settings NBench.Sdk.BenchmarkSettings The settings for this benchmark.
invoker IBenchmarkInvoker The invoker used to execute benchmark and setup / cleanup methods.
writer IBenchmarkOutput The output target this benchmark will write to.
Résultat System

Benchmark() public méthode

Backwards-compatible constructor for NBench 0.1.6 and earlier.
public Benchmark ( NBench.Sdk.BenchmarkSettings settings, IBenchmarkInvoker invoker, IBenchmarkOutput writer, IBenchmarkAssertionRunner benchmarkAssertions ) : System
settings NBench.Sdk.BenchmarkSettings The settings for this benchmark.
invoker IBenchmarkInvoker The invoker used to execute benchmark and setup / cleanup methods.
writer IBenchmarkOutput The output target this benchmark will write to.
benchmarkAssertions IBenchmarkAssertionRunner The assertion engine we'll use to perform BenchmarkAssertions against benchmarks.
Résultat System

CompileResults() public méthode

Compiles all of the completed BenchmarkRuns into reports
public CompileResults ( ) : NBench.Reporting.BenchmarkResults
Résultat NBench.Reporting.BenchmarkResults

Finish() public méthode

Complete the benchmark
public Finish ( ) : void
Résultat void

PostRun() protected méthode

NOTE: We don't reset the Stopwatch on purpose here, so we can collect the value of it and use it for auto-tuning and reporting. It'll be started at the beginning of the next run.
protected PostRun ( ) : void
Résultat void

PreRun() protected méthode

protected PreRun ( ) : void
Résultat void

PrepareForRun() public static méthode

Performs any final GC needed before we start a test run
public static PrepareForRun ( ) : void
Résultat void

Run() public méthode

public Run ( ) : void
Résultat void

RunBenchmark() protected méthode

protected RunBenchmark ( ) : void
Résultat void

Shutdown() public méthode

public Shutdown ( ) : void
Résultat void

Property Details

Builder protected_oe property

protected BenchmarkBuilder,NBench.Sdk Builder
Résultat NBench.Sdk.BenchmarkBuilder

StopWatch public_oe property

Stopwatch used by the Benchmark. Exposed only for testing purposes.
public Stopwatch StopWatch
Résultat Stopwatch

WarmupData protected_oe property

protected WarmupData,NBench.Sdk WarmupData
Résultat WarmupData