RAM

Struct RAM 

Source
pub struct RAM {
Show 57 fields pub total: Size, pub free: Size, pub available: Size, pub buffers: Size, pub cached: Size, pub swap_cached: Size, pub active: Size, pub inactive: Size, pub active_anon: Size, pub inactive_anon: Size, pub active_file: Size, pub inactive_file: Size, pub unevictable: Size, pub mlocked: Size, pub swap_total: Size, pub swap_free: Size, pub zswap: Size, pub zswapped: Size, pub dirty: Size, pub writeback: Size, pub anon_pages: Size, pub mapped: Size, pub shmem: Size, pub kreclaimable: Size, pub slab: Size, pub sreclaimable: Size, pub sunreclaim: Size, pub kernel_stack: Size, pub page_tables: Size, pub sec_page_tables: Size, pub nfs_unstable: Size, pub bounce: Size, pub writeback_tmp: Size, pub commit_limit: Size, pub commited_as: Size, pub vmalloc_total: Size, pub vmalloc_used: Size, pub vmalloc_chunk: Size, pub percpu: Size, pub hardware_corrupted: Size, pub anon_huge_pages: Size, pub shmem_huge_pages: Size, pub shmem_pmd_mapped: Size, pub cma_total: Option<Size>, pub cma_free: Option<Size>, pub file_huge_pages: Size, pub file_pmd_mapped: Size, pub unaccepted: Size, pub huge_pages_total: u32, pub huge_pages_free: u32, pub huge_pages_rsvd: u32, pub huge_pages_surp: u32, pub huge_page_size: Size, pub huge_tlb: Size, pub direct_map_4k: Size, pub direct_map_2m: Size, pub direct_map_1g: Size,
}
Expand description

A structure containing data from the /proc/meminfo file

Fields§

§total: Size

Total usable physical RAM (excludes reserved/firmware memory)

§free: Size

Completely unused physical RAM. Often misleadingly low due to caching

§available: Size

Best estimate of memory available for new apps (accounts for caches/reclaimable memory)

§buffers: Size

Temporary storage for raw disk blocks (e.g. filesystem metadata)

§cached: Size

Page cache for files read from disk (reclaimed when apps need memory)

§swap_cached: Size

Memory swapped out but later accessed, now present in both RAM and swap

§active: Size

Recently used memory (harder to reclaim)

§inactive: Size

Less recently used memory (eased to reclaim)

§active_anon: Size

Active anonymous pages (e.g. heap/stack, not file-backed)

§inactive_anon: Size

Inactive anonymous pages

§active_file: Size

Active file-backed pages (cached files)

§inactive_file: Size

Inactive file-backed pages

§unevictable: Size

Memory that cannot be pages out (e.g. locked with mlock())

§mlocked: Size

Memory that is locked (cannot be swapped out)

§swap_total: Size

Total amount of swap space available

§swap_free: Size

Amount of swap space that is currently unused

§zswap: Size§zswapped: Size§dirty: Size

Data waiting to be written to disk

§writeback: Size

Data actively being written to disk

§anon_pages: Size

Non file-backed pages mapped into user-space page tables

§mapped: Size

Files (like libraries) that have been mapped into memory (also includes tmpfs/shmem)

§shmem: Size

Total memory used by shared memory (shmem) and tmpfs

§kreclaimable: Size

Kernel allocations that the kernel will attempt to reclaim under memory pressure (includes SReclaimable and other reclaimable slabs)

§slab: Size

In-kernel data structures cache (includes SReclaimable and SUnreclaim)

§sreclaimable: Size

Part of Slab that might be reclaimed, such as caches for directory inodes, etc.

§sunreclaim: Size

Part of Slab that cannot be reclaimed

§kernel_stack: Size

Memory used by kernel stacks

§page_tables: Size

Memory used by page tables (to map virtual to physical addresses)

§sec_page_tables: Size§nfs_unstable: Size

Memory that has been sent to the NFS server but not yet committed to stable storage

§bounce: Size

Memory used for block device bounce buffers (rarely used on modern systems)

§writeback_tmp: Size

Memory used by FUSE for temporary writeback buffers

§commit_limit: Size

Based on the overcommit ratio, this is the total amount of memory currently available to be allocated

§commited_as: Size

he amount of memory currently allocated by the system. The kernel may overcommit this

§vmalloc_total: Size

Total size of vmalloc memory area

§vmalloc_used: Size

Amount of vmalloc area which is used

§vmalloc_chunk: Size

Largest contiguous block of free vmalloc space

§percpu: Size

Memory used for per-cpu allocations (each CPU has its own block)

§hardware_corrupted: Size

Memory that the kernel identified as corrupted (when CONFIG_MEMORY_FAILURE is enabled)

§anon_huge_pages: Size

Non-file backed huge pages mapped into user-space page tables (transparent hugepages)

§shmem_huge_pages: Size

Huge pages used by shared memory (shmem) and tmpfs.

§shmem_pmd_mapped: Size

shmem/tmpfs memory that is mapped into user space with huge pages

§cma_total: Option<Size>

Total CMA (Contiguous Memory Allocator) area

§cma_free: Option<Size>

Free memory in the CMA area

§file_huge_pages: Size§file_pmd_mapped: Size§unaccepted: Size§huge_pages_total: u32§huge_pages_free: u32§huge_pages_rsvd: u32§huge_pages_surp: u32§huge_page_size: Size§huge_tlb: Size§direct_map_4k: Size§direct_map_2m: Size§direct_map_1g: Size

Implementations§

Source§

impl RAM

Source

pub fn new() -> Result<Self>

Source

pub fn used_ram(&self, base: u8) -> Size

Source

pub fn usage_percentage(&self) -> Option<f64>

Trait Implementations§

Source§

impl Clone for RAM

Source§

fn clone(&self) -> RAM

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RAM

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RAM

Source§

fn default() -> RAM

Returns the “default value” for a type. Read more
Source§

impl Serialize for RAM

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToJson for RAM

Source§

fn to_json(&self) -> Result<String>
where Self: Serialize,

Convert object data to machine-readable JSON format (without unnecessary indentation and newline transitions)
Source§

fn to_json_pretty(&self) -> Result<String>
where Self: Serialize,

Convert object data to human-readable JSON format (“pretty”; with additional newline transitions and indentation)

Auto Trait Implementations§

§

impl Freeze for RAM

§

impl RefUnwindSafe for RAM

§

impl Send for RAM

§

impl Sync for RAM

§

impl Unpin for RAM

§

impl UnwindSafe for RAM

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more