Skip to main content

PerformanceProfiler

Struct PerformanceProfiler 

Source
pub struct PerformanceProfiler { /* private fields */ }
Expand description

Performance profiler for capturing metrics

Implementations§

Source§

impl PerformanceProfiler

Source

pub fn new(test_name: &str) -> Self

Create a new profiler

Source

pub fn start(&mut self)

Start profiling

Source

pub fn stop(&mut self) -> PerformanceProfile

Stop profiling

Source

pub const fn is_active(&self) -> bool

Check if profiling is active

Source

pub fn elapsed_ms(&self) -> u64

Get elapsed time in milliseconds

Source

pub fn record(&mut self, measurement: Measurement)

Record a measurement

Source

pub fn record_frame_time(&mut self, ms: f64)

Record a frame time

Source

pub fn record_timing(&mut self, name: &str, ms: f64)

Record a custom timing

Source

pub fn record_memory(&mut self, name: &str, bytes: u64)

Record memory usage

Source

pub fn start_timer(&mut self, name: &str)

Start a timer

Source

pub fn stop_timer(&mut self, name: &str) -> Option<f64>

Stop a timer and record the measurement

Source

pub fn add_threshold(&mut self, threshold: PerformanceThreshold)

Add a threshold

Source

pub fn check_thresholds(&self) -> ProbarResult<()>

Check all thresholds

Source

pub fn profile(&self) -> &PerformanceProfile

Get current profile

Source

pub fn stats(&self, name: &str) -> Option<MetricStats>

Get statistics for a metric

Source

pub fn measure<F, T>(&mut self, name: &str, f: F) -> T
where F: FnOnce() -> T,

Measure a closure

Trait Implementations§

Source§

impl Debug for PerformanceProfiler

Source§

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

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

impl Default for PerformanceProfiler

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.