From feb3e68d7500a185cb5f2950b36b459c58b8907d Mon Sep 17 00:00:00 2001 From: Twan Stok Date: Fri, 31 Mar 2023 03:42:29 +0200 Subject: [PATCH] added documentation to cache memory data collection --- src/app/data_harvester/memory/sysinfo.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/data_harvester/memory/sysinfo.rs b/src/app/data_harvester/memory/sysinfo.rs index 63e16111..533b86bd 100644 --- a/src/app/data_harvester/memory/sysinfo.rs +++ b/src/app/data_harvester/memory/sysinfo.rs @@ -38,7 +38,11 @@ pub(crate) fn get_swap_usage(sys: &System) -> Option { } /// Returns cache usage. sysinfo has no way to do this directly but it should equal the difference -/// between the available and free memory. On windows, this will always be 0. +/// between the available and free memory. Free memory is defined as memory not containing any data, +/// which means cache and buffer memory are not "free". Available memory is defined as memory able +/// to be allocated by processes, which includes cache and buffer memory. On Windows, this will +/// always be 0. For more information, see [docs](https://docs.rs/sysinfo/0.28.4/sysinfo/trait.SystemExt.html#tymethod.available_memory) +/// and [memory explanation](https://askubuntu.com/questions/867068/what-is-available-memory-while-using-free-command) #[cfg(not(target_os = "windows"))] pub(crate) fn get_cache_usage(sys: &System) -> Option { let mem_used = sys.available_memory() - sys.free_memory();