Memory: [FreeBSD] Fix memory usage

This commit is contained in:
Dylan Araps 2016-12-05 10:51:00 +11:00
parent 13135b698e
commit 4c860aaea4

View file

@ -1083,13 +1083,7 @@ get_memory() {
# Mem free # Mem free
case "$distro" in case "$distro" in
"NetBSD"*) mem_free="$(($(awk -F ':|kB' '/MemFree:/ {printf $2}' /proc/meminfo) / 1024))" ;; "NetBSD"*) mem_free="$(($(awk -F ':|kB' '/MemFree:/ {printf $2}' /proc/meminfo) / 1024))" ;;
"FreeBSD"* | "DragonFly"*) "FreeBSD"* | "DragonFly"*) mem_free="$(top -d 1 | awk -F ',' '/^Mem:/ {print $5}')";;
mem_info=($(sysctl -n hw.pagesize bm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count))
mem_inactive="$((mem_info[1] * meminfo[0]))"
mem_cache="$((mem_info[2] * meminfo[0]))"
mem_free="$((mem_info[3] * meminfo[0]))"
mem_free="$((mem_inactive + mem_cache + mem_free))"
;;
"OpenBSD"*) ;; "OpenBSD"*) ;;
*) mem_free="$(($(vmstat | awk 'END{printf $5}') / 1024))" ;; *) mem_free="$(($(vmstat | awk 'END{printf $5}') / 1024))" ;;
esac esac