Table of Contents

Struct Measurement

Namespace
BenchmarkDotNet.Reports
Assembly
BenchmarkDotNet.dll

The basic captured statistics for a benchmark

public struct Measurement : IComparable<Measurement>
Implements
Inherited Members
Extension Methods

Constructors

Measurement(int, IterationMode, IterationStage, int, long, double)

Creates an instance of Measurement struct.

public Measurement(int launchIndex, IterationMode iterationMode, IterationStage iterationStage, int iterationIndex, long operations, double nanoseconds)

Parameters

launchIndex int
iterationMode IterationMode
iterationStage IterationStage
iterationIndex int
operations long

The number of operations performed.

nanoseconds double

The total number of nanoseconds it took to perform all operations.

Properties

IterationIndex

public readonly int IterationIndex { get; }

Property Value

int

IterationMode

public readonly IterationMode IterationMode { get; }

Property Value

IterationMode

IterationStage

public readonly IterationStage IterationStage { get; }

Property Value

IterationStage

LaunchIndex

public readonly int LaunchIndex { get; }

Property Value

int

Nanoseconds

Gets the total number of nanoseconds it took to perform all operations.

public readonly double Nanoseconds { get; }

Property Value

double

Operations

Gets the number of operations performed.

public readonly long Operations { get; }

Property Value

long

Methods

CompareTo(Measurement)

public int CompareTo(Measurement other)

Parameters

other Measurement

Returns

int

GetAverageTime()

Gets the average duration of one operation.

public TimeInterval GetAverageTime()

Returns

TimeInterval

Parse(string, int)

Parses the benchmark statistics from the plain text line.

E.g. given the input line:

WorkloadTarget 1: 10 op, 1005842518 ns

Will extract the number of Operations performed and the total number of Nanoseconds it took to perform them.

public static Measurement Parse(string line, int processIndex)

Parameters

line string

The line to parse.

processIndex int

Process launch index, indexed from one.

Returns

Measurement

An instance of Measurement if parsed successfully. Null in case of any trouble.

ToString()

public override string ToString()

Returns

string