aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2019-09-29 16:27:45 +0300
committerDylan Araps <dylan.araps@gmail.com>2019-09-29 16:27:45 +0300
commitee6e1bd39066ea619c5e211b735197bf717b0e47 (patch)
treeadd0f23744d3c8bdb08bb399c206e74a7d378b5e
parentc888f4cdcaed9343b66cde1f6881da7b7a901db9 (diff)
downloadpfetch-ee6e1bd39066ea619c5e211b735197bf717b0e47.tar.gz
memory: bug fix
-rwxr-xr-xpfetch10
1 files changed, 5 insertions, 5 deletions
diff --git a/pfetch b/pfetch
index d8c6856..14fc6d1 100755
--- a/pfetch
+++ b/pfetch
@@ -464,7 +464,7 @@ get_pkgs() {
get_memory() {
case $os in
- # Used memory is calculated using the following "formula" (Linux):
+ # Used memory is calculated using the following "formula":
# MemUsed = MemTotal + Shmem - MemFree - Buffers - Cached - SReclaimable
# Source: https://github.com/KittyKatt/screenFetch/issues/386
Linux*)
@@ -492,7 +492,7 @@ get_memory() {
mem_full=$((mem_full / 1024))
;;
- # Used memory is calculated using the following "formula" (MacOS):
+ # Used memory is calculated using the following "formula":
# (wired + active + occupied) * 4 / 1024
Darwin*)
mem_full=$(($(sysctl -n hw.memsize) / 1024 / 1024))
@@ -542,8 +542,8 @@ get_memory() {
EOF
;;
- # Used memory is calculated using the following "formula" (FreeBSD):
- # (inactive_count + free_count + cache_count) * page_size / 1024
+ # Used memory is calculated using the following "formula":
+ # mem_full - ((inactive + free + cache) * page_size / 1024)
FreeBSD*|DragonFly*)
mem_full=$(($(sysctl -n hw.physmem) / 1024 / 1024))
@@ -566,7 +566,7 @@ get_memory() {
# $2: vm.stats.vm.v_inactive_count
# $3: vm.stats.vm.v_free_count
# $4: vm.stats.vm.v_cache_count
- mem_used=$((($2 + $3 + $4) * $1 / 1024 / 1024))
+ mem_used=$((mem_full - (($2 + $3 + $4) * $1 / 1024 / 1024)))
;;
NetBSD*)