Update memory calculation

This commit is contained in:
Akemi Izuko 2023-12-23 20:14:17 -07:00
parent 1f3ea1e3f1
commit 110d4851f9
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC

View file

@ -25,15 +25,15 @@ get_volume() {
} }
remaining_ram() { remaining_ram() {
free --mega | awk '/Mem/ { awk '
split($0, a, " ") /MemTotal:/ { memtotal = $2 / 1024**2 }
/MemAvailable:/ { mavailable = $2 / 1024**2 }
used = a[3] / 1000 END {
shared = a[5] / 1000 used = memtotal - mavailable
available = a[7] / 1000 printf "%0.1fG / %.1fG", used, memtotal
}
printf "%0.1fG / %.1fG", used + shared, available ' /proc/meminfo
}'
} }
ramu="$(remaining_ram)" ramu="$(remaining_ram)"