mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-20 21:43:19 -07:00
Added FreeBSD memory model
This commit is contained in:
parent
a44b4d74b8
commit
a8f06a8e79
1 changed files with 18 additions and 6 deletions
|
@ -36,6 +36,18 @@ __memory() {
|
||||||
esac
|
esac
|
||||||
[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
|
[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
|
||||||
done < /proc/meminfo
|
done < /proc/meminfo
|
||||||
|
elif [ $(uname) = 'FreeBSD']; then
|
||||||
|
# FreeBSD support
|
||||||
|
# Adapted from https://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt
|
||||||
|
# Copyright (c) 2003-2004 Ralf S. Engelschall <rse@engelschall.com>
|
||||||
|
total=$(($(sysctl -n hw.physmem)/1024))
|
||||||
|
page_size=$(sysctl -n hw.pagesize)
|
||||||
|
vm_inactive=$(($(sysctl -n vm.stats.vm.v_inactive_count)*$page_size))
|
||||||
|
vm_cached=$(($(sysctl -n vm.stats.vm.v_cache_count)*$page_size))
|
||||||
|
vm_free=$(($(sysctl -n vm.stats.vm.v_free_count)*$page_size))
|
||||||
|
free=$((($vm_cached+$vm_free+$vm_inactive)/1024))
|
||||||
|
buffers=0
|
||||||
|
cached=0
|
||||||
elif eval $BYOBU_TEST vm_stat >/dev/null 2>&1; then
|
elif eval $BYOBU_TEST vm_stat >/dev/null 2>&1; then
|
||||||
# MacOS support
|
# MacOS support
|
||||||
# calculation borrowed from http://apple.stackexchange.com/a/48195/18857
|
# calculation borrowed from http://apple.stackexchange.com/a/48195/18857
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue