Struct Profiler
pub struct Profiler { /* private fields */ }Implementations§
§impl Profiler
impl Profiler
pub fn register(&mut self, name: &str, budget: Duration) -> CounterId
pub fn try_register(
&mut self,
name: &str,
budget: Duration,
) -> Option<CounterId>
pub fn try_register( &mut self, name: &str, budget: Duration, ) -> Option<CounterId>
Existing names retain their initial budget. Names are 1..=128 UTF-8 bytes.
pub fn record(&mut self, id: CounterId, duration: Duration)
pub fn try_record(&mut self, id: CounterId, duration: Duration) -> bool
pub fn measure<T>(&mut self, id: CounterId, f: impl FnOnce() -> T) -> T
pub fn measure<T>(&mut self, id: CounterId, f: impl FnOnce() -> T) -> T
Native convenience. Browser callers supply performance.now through measure_with_clock.
pub fn measure_with_clock<T>( &mut self, id: CounterId, now: impl FnMut() -> Duration, f: impl FnOnce() -> T, ) -> T
pub fn reset(&mut self, id: CounterId) -> bool
pub fn reset(&mut self, id: CounterId) -> bool
Clear one counter’s history while preserving its name, budget and ID.
pub fn reset_all(&mut self)
pub fn reset_all(&mut self)
Begin a fresh profiling capture without invalidating registered IDs.
pub fn set_budget(&mut self, id: CounterId, budget: Duration) -> bool
pub fn set_budget(&mut self, id: CounterId, budget: Duration) -> bool
Change a live counter’s budget without clearing its samples.
pub fn budget(&self, id: CounterId) -> Option<Duration>
pub fn percentile_us(&self, id: CounterId, percent: u8) -> Option<u64>
pub fn percentile_us(&self, id: CounterId, percent: u8) -> Option<u64>
Nearest-rank percentile in microseconds. Percentiles 0 and 100 return min/max; empty captures, invalid IDs and percentages above 100 return None.
pub fn samples_us(&self, id: CounterId) -> Option<impl Iterator<Item = u64>>
pub fn samples_us(&self, id: CounterId) -> Option<impl Iterator<Item = u64>>
Visit the retained window oldest-first without allocating a capture Vec.
pub fn summary(&self, id: CounterId) -> Summary
pub fn try_summary(&self, id: CounterId) -> Option<Summary>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Profiler
impl RefUnwindSafe for Profiler
impl Send for Profiler
impl Sync for Profiler
impl Unpin for Profiler
impl UnwindSafe for Profiler
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