Looking for APIs to measure battery use of a process

Viewed 116

Question Is there an API for Windows and/or Linux that will let me find out which processes are draining battery?

A few notes:

  • It doesn't have to be precise, I'd be ok with only three levels (low energy cost/fair energy cost/high energy cost) if that's all I can get.
  • I already have CPU load information, that's not what I am looking for, as experience shows that processes with very low CPU use can nevertheless drain battery by having high I/O, high swapping or frequent wakeups. This is why I'd like to piggyback on whatever the OS is already using: OS developers are much more likely than me to have actually tested this.
  • I found a partial solution for macOS. See answers.
  • MSDN doesn't seem to indicate any energy-related API.
  • I cannot request admin/root rights for running my task manager, so I cannot simply parse the syslogs looking for power usage alerts.
1 Answers
Related