Windows 7 and Battery Life... What You Should Know...

Joe Average

Ad Blocker - Banned
Joined
Apr 6, 2008
Messages
15,459
Preface... (and yes, this is one of my infamous "Megaposts" and this one might be in several parts, so, bear with me and get edjumicated... ;)

I found that link about this "new" power configuration diagnostic in Windows 7 and posted it in the other thread, but as it'll get buried in the muck soon enough, and considering just how vital this specific tool could turn out to be in terms of maximizing the potential battery life/run-time of laptops and notebooks (and Tablet PCs too) that will use Windows, I figured this specific topic is very deserving of its own thread, so here it is.

What I'm hoping this thread will be about is related to a diagnostic tool that, until recently, has been relatively unknown (and I admit I just discovered info about it last week myself, so I'm cobbling together a bunch of information from a variety of sources, several being Microsoft and blogs from MSDN folk, and some Windows 7 developers also, and putting it in this one post/thread.

Hopefully there will be some intelligent discussion as time goes by as the more I do research on this the more I realize it could very well be one of the coolest things - and gain one of the most vital aspects - about Windows 7.

So let's get this thing started... who knows, maybe this'll get stickied like some other stuff I've written about... if people deem it valuable, by all means, tell the Admins/Mods and point people to it as needed.

--------------

Windows 7, the newest OS soon to be released by Microsoft, hopes to usher in a new age in computing in general, with a lot of focus on portability. When dealing with a portable device, such as today's laptops, notebooks, and Tablet PCs, aside from the design of the unit itself (aesthetics, packaging, usability, ergonomics, etc), one of the biggest things - if not the biggest overall - that absolutely must be addressed is battery life. There is perhaps no greater concern in today's "high bandwidth" and highly mobile world than having a machine that can get the job done and not crap out on us right when we not only least expect it but when we can typically least afford the issues brought on when it does.

Because of this, the Windows 7 development teams have spent a great deal of effort in working not only inside their own little circles but directly with manufacturers of the hardware that goes into making up today's portable computers. Because of this, great strides have taken place in terms of battery consumption, energy efficiency, and power management that can ensure a very long runtime with Windows 7.

But there's a problem, of course.

Windows 7, as all previous versions of Windows have been, is designed from the ground up to run on the widest variety of hardware possible, or at least as wide a variety as the drivers are capable of supporting. But we need to state something here of the utmost importance:

Without solid drivers that work, the OS is totally useless for all intents and purposes so their importance is absolutely essential in the big picture. Without solid drivers, the software can't access the hardware at all and you're left with a bunch of expensive parts that can't talk to each other through the OS which is in essence like a central nervous system.

I have a tendency to agree strongly with something Linus Torvalds, the creator of the Linux kernel (commonly referred to as the Linux OS), said a few years ago in a documentary called "Revolution OS." He stated (and I'm paraphrasing here, so forgive me) that the job of an OS is to be invisible, and not get in the way. It's supposed to provide a way for hardware devices to interconnect with each other and manage/manipulate data flow between those devices and to provide for applications that can also manage/manipulate data. Aside from that, an OS shouldn't really "do" much of anything but be that "traffic cop" in some respects.

With today's higher powered (i.e. more computationally powerful) portable computers, having that power coupled with a power supply subsystem that can adequately provide the necessary "juice" required and provide it for extended periods of time without failure becomes a very important thing. The better you can manage the power available, the better you can put it use in the most efficient way(s) possible.

So, with Windows 7, the developers tried to narrow down all the tasks required and come up with one basic goal:

Engineering Windows 7 blog entry said:
In engineering Windows 7, our goal is to deliver the capabilities and features users want from a Windows PC while reducing power consumption over previous releases. Windows already provides a rich set of energy saving features, including the ability to turn off the display and automatically put the system to sleep when the user is not interacting with the computer. For Windows 7, we are building upon the investments in these areas by extending the existing capabilities and focusing on reducing power consumption when the system is idle. Although Windows is responsible for managing the power state of many devices, including the processor, hard drive and display, the remaining devices and software running on the computer have just as much (if not more) impact on power consumption and battery life. This is a challenge for everyone contributing to the PC experience.

That text is quoted from this blog entry that I highly recommend you read or at least skim over if you really want to know some of the ins and outs of what went on with the development stages of Windows 7 from that all important energy efficiency standpoint:

Windows 7 Energy Efficiency - The Engineering Windows 7 Blog


It's a fairly complicated process, trying to figure out what uses what energy where, and what is using too much, and what isn't using enough for the best energy efficiency, but they're getting there.

There's been recent discussion about comparing Windows 7 with OS X from Apple, but there's two problems with that:

1) Windows 7 isn't done quite yet so, any comparisons are effectively useless as we don't know what continuing improvements are most likely being implemented into Windows 7 as it approaches RTM status. There's talk of a second Release Candidate coming out soon but, Microsoft stated earlier this year that there will only be one public Release Candidate, so if that's true, and a second one is created, it'll be limited to distribution to TAP members and perhaps some privileged beta testers/MSDN developers. That basically means it'll get leaked to the Internet where anyone can snatch it probably within 48 hours of it becoming an actual solid ISO (hey, I'm just being honest and we all know it). ;)

2) A Macintosh computer is effectively a static hardware platform and because of this, the level of performance tuning on that static platform can be far superior to anything anyone is going to be able to do with Windows and its ability to work with a nearly infinite combination of components from all types of manufacturers. Because of this, OS X in many respects - and not just because of its UNIX-inspired BSD underpinnings - can be consider a compiled OS for the given platform. As anyone that's used UNIX or a given Linux distro (most notably Gentoo I'd hazard to say) and compiled the kernel for maximum efficiency on that "static" platform should be able to agree with, the performance and efficiency become much greater with such a configuration.

I read that article (actually just a small part of it on one page in particular) that's being referenced from AnandTech (located here) and while I do attach some significance to it, the first thing I noted was it was written last October (2008), and it's OS X vs Vista. One issue that I noted is that, in a rare display of forgetfulness, Anand didn't state which service pack level of Vista he was using in that little impromptu testing he did - we don't know if it's vanilla Vista (could be) or Vista SP1 (more likely but but but...) and I can't say that SP1 introduced anything new with respect to increased energy efficiency in Vista.

Suffice to say, the focus is on Windows 7 now and not Vista, regardless of it being vanilla Vista, SP1, or SP2, because Windows 7 just does things differently. Every time I hear people say some relatively stupid things like "Windows 7 is just Vista with a fresh coat of paint" or "Windows 7 is actually Vista Service Pack 3" I laugh because the implied ignorance behind the comments needs to be tempered with the fact that it's easy to make stupid off-the-cuff remarks with nothing behind them. Any fool can do that...

As time goes by, and because of the feature I'm about to discuss in Windows 7, the "new" power configuration diagnostic that's been so popular of late, I'm confident that when people learn to use this tool effectively and how to decipher the report it provides, we'll all find ourselves with - potentially - much longer running portable computers.

So what is this mystical "new" tool? Well, it's part of the power configuration and management options provided by the command powercfg, used in the Command Prompt, and by using a specific switch with the command: -energy

But, because of the level of execution this particular command/switch requires, you'll need to run the command from an elevated prompt, aka an Administrative Command Prompt. Simple enough to do: click the Start button, click All Programs, click Accessories, and there near the top of the list will be Command Prompt with a little "DOS window" icon next to it. If you right-click on that entry, you'll get the standard context menu and see "Run as administrator" there. Select that option and you'll most likely get a UAC prompt notifying you that something wants elevation - obviously this is what we're trying to do so click Yes to continue.

The Administrator: Command Prompt will appear and this is where we get the real work done. Commands issued in this prompt will have higher execution privileges (I won't go into this as there's plenty of other threads and websites with far more info). The command once again that we're interested in is:

powercfg -energy (and then you press Enter)

IMPORTANT NOTE: it's recommended (as noted on the Windows 7 blog) that you kill any running applications before doing this diagnostic. Shut down all running applications that you manually start up (your web browser, an Explorer window or windows, basically any applications that you start yourself after the computer boots). If you have applications that run in the background and typically leave running (perhaps apps that show an icon in the System Tray for showing status, monitoring, etc) I'd say those will be "ok" since we're looking to discover potential issues in efficiency and power management compatibility. But basically, strip it down to just the OS itself as much as you possibly can. When you've done that, continue.

When you do, you'll see the following:

powercfg01.png


What's happening is the OS is polling/querying all the hardware and asking it to provide power status and other information to put together a report that basically tells you what's doing what, what's not happening that should be, and a lot of other very useful info that can be used to troubleshoot the biggest cause(s) of screwed up power settings, or potentially battery zapping processes that rob you of that precious battery runtime.

When it's done you'll see this (or something similar):

powercfg02.png


The idea, if you happen to be familiar with the old Bootvis tool for XP, is to trace or monitor what's going on for a given amount of time, then gather the information and analyze it and provide a report of data that can be used to troubleshoot where the major problems are. With Bootvis, it would start just as the OS begins to load, quietly sit in the background and watch everything that happens: from how files load off the hard drive, the sequence they load, what specific moment a given file loads, what files are actually required, and then it analyzes that data into a few reports in the form of graphs and charts.

It basically monitors what happens from the time the OS starts to load until XP loads the actual Desktop and then continues to monitor for about 60 seconds past that point, then presents the data in a form that we mere humans can easily understand. :) I was pretty good at using Bootvis over the years: my fastest boot time ever was 13.9 seconds, and that was on a Pentium 3 1.13 GHz laptop, with a 5400 rpm drive, 512MB of DDR 266 RAM, and Windows XP Pro SP2. That was measured with Bootvis itself as the actual boot to Desktop time, and I even had the pic saved for a long time but I can't find it...

Ah, those were the days when tweaking stuff actually made a helluvalot of a difference in how an OS responds.

And then Vista came out.

And now Windows 7 improves on even Vista's self-tuning considerably, even dramatically at some points. That level of tweaking Windows is in the past and really not necessary anymore. The problem with this kind of information that we're going to be gleaning from this diagnostic tool can be quite interesting overall, but the underlying principle still holds:

Because Windows is designed to work on that nearly infinite variety of hardware configurations, this kind of tool helps us to narrow down and specifically track where the issues related to power management are occurring. Probably more than 95% of the time we're going to see it's a driver related issue since the OS can't do much of anything unless it can talk to the hardware and vice versa.

But just talking with the hardware doesn't necessarily mean you're going to be able to do it in the most energy efficient way possible. Let's face it: a Yugo full of fat people (and I'm 6'6" and I weigh 380 lbs so, I've got all the room I need to speak on that sort of thing) will actually roll down the road, but putting the same people in a small van or pickup truck will obviously be more efficient. You've changed from an inefficient method of transport that wastes fuel (read: energy) to get a specific task done. The analogy here is if a driver isn't written well enough and doesn't support all the power management features of the given technology, it becomes a weak link in a chain, and that's when everything goes wrong.

So this diagnostic tool will help track down given devices and the non-compliant nature of their drivers when those devices don't handle power management control decisions from the OS. Poorly written drivers are almost always the cause for power management issues related to startup and shutdown problems, sleep or standby issues, and even hibernation where the computer isn't even on at all.

With Apple and their Macintosh computers, they have the absolute "God-like" control over not only the design of the hardware (spec'ing it out and having manufacturers create it to their precise requirements), put it all together into a cohesive working component (I'll give 'em credit for the MacBook Air as that entire computer is on a circuit board about the size of a piece of bread), and then... <drumroll please>... write a "pre-compiled" OS tailored specifically for the exact components that are in that given machine, aka that static platform I was mentioning before.

Since Microsoft doesn't make computers (maybe they should, at least once), they're at the mercy of hardware manufacturers that provide enough info for them to code an OS for, but they're even more at the mercy of hardware developers that create devices and then - more often than not - write drivers that simply provide a working level of functionality for those devices but do not provide the levels of power management control necessary to ensure that oh so important energy efficiency we're looking for, most especially with portable computers.

We're tied to battery life when we're on the go, that's a fact of life in today's world, and with Windows 7 there's a really big opportunity here - from the enthusiast's point of view - of maximizing that nearly infinite variety of hardware, at least from the perspective of getting the most bang for the buck, and that includes the longest run-time possible from the equipment we own.

But... (and that's a big But there...)

What we're looking at doing with this powercfg diagnostic isn't necessarily "tweaking" in the traditional respect for more performance from the overall OS - this time we're tweaking for battery life and the maximum runtime possible.

As Martha Stewart might say, "That's a good thing." :D

One downside to that powercfg -energy command (to me, at least) is that it automagically defaults to saving the report in the Windows\system32 directory, and while that's not the worst place to put it, most folks would probably prefer a more "easy to reach" location, perhaps their Documents folder, or wherever. Luckily, that's just another switch:

powercfg -energy -output <targetdrive>:\<folder>\<filename.html>

If I wanted, for example, to save the report as results.html and stuff it on a secondary partition I'd use a command like this:

powercfg -energy -output D:\results.html

and I'll get the report in results.html in the root of my D: partition, obviously.

Now, what to do with the report...

Well, that's part of why I wanted to start this thread so that we can discuss the results that we'll be seeing as people begin to learn more about this incredibly useful tool that's already part of Windows 7. Once dissected, I'm sure all of us will come to realize that, if we've got a laptop or notebook or Tablet PC running Windows 7 that we'll hopefully be able to diagnose, troubleshoot, and then get past any potential issues that are basically wasting electrical power in our portable computers and get much better battery life and energy efficiency overall.

People will probably comment that the report(s) note some things that may not even apply in many respects; the report off the desktop PC I'm using mentions a "Power Policy" for 802.11 wireless hardware - and I don't have any wireless hardware, so the potential exists for possibly disabling such policies so they don't have any play in the overall power management equation. Even on a desktop PC, it can't hurt at all to save as much electricity as you can - less electricity used/wasted, and you get a smaller power bill.

Like anything, it all adds up over time.

I'll reserve the next two posts for additional research as I get more familiar with this tool myself, and throw a few links to more info in 'em as I find stuff that contains useful . Now I just need a laptop that I can install Windows 7 on and do some proper damned diagnostics and testing on. :D

If you're interested in participating, and you can do some testing on laptops or notebooks running Windows 7, by all means, join the discussion. While I know there will be the inevitable comparisons with OS X or even perhaps a highly tuned Linux distro on a given platform, I'm hoping the talk will focus on Windows 7, this diagnostic tool, and how to best use it to ensure we all get the best results from our hardware.

Have fun, always...
 
Last edited:
Here are some links I thought I'd toss out with more info related to Windows 7 and power management topics. The one above, that Windows 7 blog entry, is the one I recommend the most and should be the first one anyone reads to get at least a developer's perspective on what the Windows 7 team is trying to accomplish. And, make note to read through the comments on that blog entry as many of the things I've stated in this post are pointed out and echoed by other comments, most notably that the Apple platforms are nearly static and can be highly tuned as compared to Windows being used on that nearly infinite variety of configurations.

9 Ways How Windows 7 Will Save Battery Life

The Windows Performance Toolkit (referenced in the Windows 7 blog linked above) can be used "to observe the resource utilization of their applications, resolve performance bottlenecks and identify issues impacting energy efficiency." A worthwhile tool to at least take a look at for more information which is always a good thing too.


Windows 7 Power Management
- a PDF file direct from Microsoft (this link is a direct download of the PDF) to a whitepaper describing in more exacting detail most of the concepts of power management in Windows 7, highly recommended.

More to come...
 
Just what I wanted with some intelligent discussion: Blipvert posts, a single word... sorry, I don't do tidbits, you're just gonna have to read and learn something. ;)
 
Looks pretty interesting. Good write up on it too.

Since it looks like it can be run on a desktop too, I'd be curious if you notice any real power savings (say, using a Killawatt or the like) and how much extra runtime you get out of a battery, though I think that's going to be difficult to definitively nail down.

Should the tool report on an offending driver / software package, would we then be at the mercy of the manufacturer / developer to release a driver / software update that "complies" with what the OS is reporting as an energy drain? It's a roundabout way of asking if there is any type of power management at the OS level that adds power control (i.e. device isn't being used, turn device off).
 
I'd say definitely, but as Windows 7 isn't finalized yet, I'm suspecting that the information I've been seeing, especially the consistent reports of USB devices/hosts simply not handling power management efficiently, could be resolved as time goes by. If something as simple as a USB port can't be adequately controlled by the OS then yep, it's a driver issue and needs to be resolved by the device manufacturer or else we'll all continue to just "waste" power and never get the run-time we all should be expecting.
 
FFS Joe... The first 15 paragraphs almost said nothing at all, you could've stuffed the whole introduction to the post/thread (which amounts to almost half of it)... No offense, some of it is good info, referencing the small tests Anand did in particular, that test has been in the back of my mind for a good while now... But anyone that didn't already know most of the other stuff is probably not gonna be reading this post, at all (or they're gonna stop reading before it gets anywhere). :mad: :p

I haven't bothered messing w/Windows 7 on my netbook so far but I wanna get to it before it's released... I'll have to run this diagnostic tool once I've got it set up. What other kind of errors did you get? It found 30+ issues on your system if that was your screenshot... Might be useful if we start uploading the reports for comparison purposes. I know handling different power stages with a variety of USB devices has been one of the biggest struggles for MS for a while, and it's probably nigh impossible to get good data on that unless people are comparing their list of devices and issues.

That list of 9 key ways in which 7 improves on battery life surprises me, given the uninspiring tests done w/the beta and RC so far (with regards to battery life).

P.S. Windows 7 is Vista with two fresh coats of paint. Maybe some sealant, they definitely didn't do any major remodeling though! ;)
 
Was thinking about uploading reports but they're pretty extensive and even more wordy that I am in some respects. :D I did warn people that it was a Megapost soooo...

Most of the errors/problems were just that: USB device issues not responding to the command to "go to sleep" when requested. I've got 6 USB ports on this machine (off the mobo) and a module plugged into the floppy spot (where I'd normally have a floppy drive) and it has 4 USB ports - I just relooked at the report and noted there's 4 USB devices with that suspend issue and I'm going to bet that's what's causing it, so later today I'll disconnect those 4 ports and re-run the diagnostic to check for sure.

The one about the wireless thing isn't really an error I'd guess, more of a notification about the policy than anything else. One was about the power policy related to putting the machine to sleep (because it's plugged in) isn't an issue either unless I do enable all those features but... it's a desktop and it's always on so that's a pass.

This is an older Pentium D box with a craptastic VIA chipset on it so of course the firmware/BIOS isn't even supporting S3 standby, that's another error. And apparently it won't even honor SpeedStep either as that's another reported error too. Bleh... but it's a test box so such things are expected.

We'll see what happens...
 
USB Power saving can be a pita. Many devices wont go to sleep as they are supposed to.

/used to do USB development

Good and informative write up. Thanks for wading through all the information and giving a pretty damn good write up.
 
Hehe, now I'm intrigued by what it'll find on my netbook... I've noticed some laptops tend to manage battery charging more intelligently (or seemingly more intelligently) than my cheap netbook does.

For example, I've seen some that won't charge at all if they're at 90%+ or 95%+, I imagine that's to prolong the useful life of the battery (though at the same time it'd bother me if I'm ever trying to fully charge it before a trip, heh). Whenever I plug my netbook in the battery indicator goes oj (charging) and if I had charged it to 100% within the last day or two and turned it off while still plugged in then it might turn green (full charge) within 5-15s but otherwise it'll start charging it back up to 100% again.

I don't even know if that kinda behavior is wholly software dependent or if it's a combination of software and hardware... Interesting stuff for sure Joe, thanks for creating the thread even if you might've sunk it too! ;)
 
Was thinking about uploading reports but they're pretty extensive and even more wordy that I am in some respects.
Really?!

Impulse said:
I don't even know if that kinda behavior is wholly software dependent or if it's a combination of software and hardware...
My laptop has Smart Battery software (Compal) that's a software based solution that controls whether the battery is charging or not. Three levels of charge - 50%, 75%, 100% (i.e. if the battery falls below whatever threshold, charge to threshold and stop). You can press a button on the chassis (or change in software) to charge to 100% at any time. In the past year, I don't know that I've charged the battery to full more than 15 times as it takes forever to drain to the 50% that I have is set at (I'm guessing that drain to 50% isn't as good for the overall battery life as keeping it at 75% but can't back that up), though it doesn't travel off the desk much. On the downside to this, I don't know the behavior of the onboard charger or its effectiveness.

Hopefully, this'll push MFG's and OEM's to write better drivers should a centralized power control function not exist at the OS level (PowerX 9.0c, anyone?).
 
That's the thing tho, that kinda stuff has to have at 'least a rudimentary implementation in hardware too... After all, something's gotta govern what happens when the laptop's off and you plug it in to charge it, but if the hardware's doing it one way and the software is taking over and doing it a different way that seems kinda... Meh. None of this is ever seems to be even remotely documented when you get a new laptop, heh.
 
Well my initial results on my notebook aren't that interesting... Really the only thing to tweak is wireless and USB settings (I don't have anything plugged into USB... so IMO my results are going to be inconclusive).
 
Back
Top