Windows memory usage (untested)

This commit is contained in:
dylan araps 2016-01-05 17:10:34 +11:00
parent 18d465a6d2
commit 9f1c18e90d
1 changed files with 14 additions and 0 deletions

View File

@ -522,6 +522,20 @@ getmemory () {
memory="${memused}MB / ${memtotal}MB" memory="${memused}MB / ${memtotal}MB"
;; ;;
"Windows")
mem="$(awk 'NR < 3 {printf $2 " "}' /proc/meminfo)"
# Split the string above into 2 vars
# This is faster than using an array.
set $mem
memtotal=$1
memfree=$2
memavail=$((memtotal - memfree))
memused=$((memtotal - memavail))
memory="$(( ${memused%% *} / 1024))MB / $(( ${memtotal%% *} / 1024))MB"
;;
*) *)
memory="Unknown" memory="Unknown"
;; ;;