Class BowireBenchmarkStats
- Namespace
- Kuestenlogik.Bowire.Benchmarking
- Assembly
- Kuestenlogik.Bowire.Benchmarking.dll
Aggregate latency statistics over one benchmark run (#360).
Percentiles use nearest-rank — ceil(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
Count
Number of completed calls the sample covers.
public int Count { get; }
Property Value
ElapsedMs
#623 — the run's wall clock in milliseconds, which Samples are placed in.
public double ElapsedMs { get; }
Property Value
ErrorRate
Failed calls as a fraction of all calls (0..1) — k6's http_req_failed rate.
public double ErrorRate { get; }
Property Value
Errors
Calls that failed (transport error or error status).
public int Errors { get; }
Property Value
FirstChunk
#620 — time to first chunk over the streamed calls that produced one, as statistics of its own (Count is the calls with a first chunk; its errors and throughput are zero). Null when the run did not stream: absent, not a zero that reads as a very fast server.
public BowireBenchmarkStats? FirstChunk { get; }
Property Value
Max
Slowest observed latency in milliseconds.
public double Max { get; }
Property Value
Min
Fastest observed latency in milliseconds.
public double Min { get; }
Property Value
P50
Median latency in milliseconds.
public double P50 { get; }
Property Value
P90
90th-percentile latency in milliseconds.
public double P90 { get; }
Property Value
P95
95th-percentile latency in milliseconds.
public double P95 { get; }
Property Value
P99
99th-percentile latency in milliseconds.
public double P99 { get; }
Property Value
ResponseMetrics
#621 — the response metrics declared for the run, by name: what each completed call reported, aggregated. Empty when none was declared.
public IReadOnlyDictionary<string, BowireResponseMetricStats> ResponseMetrics { get; }
Property Value
Samples
#623 — every call of the run with where it fell in it, in time order. Empty when the statistics were not computed from a timed run.
public IReadOnlyList<BowireBenchmarkSample> Samples { get; }
Property Value
SortedLatencies
The sorted latency sample the percentiles were taken from.
public IReadOnlyList<double> SortedLatencies { get; }
Property Value
Throughput
Completed calls per second over the run's wall clock.
public double Throughput { get; }
Property Value
Timeline
#623 — the run bucketed over its wall clock; null without Samples.
public BowireBenchmarkTimeline? Timeline { get; }
Property Value
Methods
ForWindow(BowireRunWindow)
#623 — the statistics of one part of the run: the calls that completed in it, with throughput over its share of the wall clock. Null when the run carries no samples or none fell into the window: an empty window is no evidence that the run ended well.
public BowireBenchmarkStats? ForWindow(BowireRunWindow window)
Parameters
windowBowireRunWindow
Returns
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
latenciesMsIEnumerable<double>Latency of each completed call, in milliseconds.
errorsintHow many calls failed.
elapsedSecondsdoubleWall-clock duration of the run, for throughput.
Returns
From(IEnumerable<double>, int, double, IEnumerable<double>?)
#620 — the statistics of a run that may have streamed:
firstChunksMs holds the time to first chunk of each
completed streamed call, or is null when the run did not stream.
public static BowireBenchmarkStats From(IEnumerable<double> latenciesMs, int errors, double elapsedSeconds, IEnumerable<double>? firstChunksMs)
Parameters
latenciesMsIEnumerable<double>errorsintelapsedSecondsdoublefirstChunksMsIEnumerable<double>
Returns
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
sortedIReadOnlyList<double>percentiledouble
Returns
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. A first-chunk metric of a run that did not stream is NaN.
public double Value(BowireBenchmarkMetric metric)
Parameters
metricBowireBenchmarkMetric
Returns
WithSamples(IReadOnlyList<BowireBenchmarkSample>, double)
#623 — attach the run's samples and wall clock, and
bucket them into Timeline.
public BowireBenchmarkStats WithSamples(IReadOnlyList<BowireBenchmarkSample> samples, double elapsedMs)
Parameters
samplesIReadOnlyList<BowireBenchmarkSample>elapsedMsdouble