6

Are there any OS capabilities in Windows to know your system's current power usage programmatically? (Ideal solution could be via WMI interface.)

ahmd0
  • 16,633
  • 33
  • 137
  • 233
  • There might be something in http://stackoverflow.com/questions/2450902/windows-cpu-power-management-apis –  Mar 14 '12 at 22:47
  • 2
    (This seems "like a real question" to me: How can the power consumption (or estimate thereof) be programmatically determined in Windows. If it is not possible, it still does not make it "not a real question", but just a question with a less-than-ideal answer.) –  Mar 14 '12 at 22:47
  • Thanks, but it's too broad of a link. Any more specifics? – ahmd0 Mar 14 '12 at 22:48
  • 1
    What? Is it a linguistics thread? Did I post in a wrong place? – ahmd0 Mar 14 '12 at 22:50
  • There is [Joulemeter](http://www.addictivetips.com/windows-tips/joulemeter-measures-power-consumption-of-the-system/) from Microsoft Research, but that isn't just an API and I don't know how it works. I *believe* it uses battery levels after stressing some particular hardware, and then uses that as a table to "determine power usage" later. It seems like -- even if not exposed in WMI -- modern motherboards would have a method of generally detecting CPU/chipset power consumption. Other systems like video cards with external power or drives are "off grid", however. –  Mar 14 '12 at 22:53

2 Answers2

6

Starting with Windows 7 you can use the Win32_PowerMeter WMI class located in the root\CIMV2\power namespace, this namespace has lot of another classes and events related to the power management and profiles.

RRUZ
  • 134,889
  • 20
  • 356
  • 483
3

I don't know of anything on an instantaneous basis, but GetSystemPowerStatus can give an estimate of remaining battery power. Calling that every few minutes (or something on that order) would give an idea of how quickly you're using power, at least as a percentage of the battery life. Of course, that really only works when/if there is a battery -- on a desktop or server system it normally won't produce anything useful.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
  • Yeah, that's an idea... although many systems may not have a battery (like my desktop now.) – ahmd0 Mar 15 '12 at 01:11