pub struct BenchReport {
pub spec: BenchSpec,
pub samples: Vec<BenchSample>,
}Expand description
Complete benchmark report with all timing samples.
Contains the original specification and all collected samples. Can be serialized to JSON for storage or transmission.
§Example
use mobench_sdk::timing::{BenchSpec, run_closure};
let spec = BenchSpec::new("example", 50, 5)?;
let report = run_closure(spec, || {
std::hint::black_box(42);
Ok(())
})?;
// Calculate statistics
let samples: Vec<u64> = report.samples.iter()
.map(|s| s.duration_ns)
.collect();
let min = samples.iter().min().unwrap();
let max = samples.iter().max().unwrap();
let mean = samples.iter().sum::<u64>() / samples.len() as u64;
println!("Min: {} ns, Max: {} ns, Mean: {} ns", min, max, mean);Fields§
§spec: BenchSpecThe specification used for this benchmark run.
samples: Vec<BenchSample>All collected timing samples.
The length equals spec.iterations. Samples are in execution order.
Implementations§
Source§impl BenchReport
impl BenchReport
Sourcepub fn std_dev_ns(&self) -> f64
pub fn std_dev_ns(&self) -> f64
Returns the standard deviation in nanoseconds (sample std dev, n-1).
Sourcepub fn percentile_ns(&self, p: f64) -> f64
pub fn percentile_ns(&self, p: f64) -> f64
Returns the given percentile (0-100) in nanoseconds.
Sourcepub fn summary(&self) -> BenchSummary
pub fn summary(&self) -> BenchSummary
Returns a statistical summary of the benchmark results.
Trait Implementations§
Source§impl Clone for BenchReport
impl Clone for BenchReport
Source§fn clone(&self) -> BenchReport
fn clone(&self) -> BenchReport
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BenchReport
impl Debug for BenchReport
Source§impl<'de> Deserialize<'de> for BenchReport
impl<'de> Deserialize<'de> for BenchReport
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<BenchReport> for BenchReportFfi
impl From<BenchReport> for BenchReportFfi
Source§fn from(report: RunnerReport) -> Self
fn from(report: RunnerReport) -> Self
Converts to this type from the input type.
Source§impl From<BenchReport> for BenchReportTemplate
impl From<BenchReport> for BenchReportTemplate
Source§fn from(report: RunnerReport) -> Self
fn from(report: RunnerReport) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for BenchReport
impl RefUnwindSafe for BenchReport
impl Send for BenchReport
impl Sync for BenchReport
impl Unpin for BenchReport
impl UnsafeUnpin for BenchReport
impl UnwindSafe for BenchReport
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