pub struct MemoryInfo {
pub total_mb: u64,
pub available_mb: u64,
pub used_mb: u64,
pub usage_percent: f32,
pub modules: Vec<MemoryModule>,
pub channels: u32,
pub ecc_support: bool,
pub speed_mhz: u32,
pub bandwidth_gb_s: Option<f32>,
pub swap_total_mb: u64,
pub swap_used_mb: u64,
}
Expand description
System memory information
Fields§
§total_mb: u64
Total system memory in MB
available_mb: u64
Available system memory in MB
used_mb: u64
Used system memory in MB
usage_percent: f32
Memory usage percentage
modules: Vec<MemoryModule>
Individual memory modules
channels: u32
Memory channels
ecc_support: bool
ECC support
speed_mhz: u32
Memory speed in MHz
bandwidth_gb_s: Option<f32>
Memory bandwidth in GB/s
swap_total_mb: u64
Swap/virtual memory total in MB
swap_used_mb: u64
Swap/virtual memory used in MB
Implementations§
Source§impl MemoryInfo
impl MemoryInfo
Sourcepub fn available_gb(&self) -> f64
pub fn available_gb(&self) -> f64
Get available memory in GB
Sourcepub fn available_mb(&self) -> u64
pub fn available_mb(&self) -> u64
Get available memory in MB
Sourcepub fn usage_percent(&self) -> f32
pub fn usage_percent(&self) -> f32
Get memory usage percentage
Sourcepub fn ecc_support(&self) -> bool
pub fn ecc_support(&self) -> bool
Check if ECC is supported
Sourcepub fn bandwidth_gb_s(&self) -> Option<f32>
pub fn bandwidth_gb_s(&self) -> Option<f32>
Get memory bandwidth in GB/s
Sourcepub fn swap_total_gb(&self) -> f64
pub fn swap_total_gb(&self) -> f64
Get swap total in GB
Sourcepub fn swap_used_gb(&self) -> f64
pub fn swap_used_gb(&self) -> f64
Get swap used in GB
Sourcepub fn has_sufficient_memory(&self, required_gb: f64) -> bool
pub fn has_sufficient_memory(&self, required_gb: f64) -> bool
Check if system has sufficient memory for a workload
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 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