pub struct Benchmarks { /* private fields */ }Expand description
A collection of registerd benchmarks.
Implementations§
Source§impl Benchmarks
impl Benchmarks
Sourcepub fn register<T>(
&mut self,
name: impl Into<String>,
benchmark: impl Fn(T::Type<'_>, Checkpoint<'_>, &mut dyn Output) -> Result<Value> + 'static,
)
pub fn register<T>( &mut self, name: impl Into<String>, benchmark: impl Fn(T::Type<'_>, Checkpoint<'_>, &mut dyn Output) -> Result<Value> + 'static, )
Register a new benchmark with the given name.
The type parameter T is used to match this benchmark with a registered
crate::Any, which is determined using by <T as DispatchRule<&Any>>.
Sourcepub fn has_match(&self, job: &Any) -> bool
pub fn has_match(&self, job: &Any) -> bool
Return true if job matches with any registerd benchmark. Otherwise, return false.
Sourcepub fn call(
&self,
job: &Any,
checkpoint: Checkpoint<'_>,
output: &mut dyn Output,
) -> Result<Value>
pub fn call( &self, job: &Any, checkpoint: Checkpoint<'_>, output: &mut dyn Output, ) -> Result<Value>
Attempt to the best matching benchmark for job - forwarding the checkpoint and
output to the benchmark.
Returns the results of the benchmark if successful.
Errors if a suitable method could not be found or if the invoked benchmark failed.
Sourcepub fn debug(&self, job: &Any, methods: usize) -> Result<(), Vec<Mismatch>>
pub fn debug(&self, job: &Any, methods: usize) -> Result<(), Vec<Mismatch>>
Attempt to debug reasons for a missed dispatch, returning at most methods reasons.
This implementation works by invoking DispatchRule::try_match with
job on all registered benchmarks. If no successful matches are found, the lowest
ranking crate::dispatcher::FailureScores are collected and used to report details
of the nearest misses using DispatchRule::description.
Returns Ok(()) is a match was found.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Benchmarks
impl !RefUnwindSafe for Benchmarks
impl !Send for Benchmarks
impl !Sync for Benchmarks
impl Unpin for Benchmarks
impl UnsafeUnpin for Benchmarks
impl !UnwindSafe for Benchmarks
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> DispatchRule<T> for T
impl<T> DispatchRule<T> for T
Source§type Error = Infallible
type Error = Infallible
convert.Source§fn try_match(_from: &T) -> Result<MatchScore, FailureScore>
fn try_match(_from: &T) -> Result<MatchScore, FailureScore>
Source§fn convert(from: T) -> Result<T, <T as DispatchRule<T>>::Error>
fn convert(from: T) -> Result<T, <T as DispatchRule<T>>::Error>
Source§fn description(f: &mut Formatter<'_>, from: Option<&T>) -> Result<(), Error>
fn description(f: &mut Formatter<'_>, from: Option<&T>) -> Result<(), Error>
Source§fn try_match_verbose<'a>(
from: &'a From,
) -> Result<MatchScore, TaggedFailureScore<'a>>where
Self: 'a,
fn try_match_verbose<'a>(
from: &'a From,
) -> Result<MatchScore, TaggedFailureScore<'a>>where
Self: 'a,
try_match but returns a reason for a failed score. Read more