mathoudebine / turing-smart-screen-python

Unofficial Python system monitor and library for small IPS USB-C displays like Turing Smart Screen or XuanFang
GNU General Public License v3.0
1.05k stars 174 forks source link

"used" ram meaningless on linux + give wrong 'total'. #450

Closed orzel closed 7 months ago

orzel commented 7 months ago

On linux/python, the Memory:used is fetched from psutil, but it's nothing really interesting. It corresponds to nothing in top for example.

That's, by itself, is a problem. But the code in library/stats.py uses it to compute total. This is wrong, as explained on the psutil documentation itself.

For ex on one system, i got 128G of RAM, reported as 125 by psutil.virtual_memory().total, which is fine. But free is 42.7 and used 6.4, and as such turing-smart-screen-python displays "49.2". As a side note, i have no idea what those 6.4 are...

mathoudebine commented 7 months ago

Thanks for raising this issue, I was not aware of this Basically we can use (total - available) for used memory I'll create a PR for this