Memory: Change math to fix possible bug
This commit is contained in:
parent
0b96b1e4c5
commit
1281d762d0
10
neofetch
10
neofetch
|
@ -1034,7 +1034,7 @@ get_memory() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X" | "iPhone OS")
|
"Mac OS X" | "iPhone OS")
|
||||||
mem_total="$(($(sysctl -n hw.memsize) / 1024^2))"
|
mem_total="$(($(sysctl -n hw.memsize) / 1024 / 1024))"
|
||||||
mem_wired="$(vm_stat | awk '/wired/ { print $4 }')"
|
mem_wired="$(vm_stat | awk '/wired/ { print $4 }')"
|
||||||
mem_active="$(vm_stat | awk '/active / { printf $3 }')"
|
mem_active="$(vm_stat | awk '/active / { printf $3 }')"
|
||||||
mem_compressed="$(vm_stat | awk '/occupied/ { printf $5 }')"
|
mem_compressed="$(vm_stat | awk '/occupied/ { printf $5 }')"
|
||||||
|
@ -1045,12 +1045,12 @@ get_memory() {
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
"NetBSD"*)
|
"NetBSD"*)
|
||||||
memfree="$(($(awk -F ':|kB' '/MemFree:/ {printf $2}' /proc/meminfo) / 1024))"
|
memfree="$(($(awk -F ':|kB' '/MemFree:/ {printf $2}' /proc/meminfo) / 1024))"
|
||||||
mem_total="$(($(sysctl -n hw.physmem64) / 1024^2))"
|
mem_total="$(($(sysctl -n hw.physmem64) / 1024 / 1024))"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
memfree="$(($(vmstat | awk 'END{printf $5}') / 1024))"
|
memfree="$(($(vmstat | awk 'END{printf $5}') / 1024))"
|
||||||
mem_total="$(($(sysctl -n hw.physmem) / 1024^2))"
|
mem_total="$(($(sysctl -n hw.physmem) / 1024 / 1024))"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -1067,9 +1067,9 @@ get_memory() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Haiku")
|
"Haiku")
|
||||||
mem_total="$(($(sysinfo -mem | awk -F '\\/ |)' '{print $2; exit}') / 1024^2))"
|
mem_total="$(($(sysinfo -mem | awk -F '\\/ |)' '{print $2; exit}') / 1024 / 1024))"
|
||||||
mem_used="$(sysinfo -mem | awk -F '\\/|)' '{print $2; exit}')"
|
mem_used="$(sysinfo -mem | awk -F '\\/|)' '{print $2; exit}')"
|
||||||
mem_used="$((${mem_used/max} / 1024^2))"
|
mem_used="$((${mem_used/max} / 1024 / 1024))"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
memory="${mem_used}MB / ${mem_total}MB"
|
memory="${mem_used}MB / ${mem_total}MB"
|
||||||
|
|
Reference in New Issue