Struct benchmark_rs::benchmarks::Benchmarks
source · pub struct Benchmarks<C, W, E>where
C: Clone + Display,
W: Clone + Display,
Error: From<E>,{ /* private fields */ }Expand description
Run and analyze a benchmarks suite
C- configurationW- workload unitE- error type
Implementations§
source§impl<C, W, E> Benchmarks<C, W, E>where
C: Clone + Display,
W: Clone + Display,
Error: From<E>,
impl<C, W, E> Benchmarks<C, W, E>where C: Clone + Display, W: Clone + Display, Error: From<E>,
sourcepub fn new(name: &str) -> Benchmarks<C, W, E>
pub fn new(name: &str) -> Benchmarks<C, W, E>
Create a new Benchmarks
name- the name of the benchmark session
sourcepub fn add(
&mut self,
name: &str,
f: fn(stop_watch: &mut StopWatch, config: C, workload_point: W) -> Result<(), E>,
config: C,
work: Vec<W>,
repeat: usize,
ramp_up: usize
) -> Result<(), Error>
pub fn add( &mut self, name: &str, f: fn(stop_watch: &mut StopWatch, config: C, workload_point: W) -> Result<(), E>, config: C, work: Vec<W>, repeat: usize, ramp_up: usize ) -> Result<(), Error>
Create and add a Benchmark
name- the name of the benchmark series. The result will be accessible by the name as a key from the summary.f- the function that runs the benchmark.config- the configuration value for this benchmark serieswork- workload points vector for this benchmark series. Elements of this vector are passed tofin each iterationrepeat- number of times the benchmark will be repeatedramp_up- number of times the benchmark will be performed before the measurement is taken
sourcepub fn summary_as_json(&self) -> String
pub fn summary_as_json(&self) -> String
Produce Summary for all series as JSON string.
sourcepub fn csv_headers(&self) -> String
pub fn csv_headers(&self) -> String
Produce headers for Self::summary_as_csv method
sourcepub fn summary_as_csv(&self) -> HashMap<String, Vec<String>>
pub fn summary_as_csv(&self) -> HashMap<String, Vec<String>>
Produce summary for each series as vector of CSV lines. The key for series data is the series name used in Self::add method, values are placed as the headers returned by Self::csv_headers
Auto Trait Implementations§
impl<C, W, E> RefUnwindSafe for Benchmarks<C, W, E>where C: RefUnwindSafe, W: RefUnwindSafe,
impl<C, W, E> Send for Benchmarks<C, W, E>where C: Send, W: Send,
impl<C, W, E> Sync for Benchmarks<C, W, E>where C: Sync, W: Sync,
impl<C, W, E> Unpin for Benchmarks<C, W, E>where C: Unpin, W: Unpin,
impl<C, W, E> UnwindSafe for Benchmarks<C, W, E>where C: UnwindSafe, W: UnwindSafe,
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
Mutably borrows from an owned value. Read more
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.