pub struct MemoryInfo {
pub total_bytes: u64,
pub used_bytes: u64,
pub free_bytes: u64,
pub reserved_bytes: u64,
pub active_allocations: usize,
pub fragmentation_ratio: f32,
pub bandwidth_gbps: Option<f32>,
}Expand description
Memory information for a device
Fields§
§total_bytes: u64Total memory available on device (bytes)
used_bytes: u64Currently used memory (bytes)
free_bytes: u64Free memory available (bytes)
reserved_bytes: u64Memory reserved by the runtime/driver (bytes)
active_allocations: usizeNumber of active allocations
fragmentation_ratio: f32Memory fragmentation ratio (0.0 - 1.0)
bandwidth_gbps: Option<f32>Memory bandwidth (GB/s)
Implementations§
Source§impl MemoryInfo
impl MemoryInfo
Sourcepub fn utilization_percent(&self) -> f32
pub fn utilization_percent(&self) -> f32
Calculate memory utilization percentage
Sourcepub fn pressure_level(&self) -> MemoryPressure
pub fn pressure_level(&self) -> MemoryPressure
Check if memory is under pressure
Trait Implementations§
Source§impl Clone for MemoryInfo
impl Clone for MemoryInfo
Source§fn clone(&self) -> MemoryInfo
fn clone(&self) -> MemoryInfo
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 MemoryInfo
impl Debug for MemoryInfo
Source§impl<'de> Deserialize<'de> for MemoryInfo
impl<'de> Deserialize<'de> for MemoryInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MemoryInfo
impl RefUnwindSafe for MemoryInfo
impl Send for MemoryInfo
impl Sync for MemoryInfo
impl Unpin for MemoryInfo
impl UnsafeUnpin for MemoryInfo
impl UnwindSafe for MemoryInfo
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