greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.86k stars 471 forks source link

memory usage isn't calculated correctly #1971

Closed qrockz closed 10 months ago

qrockz commented 10 months ago

I think my total mem usage output is wrong calculated:

free -g
               total        used        free      shared  buff/cache   available
Mem:              31          11           4           0          15          18
Swap:              1           0           1

htop

window4 window

[[block]]
block = "memory"
format = " $icon $mem_total_used_percents.eng(w:2) "
format_alt = " $icon_swap $swap_used_percents.eng(w:2) "
cat /etc/os-release
NAME="Linux Mint"
VERSION="21.1 (Vera)"
ID=linuxmint
ID_LIKE="ubuntu debian"
PRETTY_NAME="Linux Mint 21.1"
VERSION_ID="21.1"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=vera
UBUNTU_CODENAME=jammy
~/.cargo/bin/i3status-rs -V
i3status-rs 0.32.2 (commit 69b38430 2023-10-18)
bim9262 commented 10 months ago

You probably want to use $mem_used_percents, not $mem_total_used_percents

Placeholder Value
mem_used Memory used, excluding cached memory and buffers; same as htop's green bar
mem_total_used mem_total - mem_free
mem_total Total physical ram available
mem_free Free memory not yet used by the kernel or userspace (in general you should use mem_avail)