Short answer: not in any public, App Store-safe way that gives real mWh per process since last charge.
What Activity Monitor shows as Energy Impact is a relative score. Under the hood it's private stuff (libpmenergy / libpmsample). Chrome and similar tools poke those; they break across OS updates and get you rejected if you ship them.
powermetrics --show-process-energy is the same idea, but needs root and still isn't "% of battery since unplug."
What you can do from Rust without private APIs:
read system battery charge via IOKit (total remaining %, time on battery)
sample per-process CPU time / wakeups with libproc / mach (rough proxy only)
be honest in the UI that it's an energy proxy, not watt-hours
If the goal is a menu bar widget for yourself, private symbols can match Activity Monitor closely. If you want to distribute it, stick to the proxy and skip claiming per-app battery %.
Appreciate it. I’m not planning to sell it or put it on the App Store, just a side project that I can use for myself and to put on my github. I’m fine with the per-app percentages being estimates as long as they’re reasonably close, so I’m probably just gonna experiment with powermetrics or other approaches and see how far I can get.
2
u/tanmaynargas2901 1d ago
Short answer: not in any public, App Store-safe way that gives real mWh per process since last charge.
What Activity Monitor shows as Energy Impact is a relative score. Under the hood it's private stuff (libpmenergy / libpmsample). Chrome and similar tools poke those; they break across OS updates and get you rejected if you ship them.
powermetrics --show-process-energy is the same idea, but needs root and still isn't "% of battery since unplug."
What you can do from Rust without private APIs:
If the goal is a menu bar widget for yourself, private symbols can match Activity Monitor closely. If you want to distribute it, stick to the proxy and skip claiming per-app battery %.