Memory: Use simpler math
This commit is contained in:
parent
b9606cf611
commit
26809f8eca
1 changed files with 5 additions and 5 deletions
10
neofetch
10
neofetch
|
@ -1026,7 +1026,7 @@ get_memory() {
|
|||
;;
|
||||
|
||||
"Mac OS X" | "iPhone OS")
|
||||
memtotal="$(($(sysctl -n hw.memsize) / 1024 / 1024))"
|
||||
memtotal="$(($(sysctl -n hw.memsize) / 1024^2))"
|
||||
memwired="$(vm_stat | awk '/wired/ { print $4 }')"
|
||||
memactive="$(vm_stat | awk '/active / { printf $3 }')"
|
||||
memcompressed="$(vm_stat | awk '/occupied/ { printf $5 }')"
|
||||
|
@ -1037,12 +1037,12 @@ get_memory() {
|
|||
case "$distro" in
|
||||
"NetBSD"*)
|
||||
memfree="$(($(awk -F ':|kB' '/MemFree:/ {printf $2}' /proc/meminfo) / 1024))"
|
||||
memtotal="$(($(sysctl -n hw.physmem64) / 1024 / 1024))"
|
||||
memtotal="$(($(sysctl -n hw.physmem64) / 1024^2))"
|
||||
;;
|
||||
|
||||
*)
|
||||
memfree="$(($(vmstat | awk 'END{printf $5}') / 1024))"
|
||||
memtotal="$(($(sysctl -n hw.physmem) / 1024 / 1024))"
|
||||
memtotal="$(($(sysctl -n hw.physmem) / 1024^2))"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -1059,9 +1059,9 @@ get_memory() {
|
|||
;;
|
||||
|
||||
"Haiku")
|
||||
memtotal="$(($(sysinfo -mem | awk -F '\\/ |)' '{print $2; exit}') / 1024 / 1024))"
|
||||
memtotal="$(($(sysinfo -mem | awk -F '\\/ |)' '{print $2; exit}') / 1024^2))"
|
||||
memused="$(sysinfo -mem | awk -F '\\/|)' '{print $2; exit}')"
|
||||
memused="$((${memused/max} / 1024 / 1024))"
|
||||
memused="$((${memused/max} / 1024^2))"
|
||||
;;
|
||||
esac
|
||||
memory="${memused}MB / ${memtotal}MB"
|
||||
|
|
Loading…
Reference in a new issue