pub struct Profiler { /* private fields */ }Expand description
Profiler for recording performance events
Implementations§
Source§impl Profiler
impl Profiler
Sourcepub fn new(config: ProfileConfig) -> Self
pub fn new(config: ProfileConfig) -> Self
Create a new profiler
Sourcepub fn scope(
&self,
name: impl Into<String>,
category: impl Into<String>,
) -> ProfileScope
pub fn scope( &self, name: impl Into<String>, category: impl Into<String>, ) -> ProfileScope
Start profiling a named operation
§Returns
A ProfileScope that automatically records duration on drop
Sourcepub fn record(&self, event: ProfileEvent)
pub fn record(&self, event: ProfileEvent)
Record an event
Sourcepub fn events(&self) -> Vec<ProfileEvent>
pub fn events(&self) -> Vec<ProfileEvent>
Get all recorded events
Sourcepub fn report(&self) -> ProfileReport
pub fn report(&self) -> ProfileReport
Generate profiling report
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if profiling is enabled
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more