psensor icon indicating copy to clipboard operation
psensor copied to clipboard

mem.available may be more useful than mem.free.

Open JamesNewton opened this issue 2 years ago • 1 comments

As per https://gitlab.com/jeanfi/psensor/-/issues/10 "On my laptop (Ubuntu 18.04, 8750H, Geforce 1070), pSensor 1.1.5 reports free memory percentage and used GPU memory percentage. This inconsistency is confusing."

The better measure of memory is, I think, mem.available rather than mem.free.

This can be tested by just changing https://github.com/chinf/psensor/blob/master/src/lib/pgtop2.c#L98 from v = ((double)mem.free) * 100.0 / mem.total; to v = ((double)mem.available) * 100.0 / mem.total;

And then if it works as expected, perhaps a second memory sensor can be added.

JamesNewton avatar Nov 09 '23 17:11 JamesNewton

Never mind, libgtop does not have mem.available. It does, however, have mem.user, which includes total - available. https://github.com/GNOME/libgtop/blob/master/sysdeps/linux/mem.c#L63

JamesNewton avatar Nov 12 '23 02:11 JamesNewton