Fix memory usage on BSD

master
Dylan 10 years ago
parent b6b4e09287
commit 04ba1d2c3b
  1. 20
      fetch

20
fetch

@ -641,25 +641,23 @@ getmemory () {
memory="${memused}MB / ${memtotal}MB" memory="${memused}MB / ${memtotal}MB"
;; ;;
"FreeBSD") "BSD")
memtotal=$(dmesg | awk '/real mem/ {printf $5}') memtotal=$(dmesg | awk '/real mem/ {printf $5}')
memtotal=${memtotal/\(/} memtotal=${memtotal/\(/}
memtotal=${memtotal/)MB/} memtotal=${memtotal/MB\)/}
memfree=$(top -d 1 | awk '/Mem:/ {printf $10}')
memfree=${memfree/M/}
memused=$((memtotal - memfree))
memory="${memused}MB / ${memtotal}MB" case "$distro" in
"FreeBSD")
memfree=$(top -d 1 | awk '/Mem:/ {printf $10}')
;; ;;
*"BSD") *)
memtotal=$(dmesg | awk '/real mem/ {printf $5}')
memtotal=${memtotal/\(/}
memtotal=${memtotal/MB\)/}
memfree=$(top -d 1 | awk '/Real:/ {print $6}') memfree=$(top -d 1 | awk '/Real:/ {print $6}')
;;
esac
memfree=${memfree/M/} memfree=${memfree/M/}
memused=$((memtotal - memfree)) memused=$((memtotal - memfree))
memory="${memused}MB / ${memtotal}MB" memory="${memused}MB / ${memtotal}MB"
;; ;;

Loading…
Cancel
Save