Skip to main content

BenchmarkRecord

Struct BenchmarkRecord 

pub struct BenchmarkRecord { /* private fields */ }
Available on crate feature 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

pub const fn scenario(&self) -> &'static str

Which scenario produced this record.

pub fn passes(&self) -> &[BenchmarkPass]

Every pass this scenario reported, in the order it ran them.

pub fn pass(&self, label: &str) -> Option<&BenchmarkPass>

The pass under label, if the scenario reported one.

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

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

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)

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.

Trait Implementations§

§

impl Clone for BenchmarkRecord

§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for BenchmarkRecord

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Eq for BenchmarkRecord

§

impl PartialEq for BenchmarkRecord

§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl StructuralPartialEq for BenchmarkRecord

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V