Power panel: show live draw in watts and the top consumers #8459
vinceferro
started this conversation in
Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Wish
The stock power panel shows battery %, time left and profile switching — but not what the machine is actually drawing right now, nor which processes are responsible.
Proposal
Two additions to
panels/power:Live draw in the panel (and optionally the pill): read battery flow from
/sys/class/power_supply(power_now, orcurrent_now × voltage_now— on Apple Silicon/Asahimacsmc-batteryreports the latter; UPower energy-rate as fallback). Display signed watts:-33 Wdischarging,+18 Wcharging, with color thresholds (green/yellow/red).Top consumers section: sample
/proc/[0-9]*/statjiffies on a timer (1 s while the panel is open), diff snapshots, and list the top 5 processes by CPU share of total jiffies. When the draw is known, attribute per-process watts proportionally (no RAPL on Asahi, so share × measured flow is the honest estimate — the list roughly sums to the battery rate). A multi-threaded process can legitimately exceed 100%.Working reference: I run this as a clone of the stock plugin — ~80 lines of QML + a small sampling script, no extra processes. The sampler logic and the jiffies-diff math are self-contained and portable.
Happy to turn it into a PR against
plugins/panels/powerif there is interest.All reactions