btop
btop copied to clipboard
[REQUEST] Display Power Usage Stats
Describe the solution you'd like
I'd love for btop to also be able to show a power usage graph, possibly one that can show volts, amps and watts used reported from the battery in one graph. I think this would work increadibly well in conjunction with the rest of the stats being provided, being able to view power usage as CPU, disk and network utilisation goes up and down would be very helpful. If UI realestate is at a premium even just a small "W:
Describe alternatives you've considered None, I am not aware of any other tools that graph power usage on linux off the top of my head, and certainly none that provide other system stats at the same time.
Additional context I think it would be best to leave the feature turned off by default, as it will primarily only be used by laptop users (although I do like that btop actually detects the battery in my bluetooth controller on my desktop), I think battery information is an important thing to include in any general system monitors as it is an integral part of the system.
Created PR with this feature, only Intel supported for now (have no AMD CPU to test). (only watts, without graph) https://github.com/aristocratos/btop/pull/595
Hi @YuriiShkrobut,
I've looked at your changes in PR #595 where you use /sys/class/powercap/intel-rapl:0/energy_uj
to calculate CPU power. I'd like to suggest an improvement that might broaden its applicability.
My suggestion is to add a power consumption indicator for the system battery to the battery indicator on laptops. This would have the advantage of being an indicator of the energy consumption of the whole system, another advantage is that it also works for AMD systems, the disadvantage would be that it only works for laptops. Therefore, my suggestion is to add a power consumption to the battery section for laptops with the following metrics
- Battery current:
/sys/class/power_supply/BAT0/current_now
. - Battery voltage:
/sys/class/power_supply/BAT0/voltage_now
. - Battery current:
battery current * battery voltage
.
A small caveat to this method is that it is only effective when the laptop is running on battery power. When the laptop is plugged in, these readings reflect the power going to the battery, not the actual power being used by the system.
I think adding this metrics to the battery indicator could be useful for laptops users. I look forward to hearing your thoughts on this!
Best, vsey