Simplify BSD memory function
This commit is contained in:
parent
11c869b50e
commit
7a62379cec
1 changed files with 3 additions and 24 deletions
25
neofetch
25
neofetch
|
@ -1409,30 +1409,9 @@ getmemory () {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"BSD")
|
"BSD")
|
||||||
case "$distro" in
|
memtotal=$(sysctl -n hw.physmem)
|
||||||
"OpenBSD"*)
|
|
||||||
mem=($(top -d 1 | awk -F ': |/| |M' '/Memory:/ {printf $4 " " $6 " " $11 "\n"}'))
|
|
||||||
memtotal=$((${mem[1]} + ${mem[2]}))
|
|
||||||
memused=$((memtotal - ${mem[0]}))
|
|
||||||
;;
|
|
||||||
|
|
||||||
"FreeBSD"*)
|
|
||||||
memtotal=$(dmesg | awk '/real mem/ {printf $5}')
|
|
||||||
memtotal=${memtotal/\(}
|
|
||||||
memtotal=${memtotal/MB\)}
|
|
||||||
memfree=$(top -d 1 | awk '/Mem:/ {printf $10}')
|
|
||||||
memfree=${memfree/M}
|
|
||||||
memused=$((memtotal - memfree))
|
|
||||||
;;
|
|
||||||
|
|
||||||
"NetBSD"*)
|
|
||||||
memfree=$(($(vmstat | awk 'END{printf $4}') / 1000))
|
memfree=$(($(vmstat | awk 'END{printf $4}') / 1000))
|
||||||
memused=$(($(vmstat | awk 'END{printf $3}') / 1000))
|
memused=$((memtotal - ${memfree/M}))
|
||||||
memtotal=$((memused + memfree))
|
|
||||||
memused=$((memtotal - memfree))
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
memory="${memused}MB / ${memtotal}MB"
|
memory="${memused}MB / ${memtotal}MB"
|
||||||
|
|
Loading…
Reference in a new issue