Struct tabin_plugins::procfs::MemInfo[][src]

pub struct MemInfo {
    pub total: Option<usize>,
    pub available: Option<usize>,
    pub free: Option<usize>,
    pub cached: Option<usize>,
}

A struct that represents overall memory usage on the system.

All values are in KB.

Fields

total: Option<usize>available: Option<usize>free: Option<usize>cached: Option<usize>

Implementations

impl MemInfo[src]

pub fn load() -> MemInfo[src]

Read the data from /proc/meminfo into a MemInfo

pub fn percent_free(&self) -> Result<f64>[src]

Try to figure out how much memory is being used

Since linux kernel 3.16 this just performs

    available / total * 100

Before that we approximate available as Free + Cached, even though that is almost certain to be incorrect.

pub fn percent_used(&self) -> Result<f64>[src]

The inverse of MemInfo::percent_free

Trait Implementations

impl Debug for MemInfo[src]

impl Eq for MemInfo[src]

impl FromStr for MemInfo[src]

type Err = ProcFsError

The associated error which can be returned from parsing.

fn from_str(meminfo: &str) -> Result<Self>[src]

Convert the contents of a string like /proc/meminfo into a MemInfo object

impl PartialEq<MemInfo> for MemInfo[src]

impl StructuralEq for MemInfo[src]

impl StructuralPartialEq for MemInfo[src]

Auto Trait Implementations

impl RefUnwindSafe for MemInfo

impl Send for MemInfo

impl Sync for MemInfo

impl Unpin for MemInfo

impl UnwindSafe for MemInfo

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.