Update memory calculation
This commit is contained in:
parent
1f3ea1e3f1
commit
110d4851f9
1 changed files with 8 additions and 8 deletions
|
@ -25,15 +25,15 @@ get_volume() {
|
|||
}
|
||||
|
||||
remaining_ram() {
|
||||
free --mega | awk '/Mem/ {
|
||||
split($0, a, " ")
|
||||
awk '
|
||||
/MemTotal:/ { memtotal = $2 / 1024**2 }
|
||||
/MemAvailable:/ { mavailable = $2 / 1024**2 }
|
||||
|
||||
used = a[3] / 1000
|
||||
shared = a[5] / 1000
|
||||
available = a[7] / 1000
|
||||
|
||||
printf "%0.1fG / %.1fG", used + shared, available
|
||||
}'
|
||||
END {
|
||||
used = memtotal - mavailable
|
||||
printf "%0.1fG / %.1fG", used, memtotal
|
||||
}
|
||||
' /proc/meminfo
|
||||
}
|
||||
|
||||
ramu="$(remaining_ram)"
|
||||
|
|
Loading…
Reference in a new issue