Kyle Marsh Principal Program Manager Microsoft Corporation WCL305 Agenda Background Activity Services Tasks Power Graphics Intuitive UI Windows Performance Toolkit.

Download Report

Transcript Kyle Marsh Principal Program Manager Microsoft Corporation WCL305 Agenda Background Activity Services Tasks Power Graphics Intuitive UI Windows Performance Toolkit.

Kyle Marsh
Principal Program Manager
Microsoft Corporation
WCL305
Agenda
Background Activity
Services
Tasks
Power
Graphics
Intuitive UI
Windows Performance Toolkit
Fundamentals
Decrease
Increase
What Is Background Activity?
System activity that is not directly
initiated by user
Services, Scheduled tasks, some COM processes
such as a COM service, WMI providers, etc.
Part of nearly every usage scenario:
Search indexing
System security and maintenance
Network management
Device management
System configuration
Impact Of Background Activity
Performance
• Responsiveness to the user
• Consumes resources from
foreground applications
• Boot, Shutdown, Logoff, etc.
Security
• Activity may require
system privileges
• Successful attack may
compromise entire system
Reliability
• Memory leaks
• System crashes, hangs
• Dependent application
crashes
Power Consumption
• Extra disk, CPU utilization
• Decrease in battery life
• Prevents idle efficiencies
Background Activity Performance Impact
Compared IT image to clean Windows
Vista installation:
10 additional 3rd-party services
50
40
30
20
10
0
Boot Time
Shutdown Time
seconds
seconds
24.7
46.1
Clean
IT
45
30
15
0
0%
Clean
IT
15 second trace
15 second trace
4%
30
Disk Read Count
Idle CPU Utilization
8%
25.6
40,000
1.01%
6.04%
Clean
IT
20,000
0
10,192
Clean
31,401
IT
Windows 7
Trigger-Start Services
Trigger-Start centralizes
environmental detection logic
SCM registers for system
events via interesting providers:
Device arrival
IP address
Domain join and leave
Group policy updates
Custom ETW (Event Tracing for Windows) events
SCM starts or stops registered services
Some Trigger-Start Services In Windows 7
Service Name
Description
Trigger Type
AELookupSvc
Processes application compatibility cache
requests for applications as they are launched
Custom ETW
BDESVC
Provides BitLocker client services for user
interface and auto-unlocking of data volumes
Custom ETW
BTHSERV
The Bluetooth service supports discovery and
association of remote Bluetooth devices.
Device
SensorsMTPMonitor
Monitors MTP (Media Transfer Protocol) sensors
(such as a cell phone with a GPS receiver) to
communicate sensor data to programs
Device
TabletInputService
Enables Tablet PC pen and ink functionality
Device
WinDefend
Protection against spyware and potentially
unwanted software
Group Policy
Consider Scheduled Tasks
Task Triggers
Task Conditions
Calendar
Boot
Logon
Idle
Event log based entry
Workstation lock
Workstation unlock
Idle condition
Stop when
not idle
AC power only
Stop on battery
Wake computer
from sleep
Specific or
any network
connection
Scheduled Task Example
Power Efficiency Diagnostics
Windows 7 power problem
analysis
Executes every 2 weeks when
the system is idle
Requires SYSTEM privilege to
access
NT Kernel Logger
Saves report
data for user
Uploads CEIP
data to Microsoft
Kernel
Detects Idle Condition
Task Scheduler
(schedule)
Launches Task
Power Efficiency
Diagnostics
(powercfg.exe)
Performance and Power
Performance is critical for
background activity
Adds to the base footprint of the system
Interferes with foreground user activity
Resource utilization directly
tied to Power Consumption
Target:
Less than 2% CPU activity
when the system is idle
No disk activity when the system is idle
Evaluate and Measure:
Use XPerf (Windows Performance Tools Kit)
Battery Life
“Race quality
Trade
to Sleep”
or
performance
for power
Execute rapidly
savings
at high power
Quickly re-enter
Examples
Watts
low-power state
Index only high-priority
Extend average
items
idle duration
Disable animations
Examples
DVD playback at 30fps
Timer coalescing
instead
of 60fps
Idle Power
Idle
0W - Off
Time
Techniques
Consume Less CPU
Avoid polling at all costs!
Poll no more often than once per second
Use Timer Coalescing
Timer Coalescing API
Specify a tolerance for expiration of the timer
E.g., 1 second timer with 45 ms of tolerance
Tolerance should be at least 16ms, preferably 33ms
Period is not guaranteed
Timer will always expire within Period +/Tolerance from the previous expiration
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
);
);
Energy Efficiency Best Practices
Invest in performance optimizations
Reduce disk and CPU usage when the system is on battery
power
Do not render to the display when it is off
Avoid polling and spinning in tight loops
Do not prevent the system from turning off the display or idling
to sleep
Respond to common power-management events such as
system power source changes
Avoid use of high-resolution periodic timers (< 10ms) as this
reduces the efficiency of processor power-
management technologies
Windows 7's Usage of the GPU
Continues from Windows Vista…
Media Center UI
Video Playback
Desktop Window Manager (DWM)
Windows 7 DWM uses Direct3D10.1 API
Scales in performance all the way from low end
integrated to high end GPUs
Shaders are used for blurs in the Glass
Windows 7 memory consumption is cut by 50% per
window
More and richer animations of the thumbnails
Windows 7 DWM Memory Usage
Direct2D: New in Windows 7
Rendering Focused Immediate Mode API:
2D Vectors & Geometry, Bitmaps and Text
Hardware and Software Pipelines
Built for Performance on Direct3D 10.1
Interoperable with Direct3D and GDI
High Quality Rendering:
Per Primitive Anti-Aliasing and MSAA via
Direct3D
Remoted via Direct3D 10.1
Printing support via XPS
Direct2D Performance
DirectWrite: New in Windows 7
Modern typography
Enables world-wide applications
ClearType advances
Works with any rendering technology
Hardware accelerated via Direct2D
Gabriola
DirectWrite
Windows Performance Toolkit
Enables analysis for a broad range of issues including:
responsiveness issues
long delays in applications
resource utilization issues
slow On/Off transitions
poor battery life
Wide support range
cross platform: Vista, Server 2008, Windows 7
cross architecture: x86, x64, and ia64
Based on the Windows ETW Infrastructure
enables extensions which use ETW instrumentation to leverage tool set
intrinsic support for Windows kernel events
also support for Windows Events
Publicly available for download today
Strategic ongoing investment to enable performance analysis on
Windows
XPerf
Performance Best Practices
General
Use the Windows Performance Toolkit to measure system
performance during all scenarios (steady state and on/off
transitions)
Optimize application resource consumption (CPU and Disk) in both
active and Idle states
Perform testing in a controlled way and make comparisons against a
valid baseline
Obtain a baseline measurement on a system with as few system
extensions as possible
Add devices, applications, and services one at a time and test for any
performance regressions
Boot
Reduce application resource consumption post-boot
Avoid using load order groups to express service dependencies
Ensure that all services report as running as soon as possible during
boot to avoid blocking the Service Control Manager (SCM)
Ensure that all non-essential services are converted to Demand or
Trigger start in order to free up system resources during boot
Avoid using managed code for services and applications on the
startup path
Performance Best Practices
Sleep/Hibernate
Avoid delays in processing the suspend notification
(WM_POWERBROADCAST message)
Verify that services do not opt in to receive suspend notifications
unless absolutely required
Ensure that all services respond quickly to resume events and
minimize post resume CPU, disk and network usage
Shutdown
Ensure that all services do not opt in to receive preshutdown and
shutdown notifications unless absolutely required
Ensure that all services that have opted to receive shutdown
notifications respond quickly to the SCM
Ensure that all applications respond quickly to shutdown notifications
(WM_QUERYENDSESSION and WM_ENDSESSION messages)
Reduce delays in the shutdown path of services and applications by
minimizing CPU, disk and network activity in response to shutdown
notifications
Resources
Windows Software Development Kit (SDK)

http://msdn.microsoft.com/en-us/windows/bb980924.aspx
Windows Performance Analysis Developer Center:

http://msdn.microsoft.com/en-us/performance/default.aspx
Windows Performance Analysis forum:

http://social.msdn.microsoft.com/Forums/en-US/wptk_v4/threads/
Event Tracing for Windows MSDN docs:

http://msdn2.microsoft.com/en-us/library/aa363787.aspx
On/Off Transition Performance Analysis of Windows Vista:

http://www.microsoft.com/whdc/system/sysperf/On-Off_Transition.mspx
Windows On/Off Transitions Solutions Guide:

https://connect.microsoft.com/PartnerBeta/Downloads/DownloadDetails.aspx?DownloadID=17037
Battery Life Solutions Guide:

http://www.microsoft.com/whdc/system/pnppwr/mobile_bat.mspx#
Windows Internals:

“Windows Internals 4th edition” by Mark Russinovich and David Solomon
Track Resources
→ Want to find out which Windows Client sessions are best
suited to help you in your deployment lifecycle?
→ Want to talk face-to-face with folks from
the Windows Product Team?
Meet us today at the
Springboard Series Lounge, or visit us at
www.microsoft.com/springboard
Springboard Series
The Springboard Series empowers you to select the right resources, at the right
technical level, at the right point in your Windows® Client adoption and management
process. Come see why Springboard Series is your destination for Windows 7.
Complete an
evaluation on
CommNet and
enter to win!
© 2009 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.