pub struct MemoryAnalytics {
pub total_allocations: usize,
pub total_deallocations: usize,
pub pool_hits: usize,
pub pool_misses: usize,
pub peak_memory_usage: usize,
pub current_memory_usage: usize,
pub fragmentation_score: f64,
pub avg_allocation_size: usize,
pub estimated_cache_misses: usize,
pub pressure_events: usize,
pub gc_time_us: u64,
}Expand description
Memory usage analytics with advanced metrics
Fields§
§total_allocations: usizeTotal allocations requested
total_deallocations: usizeTotal deallocations
pool_hits: usizePool hits (reused tensors)
pool_misses: usizePool misses (new allocations)
peak_memory_usage: usizePeak memory usage in bytes
current_memory_usage: usizeCurrent memory usage in bytes
fragmentation_score: f64Memory fragmentation score (0.0-1.0, lower is better)
avg_allocation_size: usizeAverage allocation size in bytes
estimated_cache_misses: usizeCache misses (estimated from allocation patterns)
pressure_events: usizeMemory pressure events
gc_time_us: u64Time spent in garbage collection (microseconds)
Implementations§
Source§impl MemoryAnalytics
impl MemoryAnalytics
Sourcepub fn efficiency_ratio(&self) -> f64
pub fn efficiency_ratio(&self) -> f64
Get memory efficiency ratio
Sourcepub fn cache_efficiency(&self) -> f64
pub fn cache_efficiency(&self) -> f64
Get cache efficiency estimate
Sourcepub fn performance_score(&self) -> f64
pub fn performance_score(&self) -> f64
Get overall performance score (0.0-100.0, higher is better)
Sourcepub fn needs_optimization(&self) -> bool
pub fn needs_optimization(&self) -> bool
Check if memory pool needs attention
Sourcepub fn get_optimization_recommendations(&self) -> Vec<String>
pub fn get_optimization_recommendations(&self) -> Vec<String>
Get recommendation for pool optimization
Trait Implementations§
Source§impl Clone for MemoryAnalytics
impl Clone for MemoryAnalytics
Source§fn clone(&self) -> MemoryAnalytics
fn clone(&self) -> MemoryAnalytics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryAnalytics
impl Debug for MemoryAnalytics
Source§impl Default for MemoryAnalytics
impl Default for MemoryAnalytics
Source§fn default() -> MemoryAnalytics
fn default() -> MemoryAnalytics
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemoryAnalytics
impl RefUnwindSafe for MemoryAnalytics
impl Send for MemoryAnalytics
impl Sync for MemoryAnalytics
impl Unpin for MemoryAnalytics
impl UnsafeUnpin for MemoryAnalytics
impl UnwindSafe for MemoryAnalytics
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> 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