Professional Documents
Culture Documents
In Windows Vista
Pat Stemen
Program Manager
Windows Platform Architecture Group
Microsoft Corporation
Agenda
Windows Vista Power Management Goals
Windows Vista Power Management
Feature Overview
Power Policy Configuration Tasks
S3 Resume Performance
Resume Performance Measurements
Measuring with PwrTest
Windows Vista Power
Management Goals
c:\>powercfg.exe –setacvalueindex
<SCHEME> <SUBGROUP> <SETTING> <VALUE>
c:\>powercfg.exe –setacvalueindex
SCHEME_BALANCED SUB_SLEEP STANDBYIDLE 0
Common Power Policy
Configuration Tasks
Rename a power scheme
Update power scheme friendly name, description
Strings can be localized
Use “@dllpath,-resourceID” syntax
E.g., “@%SystemRoot%\system32\powrprof.dll,-14”
c:\>powercfg.exe –renamescheme
<SCHEME> <FriendlyName> [Description]
c:\>powercfg.exe –export
<FileName> <Scheme>
c:\>powercfg.exe –export
MyBalanced.pow SCHEME_BALANCED
Common Power Policy
Configuration Tasks
Import a power scheme
Restores a power scheme from a file containing
an exported power scheme
Allows IT, OEM to install custom power scheme
on multiple systems
Specify a well-known GUID when importing the new scheme
to enable group policy enforcement
c:\>powercfg.exe –import
<FileName> [NewSchemeGUID]
c:\>powercfg.exe –replacedefaultschemes
Optimizing S3 Resume Performance
Power On
Time to prepare the hardware for resume
No processor instructions are executed
Begins with wake event
E.g., RTC, HW button, wake-capable device
Ends when processor begins executing instructions
The performance of the Power On phase can not be measured
by software
S3 Resume Process Phases
BIOS Initialization
Time required to initialize hardware
CPU, memory controller, cache, chipset
Only BIOS code is executing
Starts with power-on reset vector
Phase ends when the processor jumps to the OS waking vector
Phase duration is measured using the processor time-stamp counter (TSC)
TSC is assumed to be reset (value of 0) during the Power On phase
Windows records the value of the TSC immediately after OS begins
executing instructions
Windows records the frequency of the TSC during
the suspend process
Resume Process Phases
Device Initialization
Time required to notify devices that the system has resumed
Power manger sends IRP_MN_SET_POWER (S0) IRPs to all drivers
Phase begins immediately after OS regains control from the BIOS
Phase ends after all drivers have completed their system power
(IRP_MN_SET_POWER, S0) IRPs
Phase duration logged
IRP start, completion times also recorded
Resume Process Phases
USER Initialization
USER applications and services are notified that the system has resumed
WM_POWERBROADCAST message, PBT_APMRESUME event
Begins immediately after devices have been initialized
Ends after the power manager has asked the USER subsystem
to notify applications
USER notifications occur asynchronously from the power manager’s point of view
USER notifications continue to occur after the power manager has considered
resume to be complete
Phase progress logged
Measuring Resume Performance
Drivers for devices without children devices will help decrease total
DriverInit time by completing their S-IRP immediately
1. Request a D0 set-power IRP immediately after receiving
an S0 set-power IRP
2. Complete the S0 set-power IRP immediately
Do not wait for the D0 IRP completion before completing the S0 IRP
Continue to queue I/O until the D0 IRP is completed
3. Complete any device initialization required when the D0 set-power IRP
is received
4. Complete the D0 set-power IRP
5. Begin handling any queued I/O requests
I/O should be queued when the Dx set-power IRP is received on the suspend path
Completing the S-IRP immediately enables the power manager
to power up additional devices
Resume Performance Best Practices
White papers
Measuring Resume Performance on Windows Vista
http://go.microsoft.com/fwlink/?LinkId=61994
Direct Application Launch for System Startup on Windows Vista
http://www.microsoft.com/whdc/system/vista/DirAppLaunch.mspx
Other WinHEC Sessions
CPA013: “Case Study: ATI Device Power Management
in Windows Vista”
CPA002: “ACPI in Windows Vista”
Backup Slides
Resume Performance Event
Windows Vista exposes resume performance information
in the event log
Automatically, every sleep/resume transition
Event details
Source
Microsoft-Windows-Power-Troubleshooter
Event ID
1
Description
“The system has resumed from sleep”
Sleep Time: [date-time]
Wake Time: [date-time]
Wake source: [wake source description]
Resume performance, sleep state, Hibernate metrics included
in event data
Backup Slides
Hybrid Sleep
Drivers for wake-capable devices may need to do extra
work on a Hybrid Sleep transition
Only necessary if your device supports wake from S3,
but not wake from S4
If your device supports wake from S3, it should also support wake
from Hybrid Sleep
However, IRP_MN_SET_POWER Parameters.Power.State ==
PowerSystemHibernate (S4) for Hybrid Sleep
Use the SystemContext field of the IRP_MN_SET_POWER IRP
to determine if the system is transitioning to Hybrid Sleep
Arm for wake if your device supports wake from S3
Use SYSTEM_POWER_STATE_CONTEXT
TargetState == PowerSystemSleeping3
EffectiveState == PowerSystemHibernate
Backup Slides
Hybrid Sleep
Arm device for wake on Hybrid Sleep transition
TargetSystemState == PowerSystemSleeping3
EffectiveSystemState == PowerSystemHibernate
typedef struct _SYSTEM_POWER_STATE_CONTEXT {
union {
struct {
ULONG Reserved1 : 8;
ULONG TargetSystemState : 4;
ULONG EffectiveSystemState : 4;
ULONG CurrentSystemState : 4;
ULONG IgnoreHibernationPath : 1;
ULONG Reserved2 : 11;
};
ULONG ContextAsUlong;
};
} SYSTEM_POWER_STATE_CONTEXT, *PSYSTEM_POWER_STATE_CONTEXT;
© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions,
it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.