Fast Resume, 6 years later

One of the last things I worked on for Windows XP was making laptops resume from standby quickly. The first part of this was re-writing the power IRP dispatching engine to make it asynchronous and smarter about managing the dependencies in the PNP tree. That was the fun part. The second part of this was hunting down each and every driver in the system that sat on their S0 (resume) IRP for longer than a few ms. That was the tedious part, involving manually collecting logs, post-processing with gnarly Perl scripts, and then going around trying to get whoever owned the driver (usually not Microsoft) to fix the driver.

We had some good success at this. Between twisting the arms of the driver writers  and convincing the BIOS folks not to do things like wait for the disks to spin up before giving control to the OS, we had a handful of laptops that could resume from S3 to the desktop in about a second.

It’s likely you’ve never seen a real off-the-shelf laptop resume this quickly. And the reason is that as soon as you stop twisting the arms of all the driver writers, they stop worrying about how fast your laptop resumes and go back to worrying about when they can get their widget driver mostly working so they can get through WHQL and sell their widget.

I knew that in Vista the performance team had done a lot of work in adding measurement hooks throughout the system and exposing those through ETW and the eventlog. Matt Pietrek’s post, a brand-new laptop, and nasty head cold inspired me to poke around in the new Vista Event Viewer.

If you open up Event Viewer and look under Applications and Services\Microsoft\Windows\Diagnostics-Performance, you may see some "Standby Performance Monitoring" events that look like this:

Congratulations, you’ve found yourself one of those ill-behaved drivers that slows down your system resume. This particular one I never even use, so off I go to Device Manager and disable it. Keep looking, you’ll find more:

 

This device doesn’t even WORK, yet it is slowing down my resume times by half a second. Back to Device Manager and disable it.

 If you are going to poke around in these events, I recommend right-clicking on the column header. You can add the Correlation ID column, and then Group By the Correlation ID to see everything in one standby/resume lumped together like this:

 

After making these tweaks, I got my resume duration down to 1726ms. And 1200ms of that is the video driver which I don’t recommend disabling.

It is great to see this kind of information exposed – I think it makes the whole system more diagnosable and power users can easily do the kind of analysis and tuning that used to require a guru with a kernel debugger and a handful of Perl scripts.  

This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a comment