Skip to main content

BenchReport

Struct BenchReport 

Source
pub struct BenchReport {
    pub spec: BenchSpec,
    pub samples: Vec<BenchSample>,
    pub phases: Vec<SemanticPhase>,
    pub timeline: Vec<HarnessTimelineSpan>,
}
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: BenchSpec

The specification used for this benchmark run.

§samples: Vec<BenchSample>

All collected timing samples.

The length equals spec.iterations. Samples are in execution order.

§phases: Vec<SemanticPhase>

Optional semantic phase timings captured during measured iterations.

Defaults to an empty vector when deserializing reports produced by older mobench versions that did not emit phase data.

§timeline: Vec<HarnessTimelineSpan>

Exact harness timeline spans in execution order.

Defaults to an empty vector when deserializing reports produced by older mobench versions that did not emit timeline data.

Implementations§

Source§

impl BenchReport

Source

pub fn mean_ns(&self) -> f64

Returns the mean (average) duration in nanoseconds.

Source

pub fn median_ns(&self) -> f64

Returns the median duration in nanoseconds.

Source

pub fn std_dev_ns(&self) -> f64

Returns the standard deviation in nanoseconds (sample std dev, n-1).

Source

pub fn percentile_ns(&self, p: f64) -> f64

Returns the given percentile (0-100) in nanoseconds.

Source

pub fn min_ns(&self) -> u64

Returns the minimum duration in nanoseconds.

Source

pub fn max_ns(&self) -> u64

Returns the maximum duration in nanoseconds.

Source

pub fn cpu_total_ms(&self) -> Option<u64>

Returns the total measured CPU time in milliseconds across all iterations.

Source

pub fn cpu_median_ms(&self) -> Option<u64>

Returns the median measured CPU time in milliseconds across all iterations.

Source

pub fn peak_memory_kb(&self) -> Option<u64>

Returns the maximum baseline-adjusted peak memory growth in kilobytes.

This is the legacy accessor for the serialized peak_memory_kb sample field. It does not report absolute process or device peak memory.

Source

pub fn peak_memory_growth_kb(&self) -> Option<u64>

Returns the maximum baseline-adjusted peak memory growth in kilobytes.

This is an explicit alias for BenchReport::peak_memory_kb to make the growth semantics clear while preserving the legacy wire field.

Source

pub fn process_peak_memory_kb(&self) -> Option<u64>

Returns the maximum process resident memory peak in kilobytes.

This reports the current benchmark process peak sampled during measured iterations. It excludes BrowserStack/session-level provider memory.

Source

pub fn summary(&self) -> BenchSummary

Returns a statistical summary of the benchmark results.

Trait Implementations§

Source§

impl Clone for BenchReport

Source§

fn clone(&self) -> BenchReport

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BenchReport

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BenchReport

Source§

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

Source§

fn from(report: RunnerReport) -> Self

Converts to this type from the input type.
Source§

impl From<BenchReport> for BenchReportTemplate

Source§

fn from(report: RunnerReport) -> Self

Converts to this type from the input type.
Source§

impl Serialize for BenchReport

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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
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> FromFfi<U> for T
where T: From<U>,

Source§

fn from_ffi(ffi: U) -> T

Convert from FFI representation to SDK type.
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.

Source§

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

Source§

fn into_ffi(self) -> U

Convert self into the FFI representation.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,