jeanmarc77 / 123solar

123Solar is a lightweight set of PHP/JS files that makes a web logger to monitor your photovoltaic inverter(s). It just need a web server and PHP, no databases are even needed. The philosophy is: To keep it simple, fast, with a low foot print to run on cheap and low powered devices.
GNU General Public License v3.0
36 stars 12 forks source link

Fix/memory report #30

Closed svavassori closed 1 year ago

svavassori commented 1 year ago

This PR resolves #29 by using the same commands across all major Linux distributions to retrieve CPU, Memory and Disk information. It has been tested on:

Commands have same output across x86, x64 and ARM architectures.

In details: For the CPU the top command is used in order to have current CPU usage, independently of the total process time, that is the one reported from ps; this has a +20% difference on the reported value on low power devices like a Raspberry. Moreover the reported value is already normalized by the number of CPUs available, so a 100% means all CPUs are busy.

In the Memory section, the reported free value is always the available one returned by the free command. This is because the user is interested on how much memory can be used to launch programs, instead of how much is not used.

Also a small UI tweak has been done in the info page to state more clearly which value represent used and available disk space.

Before: before

After: after

jeanmarc77 commented 1 year ago

thanks, it's faster for CPU use ;)