Class BowireBenchmarkStats

Namespace
Kuestenlogik.Bowire.Benchmarking
Assembly
Kuestenlogik.Bowire.Benchmarking.dll

Aggregate latency statistics over one benchmark run (#360).

Percentiles use nearest-rankceil(p/100 × n) − 1 into the sorted sample — which is the method the workbench's benchmark rail has always used (_percentileSorted in benchmarks.js). Matching it matters more than picking a "better" interpolation: an operator who sees p95 = 142 ms in the rail and then gates CI on p95 < 150 must not get a different number from the CLI for the same sample.

public sealed class BowireBenchmarkStats
Inheritance
BowireBenchmarkStats
Inherited Members

Properties

Avg

Arithmetic mean latency in milliseconds.

public double Avg { get; }

Property Value

double

Count

Number of completed calls the sample covers.

public int Count { get; }

Property Value

int

ErrorRate

Failed calls as a fraction of all calls (0..1) — k6's http_req_failed rate.

public double ErrorRate { get; }

Property Value

double

Errors

Calls that failed (transport error or error status).

public int Errors { get; }

Property Value

int

Max

Slowest observed latency in milliseconds.

public double Max { get; }

Property Value

double

Min

Fastest observed latency in milliseconds.

public double Min { get; }

Property Value

double

P50

Median latency in milliseconds.

public double P50 { get; }

Property Value

double

P90

90th-percentile latency in milliseconds.

public double P90 { get; }

Property Value

double

P95

95th-percentile latency in milliseconds.

public double P95 { get; }

Property Value

double

P99

99th-percentile latency in milliseconds.

public double P99 { get; }

Property Value

double

SortedLatencies

The sorted latency sample the percentiles were taken from.

public IReadOnlyList<double> SortedLatencies { get; }

Property Value

IReadOnlyList<double>

Throughput

Completed calls per second over the run's wall clock.

public double Throughput { get; }

Property Value

double

Methods

From(IEnumerable<double>, int, double)

Compute the statistics for a run. latenciesMs may arrive in any order — it is sorted here, once, so every percentile reads from the same canonical array.

public static BowireBenchmarkStats From(IEnumerable<double> latenciesMs, int errors, double elapsedSeconds)

Parameters

latenciesMs IEnumerable<double>

Latency of each completed call, in milliseconds.

errors int

How many calls failed.

elapsedSeconds double

Wall-clock duration of the run, for throughput.

Returns

BowireBenchmarkStats

PercentileOfSorted(IReadOnlyList<double>, double)

Nearest-rank percentile over an already-sorted sample. Mirrors _percentileSorted in the benchmark rail's JS, including the empty-sample answer of 0 and the clamp at both ends.

public static double PercentileOfSorted(IReadOnlyList<double> sorted, double percentile)

Parameters

sorted IReadOnlyList<double>
percentile double

Returns

double

Value(BowireBenchmarkMetric)

Read one metric by its BowireBenchmarkMetric id — the seam thresholds evaluate through, so adding a metric doesn't mean teaching the threshold evaluator about it separately.

public double Value(BowireBenchmarkMetric metric)

Parameters

metric BowireBenchmarkMetric

Returns

double