Skip to content

Commit

Permalink
Merge pull request #269 from lxneng/fix-osx-ram-usage
Browse files Browse the repository at this point in the history
Fix MacOS RAM usage calculation in ram_info.sh
  • Loading branch information
ethancedwards8 authored Aug 18, 2024
2 parents c2b1d67 + 3bab3f7 commit b59db11
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/ram_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down

0 comments on commit b59db11

Please sign in to comment.