greshake / i3status-rust

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

error with reading memory usage #1930

Closed ahumblescientist closed 11 months ago

ahumblescientist commented 11 months ago

here is what i3status-rust outputs: 2023-08-05_23-32

sudo ps_mem ouput: 2023-08-05_23-33ps (sorry for bad english)

ammgws commented 11 months ago

Hmm, that percentage seems pretty sus. Thought we had fixed memory calcs a while back.

Do you use ZFS?

ahumblescientist commented 11 months ago

Hmm, that percentage seems pretty sus. Thought we had fixed memory calcs a while back.

Do you use ZFS?

nope

bim9262 commented 11 months ago

@ahumblescientist does the value in your status bar match the output of free -g? On my computer free -g and ps_mem report different amounts of used memory. I'm pretty sure ps_mem just doesn't count everything.

ahumblescientist commented 11 months ago

@ahumblescientist does the value in your status bar match the output of free -g? On my computer free -g and ps_mem report different amounts of used memory. I'm pretty sure ps_mem just doesn't count everything.

@bim9262 no, it says used 2GB, unlike i3status-rs which says that the used is 12GB

ammgws commented 11 months ago

What does htop show?

ahumblescientist commented 11 months ago

@ammgws htop

bim9262 commented 11 months ago

Can you share the format you are using for the memory block?

ahumblescientist commented 11 months ago

@bim9262 im using the default: format = " $icon $mem_avail.eng(prefix:M)/$mem_total.eng(prefix:M)($mem_total_used_percents.eng(w:2)) "

bim9262 commented 11 months ago

So you are showing how much is available, not how much is being used

ahumblescientist commented 11 months ago

@bim9262 this is the dumbest i have ever felt to be honest, i rlly didnt notice that

bim9262 commented 11 months ago

Haha no worries, glad we got it sorted out

ammgws commented 11 months ago

Possible cause of confusion could be that the percentage shown in the default format string is the total used %.

Perhaps should change

$mem_avail.eng(prefix:M)/$mem_total.eng(prefix:M)($mem_total_used_percents.eng(w:2))

to

$mem_avail.eng(prefix:M)/$mem_total.eng(prefix:M)($mem_avail_percents.eng(w:2))

?

bim9262 commented 11 months ago

I think that used/total(used%) would be a better default. :man_shrugging:

ahumblescientist commented 11 months ago

@ammgws yes the avail percent works, but the used dosent work, it outputs 97% used even tho im only using 3GB of 16GB, i was intending to use the avail from the start anyway

qrockz commented 8 months ago

I think my total mem usage output is also 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)