expanded comment to explain method.

This commit is contained in:
Twan Stok 2023-03-13 03:37:23 +01:00
parent dbed44198b
commit 1c3bfdb0f9

View File

@ -37,7 +37,8 @@ pub(crate) fn get_swap_usage(sys: &System) -> Option<MemHarvest> {
})
}
/// Returns cache usage.
/// 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. TODO: hide on windows?
pub(crate) fn get_cache_usage(sys: &System) -> Option<MemHarvest> {
let mem_used_in_kib = (sys.available_memory() - sys.free_memory()) / 1024;
let mem_total_in_kib = sys.total_memory() / 1024;