pub struct MemoryProfiler { /* private fields */ }Expand description
Memory profiler for tracking allocations and deallocations
Implementations§
Source§impl MemoryProfiler
impl MemoryProfiler
Sourcepub fn record_allocation(&self, ptr: usize, size: usize) -> TorshResult<()>
pub fn record_allocation(&self, ptr: usize, size: usize) -> TorshResult<()>
Record memory allocation
Sourcepub fn record_deallocation(&self, ptr: usize) -> TorshResult<()>
pub fn record_deallocation(&self, ptr: usize) -> TorshResult<()>
Record memory deallocation
Sourcepub fn get_stats(&self) -> TorshResult<MemoryStats>
pub fn get_stats(&self) -> TorshResult<MemoryStats>
Get current memory statistics
Sourcepub fn reset(&self) -> TorshResult<()>
pub fn reset(&self) -> TorshResult<()>
Reset memory statistics
Sourcepub fn set_leak_detection_enabled(&mut self, enabled: bool)
pub fn set_leak_detection_enabled(&mut self, enabled: bool)
Enable or disable leak detection
Sourcepub fn is_leak_detection_enabled(&self) -> bool
pub fn is_leak_detection_enabled(&self) -> bool
Check if leak detection is enabled
Sourcepub fn set_timeline_enabled(&mut self, enabled: bool)
pub fn set_timeline_enabled(&mut self, enabled: bool)
Enable or disable timeline tracking
Sourcepub fn is_timeline_enabled(&self) -> bool
pub fn is_timeline_enabled(&self) -> bool
Check if timeline tracking is enabled
Sourcepub fn set_fragmentation_enabled(&mut self, enabled: bool)
pub fn set_fragmentation_enabled(&mut self, enabled: bool)
Enable or disable fragmentation analysis
Sourcepub fn is_fragmentation_enabled(&self) -> bool
pub fn is_fragmentation_enabled(&self) -> bool
Check if fragmentation analysis is enabled
Sourcepub fn set_memory_pool_size(&mut self, size: usize)
pub fn set_memory_pool_size(&mut self, size: usize)
Set the memory pool size for fragmentation analysis
Sourcepub fn record_allocation_with_trace(
&self,
ptr: usize,
size: usize,
stack_trace: Option<String>,
) -> TorshResult<()>
pub fn record_allocation_with_trace( &self, ptr: usize, size: usize, stack_trace: Option<String>, ) -> TorshResult<()>
Record memory allocation with optional stack trace
Sourcepub fn detect_leaks(&self) -> TorshResult<LeakDetectionResults>
pub fn detect_leaks(&self) -> TorshResult<LeakDetectionResults>
Detect memory leaks
Sourcepub fn get_leaks_older_than(
&self,
duration: Duration,
) -> TorshResult<LeakDetectionResults>
pub fn get_leaks_older_than( &self, duration: Duration, ) -> TorshResult<LeakDetectionResults>
Get leaks older than a specific duration
Sourcepub fn get_largest_leaks(
&self,
count: usize,
) -> TorshResult<LeakDetectionResults>
pub fn get_largest_leaks( &self, count: usize, ) -> TorshResult<LeakDetectionResults>
Get the largest potential leaks
Sourcepub fn analyze_fragmentation(&self) -> TorshResult<FragmentationAnalysis>
pub fn analyze_fragmentation(&self) -> TorshResult<FragmentationAnalysis>
Analyze memory fragmentation
Sourcepub fn get_timeline_analysis(&self) -> TorshResult<MemoryTimeline>
pub fn get_timeline_analysis(&self) -> TorshResult<MemoryTimeline>
Get memory timeline analysis
Sourcepub fn export_timeline_csv(&self, path: &str) -> TorshResult<()>
pub fn export_timeline_csv(&self, path: &str) -> TorshResult<()>
Export timeline to CSV format
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryProfiler
impl RefUnwindSafe for MemoryProfiler
impl Send for MemoryProfiler
impl Sync for MemoryProfiler
impl Unpin for MemoryProfiler
impl UnsafeUnpin 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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ProfiledStruct for T
impl<T> ProfiledStruct for T
Source§fn profiled_method<F, R>(&self, method_name: &str, func: F) -> Rwhere
F: FnOnce(&Self) -> R,
fn profiled_method<F, R>(&self, method_name: &str, func: F) -> Rwhere
F: FnOnce(&Self) -> R,
Execute a method with profiling
Source§fn profiled_method_mut<F, R>(&mut self, method_name: &str, func: F) -> Rwhere
F: FnOnce(&mut Self) -> R,
fn profiled_method_mut<F, R>(&mut self, method_name: &str, func: F) -> Rwhere
F: FnOnce(&mut Self) -> R,
Execute a mutable method with profiling