amanusk / s-tui

Terminal-based CPU stress and monitoring utility
https://amanusk.github.io/s-tui/
GNU General Public License v2.0
4.05k stars 139 forks source link

Read power draw from amd_energy kernel driver on supported AMD CPUs. #162

Closed schaerfo closed 4 years ago

schaerfo commented 4 years ago

I have tested this on my Ryzen 7 4800HS and Ryzen 9 3950X CPUs on kernel 5.8.0-rc5. The reported numbers are reasonable. Notice that I have used string interpolation which was introduced in Python 3.6.

Implements #32.

Edit: Previously it was stated that the energy reading works with kernel 5.8.0-rc6. This is not true since the driver now performs more restrictive checks for CPU support (see https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f28e360f29031fdef8df3a1bcad666243bd6872d)

amanusk commented 4 years ago

Thanks a lot for this PR. This is much needed functionality. I'll do my best to review it shortly. What are the implications of using Python 3.6 here? Will it be required for all future versions, or only if AMD power read is supported?

schaerfo commented 4 years ago

Older Python versions throw a syntax error, therefore I replaced it with traditional % string formatting. This works even with Python 2.7

amanusk commented 4 years ago

Thanks. Could you please link a screenshot of what this looks like on your system?

schaerfo commented 4 years ago

Sure, the power reading from the entire socket dwarfs the ones from the cores but fortunately it can be hidden Bildschirmfoto vom 2020-07-29 16-41-56

amanusk commented 4 years ago

Great! Thanks for the changes Merging :)