From a3381b6197d9da30e5d9c4a1608f0f93bc15206c Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 7 Apr 2025 20:40:10 +0200 Subject: [PATCH] sys: add doc-comments for ProcFsMemInfo type Signed-off-by: Thomas Lamprecht --- proxmox-sys/src/linux/procfs/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/proxmox-sys/src/linux/procfs/mod.rs b/proxmox-sys/src/linux/procfs/mod.rs index 30c7281c..c8a7229c 100644 --- a/proxmox-sys/src/linux/procfs/mod.rs +++ b/proxmox-sys/src/linux/procfs/mod.rs @@ -405,13 +405,26 @@ fn test_read_proc_stat() { } #[derive(Debug, Serialize)] +/// Memory stats relevant for Proxmox projects. +/// +/// NOTE: Unlike the name would suggest this is not a 1:1 representation of /proc/meminfo and also +/// includes some other metrics like KSM shared pages gathered from sysfs. +/// Ensure this is what you want if you return this type from your code for others to consume. pub struct ProcFsMemInfo { + /// Total usable RAM, i.e. installed memory minus bad regions and kernel binary code. pub memtotal: u64, + /// Memory that's guaranteed completely unused, almost always quite a bit smaller than the + /// amount of memory actually available for programs. pub memfree: u64, + /// Calculated from subtracting MemAvailable from MemTotal. pub memused: u64, + /// Memory shared through the Kernel Same-Page Merging mechanism. Metric gathered from sysfs. pub memshared: u64, + /// Total amount of swap space available. pub swaptotal: u64, + //// Amount of swap space that is currently unused. pub swapfree: u64, + /// Used swap, i.e., swaptotal - swapfree. pub swapused: u64, }