Class BenchmarkRun
Used to collect metrics for a given instance of a benchmark
Inheritance
System.Object
BenchmarkRun
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: NBench.Metrics
Assembly: NBench.dll
Syntax
public class BenchmarkRun : IDisposable
Constructors
BenchmarkRun(IReadOnlyList<MeasureBucket>, IReadOnlyList<Counter>, IBenchmarkTrace)
Declaration
public BenchmarkRun(IReadOnlyList<MeasureBucket> measures, IReadOnlyList<Counter> counters, IBenchmarkTrace trace)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IReadOnlyList<MeasureBucket> | measures | |
System.Collections.Generic.IReadOnlyList<Counter> | counters | |
IBenchmarkTrace | trace |
Properties
Context
Declaration
public BenchmarkContext Context { get; }
Property Value
Type | Description |
---|---|
BenchmarkContext |
Counters
Declaration
public IReadOnlyDictionary<CounterMetricName, Counter> Counters { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<CounterMetricName, Counter> |
Exceptions
Declaration
public IReadOnlyList<Exception> Exceptions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<System.Exception> |
IsFaulted
Returns true
if any System.Exceptions were thrown during this run.
Declaration
public bool IsFaulted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
MeasureCount
Declaration
public int MeasureCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Measures
Declaration
public IReadOnlyList<MeasureBucket> Measures { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<MeasureBucket> |
WasDisposed
Declaration
public bool WasDisposed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
Dispose()
Declaration
public void Dispose()
Sample(Int64)
Sample all actively used benchmarks in this run
Declaration
public void Sample(long elapsedTicks)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | elapsedTicks |
ToReport(TimeSpan)
Collect a final report for this BenchmarkRun
Declaration
public BenchmarkRunReport ToReport(TimeSpan elapsedTime)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | elapsedTime |
Returns
Type | Description |
---|---|
BenchmarkRunReport | A compiled report for all of the underlying MeasureBuckets. |
WithException(Exception)
Adds an System.Exception to this BenchmarkRun.
Declaration
public void WithException(Exception ex)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | ex | The System.Exception thrown while running the benchmark. |
Implements
System.IDisposable