Scott Hanselman

PowerCfg - The hidden energy and battery tool for Windows you're not using

November 4, '13 Comments [21] Posted in Tools
Sponsored By

There's been a lot of talk about power and energy usage by PCs lately, especially ones on battery. I use an irresponsibly power hungry desktop at home, an Ivy Bridge Intel Lenovo X1 Carbon Touch for work, a Surface 2 (for email, remote desktop (RDP), videos, games and airplane stuff since I don't sweat its batter) and I'm also testing this prototype Haswell that Intel sent me. Whatever machine I get next to replace the X1 Carbon Touch (likely a Yoga 2 Pro) will be a Haswell, and ideally it will support "Connected Standby." Connected Standby is a low-power state that lasts for tens (or hundreds) of hours, but allows the PC to play music, refresh email, and receive VOIP calls. Haswell is amazing, to be clear, but it's all the components working together - chipset, wifi adapter, processor - that make for a truly compelling machine.

Recently I re-discovered the powercfg.exe command line tool that's built into Windows. You have this now. It's a funny little tool that, on the one hand, lets you make minute tweaks to how power is used on your computer, but on the other hand, creates the most elaborate reports on how your PC uses power.

You may have used powercfg.exe in low disk space situations to disable the hibernation file with

powercfg /hibernate off

It'll tell you lots of things about your system that you may not know, or that may help you better use power. For example powercfg /availablesleepstates will tell you the flavors of sleep and standy your PC supports.

How deep can your PC sleep?

Here's my fat desktop:

C:\>powercfg /a
The following sleep states are available on this system:
Standby (S3)
Hibernate
Fast Startup

The following sleep states are not available on this system:
Standby (S1)
The system firmware does not support this standby state.

Standby (S2)
The system firmware does not support this standby state.

This is useful to know. My desktop supports standby. Do I use it? We'll see a little later. Here's the same query on my 5 years-newer Surface:

C:\>powercfg /a
The following sleep states are available on this system:
Standby (Connected)

These S1,S2,S3,S4 numbers indicate how "deeply" your system can sleep. S1 is dozing, and S4 is hibernation. You might find that your machine supports a mode like S3 or something but then it's a device you've added that is preventing it from sleeping that deeply. You can diagnose sleep issues (which, for me, usually end up being cheap USB things I've added) with

powercfg /devicequery s1_supported

...for each state and compare the lists of devices.

The most powerful (today) sleep state for energy management is Connected Standby also known as ACPI S0. Regular Sleep/Standby on average Win7 and Win8 machines is S3.

Connected Standby lets you effectively turn your machine off, but still get email, VOIP calls, play music, etc. There's also rules and guidelines around connected standby that limit battery drain to less than 5% of capacity over a work day.

I ran powercfg.exe /a on the prototype Haswell I've been evaluating and it too supports connected standby, which is deeply cool. This explains the fantastic standby ("in the backpack") times I see with it. As more and more machines have Haswell and support Connected Standby, developers will need to support theses "always fresh" scenarios. It's just habit for me to open a laptop before getting on a plane, launch email, load up on RSS feeds, get my flight details. It'll be very cool to have a Haswell machine in "Connected Standby" that is always fresh, even though it may have been asleep all weekend.

Power Reporting

I recently blogged about how the Windows "High Performance" power profile differed from the "Balanced" profile on Servers' performance. Since I'm not on my desktop machine 24/7, I could save a lot of energy by making sure it's falling asleep at the appropriate time and that it's sleeping as deeply as possible.

The real magic switches buried in PowerCfg.exe are /energy and /batteryreport and, if your machine supports "Connected Standby" also /sleepstudy, and I recommend you run them now. I shall wait. ;)

I ran the Energy Report on my Desktop and it generated a nice HTML report. Here's some highlights (it's super long).

First, my desktop isn't configured to ever fall asleep! A fail on my part.

  • Power Policy:Power Plan Personality is High Performance (Plugged In)
  • The current power plan personality is High Performance when the system is plugged in.
  • Power Policy:Sleep timeout is disabled (Plugged In)
  • The computer is not configured to automatically sleep after a period of inactivity.

Second, my wifi adapter isn't set to use Low-Power. Didn't know that.

  • Power Policy:802.11 Radio Power Policy is Maximum Performance (Plugged In)
  • The current power policy for 802.11-compatible wireless network adapters is not configured to use low-power modes.

Finally, my Wacom Tablet may have the wrong drivers or not be able to sleep:

  • USB Suspend:USB Device not Entering Selective Suspend
  • This device did not enter the USB Selective Suspend state. Processor power management may be prevented when this USB device is not in the Selective Suspend state. Note that this issue will not prevent the system from sleeping.
  • Device Name - Wacom Tablet
  • Device ID - USB\VID_056A&PID_00D1

This was extremely useful information for me, so I'll take 5 minutes and make sure this big desktop goes into standby when I'm not around.

Battery and Power Reporting on a Laptop/Tablet

If you run powercfg /batteryreport on a laptop you get a WEALTH of information in an HTML report. Here's some highlights.

Details on Installed Batteries

Lots of details on the batteries in your machine

  • NAME - X864048BA
  • MANUFACTURER - ATL
  • SERIAL NUMBER - 12412
  • CHEMISTRY - L/ION
  • DESIGN CAPACITY - 31,297 mWh
  • FULL CHARGE CAPACITY - 31,646 mWh
  • CYCLE COUNT - 34

What the device was doing, when, the battery mWh and times:

image

You get awesome charts showing how you battery discharges, charges, and percentages.

image

As well as detailed usage history, percentage used and hours used.

image

Connected Standby machines get an even MORE amazing report with /sleepstudy

You can see what apps are using what about of battery and time, what devices are the "worst offenders" and then you can use this knowledge to decide what you keep running in the background.'

image

Here is one Connected Standby session:

image

I was a little surprised at the quantity of hard data collected and stored by Windows. Also, when blogs and reviewers do detailed tests on different machines showing battery life and stressed tests, are they running powercfg.exe to ensure all the drivers are working together and haven't been flagged as either power-hungry or energy-stupid?

I would love to see even more data on what Windows is doing around energy, and I'm nearly positive the system is keeping track of power-hungry apps. Why not give me a little "heat map" in the title bar so I can know what browser uses the most power, what app is working too hard, or what website is running JavaScript in a loop? Why not give us the option to put those tools front and center?


Sponsor: Big thanks to Telerik Icenium for sponsoring the feed this week! Build and publish iOS & Android apps with Visual Studio using only HTML5 & JavaScript! Telerik Icenium now includes Visual Studio integration. Start a 30 day trial with support now!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. I am a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Monday, November 04, 2013 7:33:15 AM UTC
Yet another valuable nugget from you sir, thank you! I'm going to run these on all my machines here and set the states as best I can!
Cheers from England!

PS. Small typo on 2nd paragraph: "[...] , on the one had, [...]" should read "hand"?
Jon Humphrey
Monday, November 04, 2013 8:31:03 AM UTC
Mavericks has a cool power usage table showing energy use by app. They advertise that the OS is very careful on how it uses power. I'm not a mac user - but they talk about how the cpu is put to sleep when ever it can be, apparently how they get so many hours out of the macbook air.
Tolli
Monday, November 04, 2013 9:07:43 AM UTC
Excellent article. I've used powercfg in the past to switch hibernate or sleep on and off, but never realised I could get this much detailed information!
Monday, November 04, 2013 9:19:34 AM UTC
I would like to see power usage built into task manager similar to what OS X has done. We could as you say have a heat map just like the CPU usage one.

What I find interesting about power usage is how much a driver can make a difference e.g. the surface pro 2 now gets 25% more battery after a firmware update:
http://www.anandtech.com/show/7478/microsoft-surface-pro-2-firmware-update-improves-battery-life. It only takes one poorly optimized driver and your power usage shoots up.
Pete
Monday, November 04, 2013 10:21:43 AM UTC
That's terrific, Scott. Lets hope Microsoft surfaces this stuff in a more discoverable place and in a more consumer-focussed manner. Battery efficiency is a major topic for consumer devices. We're nerds and we didn't know all this was possible.

Interestingly, one of my niggles with Windows RT is the lack of permanent battery indicator. Last night I got a 4% warning and then it shutdown 20 seconds later.
Monday, November 04, 2013 10:44:31 AM UTC
Monday, November 04, 2013 1:40:57 PM UTC
My Win7 laptop doesn't seem to recognize the Battery Report Switch. Is this new in Win 8?
Joel Hess
Monday, November 04, 2013 3:46:25 PM UTC
BTW Scott, aren't you due for Ultimate Developer PC 3.0 ?
Nelson Marmol
Monday, November 04, 2013 3:50:55 PM UTC
This is great stuff, Scott. Nice to see that they're still working on improving this utility as machines become more capable in this area.

Most of my exposure to powercfg has come while trying to figure out why my desktop machines won't sleep or stay asleep. The aforementioned "powercfg /energy" is a good place to start in researching that issue, but it has its limits. In the interest of consolidating digital bread crumb trails, here's a couple handy command flags for that case:

powercfg /requests


This returns a grouped list of system services or executables with hold requests on the sleep scheduler. In my experience, anything you see here will prevent a machine from automatically triggering sleep mode. This list provides the road map to finding these tasks and making adjustments. Some of these settings can be tuned from the management UI of the respective executable, but others are not so friendly. If you hit that wall, the next stop is manual overrides...

powercfg /requestsoverride


This command shows a list of processes with manual overrides. You use the same command with flags to amend the list.

powercfg /requestsoverride <NAME> <REQUEST>


The NAME argument is for the executable name (must match the name returned by the /requests command). The REQUEST argument is for one or more OS power request types (DISPLAY, SYSTEM, AWAYMODE). These map to some pretty low level Win32 stuff which is documented pretty well here:

Windows Power Availability Requests (DOCX)

You may need to tailor these modes to suit your individual needs. For myself, I'm not using media sharing on my big 'ol desktop at work, so allowing it to keep my machine up all night isn't a good use of energy.


Brian Seebacher
Monday, November 04, 2013 3:53:59 PM UTC
Love this one from the /energy report:

The average processor utilization during the trace was high. The system will consume less power when the average processor utilization is very low.


Yep, that's right. If you don't use your PC, it will consume less energy. :)
Greg Sohl
Monday, November 04, 2013 4:35:53 PM UTC
Pretty cool that it makes fancy HTML reports! This is interesting stuff. Thanks, Scott.

Now if only VS could generate HTML documentation pages...
Sam
Monday, November 04, 2013 4:38:03 PM UTC
If -BatteryReport is for 8 only, maybe you should let everyone know.
Dean
Monday, November 04, 2013 8:39:21 PM UTC
This is one of the most valuable articles I've read in a long time. I always wondered how to analyze batter on my laptop as well as how to prevent it from losing its power in less than 12 months. Great stuff Scott!
Husein
Monday, November 04, 2013 9:05:44 PM UTC
Looking at this, I find very disappointing Surface Pro 2 is not supporting connected standby due to firmware not surpporting it, especially considering than Haswell processors are supposed to support it.
MarcSilverTriple
Monday, November 04, 2013 10:20:45 PM UTC
Seems like the command that Scott is describing might be a Windows 8 thing. There's a powercfg command for Windows 7, but the switches are different.

For example, you can run
powercfg -energy -output report.html
and you'll get a huge dump of information about available sleep states, peripherals which might be preventing sleep, etc.
Wednesday, November 06, 2013 5:22:27 AM UTC
Scott - you've mentioned the Surface rt/Surface 2 a number of times. I am interested to know where you think it fits in, eg is the idea that you sacrifice breadth of app support in exchange for a cheaper lighter unit?
Matt
Wednesday, November 06, 2013 8:26:07 PM UTC
The energy report even told me my Wifi router was not configured to allow my laptop's Wifi adaptor to go into a low power state. Impressive.
Ian
Friday, November 08, 2013 8:56:50 AM UTC
Matt - Exactly right. I *want* a Pro with the size of an RT. The RT is just the perfect size and weight, and really a LOT more capable than my iPad. For 75% of my work, it's great.
Tuesday, November 12, 2013 4:05:14 PM UTC
Absolutely superb post! Why don't Microsoft put a GUI over that tool? It would improve customer satisfaction no end!
Saturday, November 30, 2013 3:29:04 AM UTC
This is great. I like it. Thank you very much.
Fushan Wen
Sunday, January 05, 2014 4:06:21 PM UTC
yeah the tool is rather epic, i found out that the ASPM states of the usb and Pcie lanes are not used correctly by using powercfg -energy. Some google's later it turns out you can force them to work in windows by using a Grub bootloader. And that saved me 3 watts on idle! from 9 to 6 watts on a Sandy bridge Laptop is just huge.

Just goes to show how easy apple has things with a very limited hardware set to make everything power down properly.

http://forum.notebookreview.com/hardware-components-aftermarket-upgrades/606100-enable-aspm-t61-running-windows-saving-2w-power-consumption.html

more then the poster of the guide gained even :)
Malloot
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.