PC02  Pat Stemen Senior Program Manager Microsoft Corporation Processor Power Over Time12080400 1985 1987 1989 1991 1993 1995 1997 1999 2001 2003 2005

Download Report

Transcript PC02  Pat Stemen Senior Program Manager Microsoft Corporation Processor Power Over Time12080400 1985 1987 1989 1991 1993 1995 1997 1999 2001 2003 2005

PC02

Pat Stemen
Senior Program
Manager
Microsoft Corporation
Processor Power Over Time
140
120
100
80
60
40
20
0
1985 1987 1989 1991 1993 1995 1997 1999 2001 2003 2005
Clean compared to OEM Pre-install
Windows Vista RTM Idle
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
-20%
-10%
0%
Clean Install Battery Life Is Better
10%
20%
30%
40%
50%
60%










1.
2.
3.
4.
5.
6.
7.
8.
Why does idle power matter?
• Most user workloads are dominated by
idle time
• Reducing idle power reduces the “base” power
consumption of the system
• OEMs are focusing on driving down system
idle power for regulatory compliance
Watts
Components:
Workloads
Workloads
~8-12W Idle
Idle
0W - Off
Time
•
•
•
•
Platform hardware, devices and drivers
Core OS and kernel
OS services (indexing, background tasks, etc.)
Applications and services
Watts
• Trade
Resource
or
“Racequality
to utilization
Sleep”
optimizations
performance
for
• Execute rapidly
power
• Reduce
at savings
high power
powerby
eliminating unnecessary
• Examples
• Quickly
activity re-enter
• low-power
Index only highstate
• Examples:
items
•• priority
Extend
average
Events and
notifications
• Disable
animations
idle
duration
instead of polling
•• DVD
playback
at
• Examples
Extending
polling
of 60fps
intervals
• 30fps
Timer instead
coalescing
•
Idle Power
Idle
0W - Off
Time
Eliminating periodic
disk activity

25
20




15
10

Internal Microsoft measurements, Intel processor
100%
70%
50%
40%
30%
20%

10%
0
Idle
5










Timer tick
15.6 ms
Vista
Periodic Timer
Events
Windows 7





BOOL
DllImport("kernel32.dll")]
WINAPI
static extern bool SetWaitableTimerEx(
SetWaitableTimerEx(
IntPtr hTimer,
__in
HANDLE hTimer,
ref long lpDueTime,
__in
const LARGE_INTEGER *lpDueTime,
int lPeriod,
__in
LONG lPeriod,
TimerCompletionDelegate
__in_opt PTIMERAPCROUTINE pfnCompletionRoutine,
pfnCompletionRoutine,
__in_opt LPVOID lpArgToCompletionRoutine,
IntPtr lpArgToCompletionRoutine,
__in_opt PREASON_CONTEXT WakeContext,
IntPtr WakeContext,
__in
ULONG TolerableDelay
ulong TolerableDelay
);
);

13
12


11
10
9
8
7


6
5
4
3
2



1
0
15.6ms
(default)
1 ms
CPU Power
System Power







Example HDD Power
5

4

3


2
1

0













































//
// Create a SystemRequired request to keep the system from automatically sleeping while downloading a file.
//
POWER_REQUEST_CONTEXT DownloadPowerRequestContext;
HANDLE DownloadPowerRequest;
//
// Set up the diagnostic string
//
DownloadPowerRequestContext.Version = POWER_REQUEST_CONTEXT_VERSION;
DownloadPowerRequestContext.Flags = POWER_REQUEST_CONTEXT_SIMPLE_STRING;
DownloadPowerReqeustContext.Reason.SimpleReasonString = L”My application is downloading files.”
//
// Create the request, get a handle
//
DownloadPowerRequest = PowerCreateRequest(&DownloadPowerRequestContext);
//
// Set the request
//
PowerSetRequest(
DownloadPowerRequest,
PowerRequestSystemRequired
);
// Download the File...
//
// Clear the request
//
PowerClearRequest(DownloadPowerRequest);


























http://www.microsoft.com/whdc/system/sysperf/perft
ools.mspx








http://www.microsoft.com/whdc/system/pnppwr/powermgmt/PM_apps.mspx
http://msdn.microsoft.com/en-us/magazine/cc163386.aspx



http://www.microsoft.com/whdc/system/pnppwr/powermgmt/PMapps_samp.mspx


http://msdn.microsoft.com/en-us/magazine/cc163386.aspx



http://www.codemagazine.com/articleprint.aspx?quickid=0512102&printmode=true


http://www.microsoft.com/whdc/system/sysperf/perftools.mspx


http://www.microsoft.com/whdc/DevTools/WDK/WDKpkg.mspx

C# function definitions and enumerations
[DllImport("kernel32.dll")]
static extern IntPtr PowerCreateRequest(
ref POWER_REQUEST_CONTEXT Context
);
[DllImport("kernel32.dll")]
static extern bool PowerSetRequest(
IntPtr PowerRequestHandle,
PowerRequestType RequestType
);
[DllImport("kernel32.dll")]
static extern bool PowerClearRequest(
IntPtr PowerRequestHandle,
PowerRequestType RequestType
);
enum PowerRequestType {
PowerRequestDisplayRequired = 0,
PowerRequestSystemRequired,
PowerRequestAwayModeRequired,
PowerRequestMaximum
}
const int POWER_REQUEST_CONTEXT_VERSION = 0;
const int POWER_REQUEST_CONTEXT_SIMPLE_STRING = 0x1;
const int POWER_REQUEST_CONTEXT_DETAILED_STRING = 0x2;
C# structures
//
//
//
//
//
//
//
//
//
//
Note:
Windows defines the POWER_REQUEST_CONTEXT structure with an
internal union of SimpleReasonString and Detailed information.
To avoid runtime interop issues, this version of POWER_REQUEST_CONTEXT
only supports SimpleReasonString. To use the detailed information,
define the PowerCreateRequest function with the first parameter of type
POWER_REQUEST_CONTEXT_DETAILED.
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public struct POWER_REQUEST_CONTEXT
{
public UInt32 Version;
public UInt32 Flags;
[MarshalAs(UnmanagedType.LPWStr)] public string SimpleReasonString;
}
[StructLayout(LayoutKind.Sequential)]
public struct PowerRequestContextDetailedInformation
{
public IntPtr LocalizedReasonModule;
public UInt32 LocalizedReasonId;
public UInt32 ReasonStringCount;
[MarshalAs(UnmanagedType.LPWStr)] public string[] ReasonStrings;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POWER_REQUEST_CONTEXT_DETAILED
{
public UInt32 Version;
public UInt32 Flags;
public PowerRequestContextDetailedInformation DetailedInformation;
}
www.microsoftpdc.com
© 2008 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.