Fix memory used calculation
@@ -132,7 +132,8 @@ pub struct System {
mem_total: u64,
mem_free: u64,
mem_buffers: u64,
- mem_cache: u64,
+ mem_page_cache: u64,
+ mem_slab_reclaimable: u64,
swap_total: u64,
swap_free: u64,
global_processor: Processor,
@@ -268,7 +269,8 @@ impl SystemExt for System {
mem_total: 0,
mem_free: 0,
mem_buffers: 0,
- mem_cache: 0,
+ mem_page_cache: 0,
+ mem_slab_reclaimable: 0,
swap_total: 0,
swap_free: 0,
global_processor: Processor::new_with_values(
@@ -315,7 +317,8 @@ impl SystemExt for System {
Some("MemTotal") => &mut self.mem_total,
Some("MemFree") => &mut self.mem_free,
Some("Buffers") => &mut self.mem_buffers,
- Some("Cached") => &mut self.mem_cache,
+ Some("Cached") => &mut self.mem_page_cache,
+ Some("SReclaimable") => &mut self.mem_slab_reclaimable,
Some("SwapTotal") => &mut self.swap_total,
Some("SwapFree") => &mut self.swap_free,
_ => continue,
@@ -422,7 +425,7 @@ impl SystemExt for System {
}
fn get_used_memory(&self) -> u64 {
- self.mem_total - self.mem_free - self.mem_buffers - self.mem_cache
+ self.mem_total - self.mem_free - self.mem_buffers - self.mem_page_cache - self.mem_slab_reclaimable
}
fn get_total_swap(&self) -> u64 {
