pub struct MemoryProfiler { /* private fields */ }Expand description
Memory profiler for tracking allocations and performance
Implementations§
Source§impl MemoryProfiler
impl MemoryProfiler
Sourcepub fn record_allocation(&mut self, operation: &str, size: usize)
pub fn record_allocation(&mut self, operation: &str, size: usize)
Record an allocation
Sourcepub fn record_deallocation(&mut self, operation: &str, size: usize)
pub fn record_deallocation(&mut self, operation: &str, size: usize)
Record a deallocation
Sourcepub fn start_scope(&mut self, name: &str)
pub fn start_scope(&mut self, name: &str)
Start a profiling scope
Sourcepub fn current_memory(&self) -> usize
pub fn current_memory(&self) -> usize
Get current memory usage
Sourcepub fn peak_memory(&self) -> usize
pub fn peak_memory(&self) -> usize
Get peak memory usage
Sourcepub fn total_allocations(&self) -> usize
pub fn total_allocations(&self) -> usize
Get total number of allocation events
Sourcepub fn total_deallocations(&self) -> usize
pub fn total_deallocations(&self) -> usize
Get total number of deallocation events
Sourcepub fn total_bytes_allocated(&self) -> usize
pub fn total_bytes_allocated(&self) -> usize
Get total bytes allocated
Sourcepub fn total_bytes_deallocated(&self) -> usize
pub fn total_bytes_deallocated(&self) -> usize
Get total bytes deallocated
Sourcepub fn check_leaks(&self) -> Vec<String>
pub fn check_leaks(&self) -> Vec<String>
Check for potential memory leaks
Sourcepub fn scope_stats(&self, name: &str) -> Option<&ScopeStats>
pub fn scope_stats(&self, name: &str) -> Option<&ScopeStats>
Get statistics for a specific scope
Sourcepub fn all_scopes(&self) -> &HashMap<String, ScopeStats>
pub fn all_scopes(&self) -> &HashMap<String, ScopeStats>
Get all scope statistics
Sourcepub fn events(&self) -> &[AllocationEvent]
pub fn events(&self) -> &[AllocationEvent]
Get all events
Trait Implementations§
Source§impl Debug for MemoryProfiler
impl Debug for MemoryProfiler
Auto Trait Implementations§
impl Freeze for MemoryProfiler
impl RefUnwindSafe for MemoryProfiler
impl Send for MemoryProfiler
impl Sync for MemoryProfiler
impl Unpin for MemoryProfiler
impl UnwindSafe for MemoryProfiler
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> 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