C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
StopWatch Stopwatch

Защищенные свойства (Protected)

Свойство Тип Описание
Builder NBench.Sdk.BenchmarkBuilder
WarmupData WarmupData

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

AssertResults() публичный Метод

public AssertResults ( NBench.Reporting.BenchmarkResults result ) : NBench.Reporting.BenchmarkFinalResults
result NBench.Reporting.BenchmarkResults
Результат NBench.Reporting.BenchmarkFinalResults

Benchmark() публичный Метод

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.
Результат System

Benchmark() публичный Метод

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.
Результат System

CompileResults() публичный Метод

Compiles all of the completed BenchmarkRuns into reports
public CompileResults ( ) : NBench.Reporting.BenchmarkResults
Результат NBench.Reporting.BenchmarkResults

Finish() публичный Метод

Complete the benchmark
public Finish ( ) : void
Результат void

PostRun() защищенный Метод

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
Результат void

PreRun() защищенный Метод

protected PreRun ( ) : void
Результат void

PrepareForRun() публичный статический Метод

Performs any final GC needed before we start a test run
public static PrepareForRun ( ) : void
Результат void

Run() публичный Метод

public Run ( ) : void
Результат void

RunBenchmark() защищенный Метод

protected RunBenchmark ( ) : void
Результат void

Shutdown() публичный Метод

public Shutdown ( ) : void
Результат void

Описание свойств

Builder защищенное свойство

protected BenchmarkBuilder,NBench.Sdk Builder
Результат NBench.Sdk.BenchmarkBuilder

StopWatch публичное свойство

Stopwatch used by the Benchmark. Exposed only for testing purposes.
public Stopwatch StopWatch
Результат Stopwatch

WarmupData защищенное свойство

protected WarmupData,NBench.Sdk WarmupData
Результат WarmupData