memory: Support MemAvailable
This commit is contained in:
parent
a4f9cb96e9
commit
754d6c6bc9
16
pfetch
16
pfetch
|
@ -599,10 +599,26 @@ get_memory() {
|
||||||
(MemFree|Buffers|Cached|SReclaimable)
|
(MemFree|Buffers|Cached|SReclaimable)
|
||||||
mem_used=$((mem_used - val))
|
mem_used=$((mem_used - val))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
# If detected this will be used over the above calculation
|
||||||
|
# for mem_used. Available since Linux 3.14rc.
|
||||||
|
# See kernel commit 34e431b0ae398fc54ea69ff85ec700722c9da773
|
||||||
|
(MemAvailable)
|
||||||
|
mem_avail=$val
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done < /proc/meminfo
|
done < /proc/meminfo
|
||||||
|
|
||||||
|
case $mem_avail in
|
||||||
|
(*[0-9]*)
|
||||||
|
mem_used=$(((mem_full - mem_avail) / 1024))
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
mem_used=$((mem_used / 1024))
|
mem_used=$((mem_used / 1024))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
mem_full=$((mem_full / 1024))
|
mem_full=$((mem_full / 1024))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user