From 3bab3f7386839adf5ce903191d129a6a96c266f9 Mon Sep 17 00:00:00 2001 From: Eric Luo Date: Wed, 29 May 2024 16:11:46 +0800 Subject: [PATCH] Fix MacOS RAM usage calculation in ram_info.sh --- scripts/ram_info.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index 59b24b59..07b69f9a 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -18,7 +18,7 @@ get_ratio() Darwin) # Get used memory blocks with vm_stat, multiply by page size to get size in bytes, then convert to MiB - used_mem=$(vm_stat | grep ' active\|wired ' | sed 's/[^0-9]//g' | paste -sd ' ' - | awk -v pagesize=$(pagesize) '{printf "%d\n", ($1+$2) * pagesize / 1048576}') + used_mem=$(vm_stat | grep ' active\|wired\|compressor\|speculative' | sed 's/[^0-9]//g' | paste -sd ' ' - | awk -v pagesize=$(pagesize) '{printf "%d\n", ($1+$2+$3+$5) * pagesize / 1048576}') # System Profiler performs an activation lock check, which can result in # time outs or a lagged response. (~10 seconds) # total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}')