Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/uu/vmstat/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ pub struct Meminfo {
pub mem_available: bytesize::ByteSize,
pub buffers: bytesize::ByteSize,
pub cached: bytesize::ByteSize,
pub s_reclaimable: bytesize::ByteSize,
pub swap_cached: bytesize::ByteSize,
pub active: bytesize::ByteSize,
pub inactive: bytesize::ByteSize,
Expand All @@ -226,6 +227,8 @@ impl Meminfo {
bytesize::ByteSize::from_str(proc_map.get("MemAvailable").unwrap()).unwrap();
let buffers = bytesize::ByteSize::from_str(proc_map.get("Buffers").unwrap()).unwrap();
let cached = bytesize::ByteSize::from_str(proc_map.get("Cached").unwrap()).unwrap();
let s_reclaimable =
bytesize::ByteSize::from_str(proc_map.get("SReclaimable").unwrap()).unwrap();
let swap_cached =
bytesize::ByteSize::from_str(proc_map.get("SwapCached").unwrap()).unwrap();
let active = bytesize::ByteSize::from_str(proc_map.get("Active").unwrap()).unwrap();
Expand All @@ -238,6 +241,7 @@ impl Meminfo {
mem_available,
buffers,
cached,
s_reclaimable,
swap_cached,
active,
inactive,
Expand Down
5 changes: 4 additions & 1 deletion src/uu/vmstat/src/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,10 @@ fn get_memory_info(
}

let buffer = with_unit(memory_info.buffers.as_u64(), matches);
let cache = with_unit(memory_info.cached.as_u64(), matches);
let cache = with_unit(
(memory_info.cached + memory_info.s_reclaimable).as_u64(),
matches,
);

vec![
(len, format!("{swap_used}")),
Expand Down
Loading