Update memory calculation
This commit is contained in:
parent
1f3ea1e3f1
commit
110d4851f9
|
@ -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)"
|
||||||
|
|
Loading…
Reference in a new issue