资源预览内容
第1页 / 共49页
第2页 / 共49页
第3页 / 共49页
第4页 / 共49页
第5页 / 共49页
第6页 / 共49页
第7页 / 共49页
第8页 / 共49页
第9页 / 共49页
第10页 / 共49页
亲,该文档总共49页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
1,Windows Vista: Developing Power-Aware Applications,Pat Stemen FUN319 Program Manager Core Platform Architecture Microsoft Corporation patstemicrosoft.com,Geralyn Miller Program Manager Windows Laptop PC Microsoft Corporation gemillermicrosoft.com,2,Agenda,Windows Vista Power Management Goals Power-Aware Applications Handling Sleep Transitions Power versus Performance Integrating with Windows Power Policy Testing for Power Management,3,Windows Vista Power Management Goals,Simplify the user experience Enhance and extend power management usage models Improve the reliability of sleep transitions Predictable behavior Visibility into power management actions Extensive diagnostic tracing Enable maximum energy savings Mobile PC battery life Desktop power consumption,4,Windows Vista Mobile PC Pillars,Smooth Transitions,Eliminate existing pain points,More Places,More time on Windows each day,More Scenarios,New mobile experiences, new value,Fast Startup Power Management Connectivity Synchronization Displays,Natural Input/Output Context Awareness Auxiliary Displays Security Backup & Recovery,Collaboration Digital Ink Mobile Media,5,Power-Aware Applications,To achieve power management goals, applications must be power-aware Designed and tested for power management Applications must handle sleep transitions seamlessly You can differentiate your application with power management features Handle power management events Scale behavior based on users power preference and state of the machine Integrate with Windows power policy,6,Enabling Maximum PC Energy Savings,Windows Vista will, by default, enable energy-saving features on all PCs Sleep is the default “off” behavior on both desktops and mobiles Desktop systems will have monitor blanking and sleep idle timeouts Aggressive power policy defaults for mobile PCs Windows Vista addresses the principle power management adoption blockers Removes need to be Administrator to change policy settings Supports Group Policy control of power settings Provides a rich power policy command-line tool Features reliable and deterministic sleep transitions,7,Handling Sleep Transitions Overview,Maximizing PC energy savings requires reliable sleep transitions But, failed transitions are the primary sleep adoption blocker Component vetoes are the primary cause Roughly 1/3 of all sleep failures Drivers may veto sleep requests Services may silently fail sleep Some applications display warnings, some do not Some may display warnings with the laptop lid closed!,8,Component vetoes lead to great user frustration and distrust of power management System did not do what the user asked Worst case scenario Laptop in a bag fails to sleep, or wakes and fails to return to sleep Battery drains, system overheats, laptop is unusable when needed, possible data loss Users turn off sleep and use shutdown,Handling Sleep Transitions Overview,9,Handling Sleep Transitions Overview,Investigations show that applications and services abuse the ability to veto Veto instead of develop and test for power management Veto to prevent potential network connectivity loss Same component may handle network connectivity well outside of sleep / resume,10,Handling Sleep Transitions Windows Vista changes,Windows Vista will not query user mode components when entering sleep PBT_APMQUERYSUSPEND event will not be sent Windows Vista will continue to notify user mode components when entering sleep PBT_APMSUSPEND event is sent Timeout has been reduced from 20s to 2s Use this event to do limited cleanup before the suspend transition,11,Handling Sleep Transitions Applications,Do not depend on blocking a sleep state transition An event will always be sent when the system resumes from sleep PBT_APMRESUME, PBT_APMRESUMECRITICAL, PBT_APMRESUMEAUTOMATIC Use this event to automatically restart a task that did not complete because of a sleep state transition PBT_APMxxx events are delivered with the WM_POWERBROADCAST message More information available in the Platform SDK,12,Handling Sleep Transitions Idle to Sleep,Sleep idle timeout Transitions the system to sleep after period of inactivity Reduces power consumption when the PC is not in use User-configurable, but enabled by default in Windows Vista on both mobiles and desktops Applications may temporarily disable sleep idle timer to ensure system availability e.g., burning a CD, recording a TV show Only disable the timer if absolutely necessary, users expect the system to idle to sleep,13,Handling Sleep Transitions Idle to Sleep,SetThreadExecutionState API Temporarily disables the sleep idle timer Does not prevent user-initiated sleep transitions Button press, lid switch, Start - Sleep, etc. Usage of SetThreadExecutionState Disable the sleep idle timer,SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_CONTINUOUS);,Process Task When complete, re-enable the sleep idle timer,SetThreadExecutionState(ES_CONTINUOUS);,If your process is unexpectedly terminated, the power manager will automatically cle
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号