Struct BenchmarkRecord
pub struct BenchmarkRecord { /* private fields */ }bench only.Expand description
What one benchmark scenario produced.
#[must_use] for RuleOutcome’s reason: a harness that ran a workload and
dropped the answer measured nothing, and the workspace denies warnings, so
an emitter that forgets to report is a red build rather than a quiet one.
Implementations§
§impl BenchmarkRecord
impl BenchmarkRecord
pub fn passes(&self) -> &[BenchmarkPass]
pub fn passes(&self) -> &[BenchmarkPass]
Every pass this scenario reported, in the order it ran them.
pub fn pass(&self, label: &str) -> Option<&BenchmarkPass>
pub fn pass(&self, label: &str) -> Option<&BenchmarkPass>
The pass under label, if the scenario reported one.
pub fn is_well_formed(&self) -> bool
pub fn is_well_formed(&self) -> bool
Whether every pass accounts for every attempt it made.
One of the two things the shipped emitters assert, and the weaker one.
It is a well-formedness check on the record — never a judgement on a
number, which is what keeps a benchmark from failing a merge — and it
says nothing at all about which passes ran, because every counter in a
record built by an aborted scenario adds up just as well as one in a
complete run. is_complete is the other half, and
report asserts both.
pub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether every pass this scenario owes actually ran.
The distinction this preserves is the one the module documentation says
the record exists for: contention produced no rejections and
contention never happened are different measurements, and only the
first is a measurement. A scenario that returned early leaves the pass
that carried its whole point absent rather than zero, and an
absence is exactly what a BENCH line compared across two releases
cannot recover afterwards.
Still not a judgement on a number: an incomplete run is not a slow one, and no threshold exists here at any budget (CF-34).
pub fn summary(&self) -> String
pub fn summary(&self) -> String
Every counter, on one line.
One line and not more, because the gate’s test step runs
-- --show-output so that a declined capability’s SKIP <rule>: … line
reaches a human, and a chatty benchmark would bury exactly the output
that step exists to surface.
pub fn report(self, scenario: &str)
pub fn report(self, scenario: &str)
Reports this record to stdout, under the name of the scenario that produced it.
One line. It asserts that the scenario completed and that the record is well-formed — and nothing about how long anything took, at any budget.
Both halves are checked here, and they are two assertions rather than one because they fail for unrelated reasons and a reader has to be able to tell them apart: a malformed record is a counter that was not incremented, an incomplete one is a pass that never ran.
§Panics
Panics if a pass does not account for every attempt it made, and separately if a pass the scenario owes is absent. Either is a defect in the harness or a store that fell over before the measurement began — never a verdict on how fast anything was.