1 / 48

Fundamentals in Windows Applications for Developers: Graphics, Power, Services , and Profiling

Required Slide. SESSION CODE: WCL306. Fundamentals in Windows Applications for Developers: Graphics, Power, Services , and Profiling. Yochay Kiriaty Senior Technical Evangelist Microsoft Corporation. Improved Fundamentals in Windows 7. Memory Reference set, Graphics

justise
Télécharger la présentation

Fundamentals in Windows Applications for Developers: Graphics, Power, Services , and Profiling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Required Slide SESSION CODE: WCL306 Fundamentals in Windows Applications for Developers: Graphics, Power, Services, and Profiling Yochay Kiriaty Senior Technical Evangelist Microsoft Corporation

  2. Microsoft Confidential

  3. Improved Fundamentals in Windows 7 MemoryReference set, Graphics Disk I/ORegistry Reads, Indexer PowerDVD Playback, Panel, Timers Increase Decrease SpeedFasterBoot, Device Ready ResponsivenessStart menu, Taskbar Scale256 cores

  4. Building A Great Windows 7 Applications Create new experiences on Windows 7 Differentiate • EXPERIENCE Become a first class Windows 7 citizen Optimize Productpasses Microsoft quality tests Compatible

  5. Optimize for User ExperienceGet the Most Out of Windows New UI Enhancements • Taskbar • Jump lists • Thumbnail Preview and Aero-peek • Libraries and federated search • Windows Ribbon • DirectX, DirectWrite, and Direct2D • More advance topics: • Windows Touch • Windows Sensors and Location WLC312 -Optimizing Your Application for the Windows 7 User Experience Wednseday June 9th, Room 356, 8 am

  6. Optimize for PerformanceGet the Most Out of Windows Performance Enhancements • I/O priorities and cancelable I/O • File System and Registry Transaction Support • Windows Error Reporting • Application restart and recovery with Restart Manager • Power efficiency improvements • Trigger-Start Services • Windows Troubleshooting Platform • Windows Instrumentation • Windows Performance Tool Kit

  7. Ensuring Good Performance • Responsiveness • Unresponsive system  customer dissatisfaction • Resource Utilization • CPU, disk, memory, network, Battery • Resources are limited and shared by others • Good Citizenship • It takes just one component to impact the entire system performance

  8. Power Efficiency

  9. Power Efficiency • “All day” mobile PC battery life • TCO – reduced cost of energy consumption • New power consumption regulatory compliance • Environmental consortiums for computing (Green Computing) • Software performance is critical for Power Efficiency • Windows 7 power optimization • Less than 2% CPU activity when the system is idle • No disk activity when the system is idle • Reduced number of OS activities that prevent use of CPU’s power-saving modes.

  10. Power Efficiency – Timer Coalescing API • Platform energy efficiency can be improved by extending idle periods • New timer coalescing API enables callers to specify a tolerance for due time • Enables the kernel to expire multiple timers at the same time BOOL WINAPI SetWaitableTimerEx( __in HANDLE hTimer, __in const LARGE_INTEGER *lpDueTime, __in LONG lPeriod, __in_opt PTIMERAPCROUTINE pfnCompletionRoutine, __in_opt LPVOID lpArgToCompletionRoutine, __in_opt PREASON_CONTEXT WakeContext, __in ULONG TolerableDelay ); Timer tick 15.6 ms Vista Periodic Timer Events Windows 7

  11. Analyze Energy-Efficiency DEMO

  12. Trigger Start Services

  13. Impact of Background ActivitiesMany activities in the background • Performance • Responsiveness • Consumes resources • Boot, shutdown, logoff, and so on • Reliability • Memory leaks • System crashes and hangs • Dependent application crashes • Power consumption • Extra disk, CPU utilization • Decrease in battery life • Prevents idle efficiencies • Security • Greater attack surface • System privileges • Successful attack may compromise entire system

  14. Do We Really Need So Many Services? • OEMs and third parties services • Most services are not required during log-on • Even more services are not required during boot • Most services do not need to run 24x7 • Conclusion: • Most services can be launched on demand when needed • Most services can be terminated on demand when needed • Consider using Windows Tasks

  15. Service Startup Types Prior to Windows 7 • Automatic Start • Your service is always there • Launched as part of the boot sequence • Slower startup time • Bigger memory footprint • Delayed Auto Start • Just deals with Slow startup time • Demand Start (manual) • You must programmatically launch the service • Why these services startup types are not enough? • Automatic Start adds latency to boot and shutdown, and always consumes resources • Demand Start is hard to program against and just resolve the startup problems

  16. New In Windows 7 - Trigger Start Services • Trigger Start services are started when needed and stopped when their work is completed • The service should be running only if it has something to do. • Windows 7 Available service triggers: • Device interface arrival • Joining or leaving a domain • Opening or closing a firewall port • Group policy change • First IP address arrival • Last IP address removal • Custom events (ETW)

  17. Trigger Start API SERVICE_TRIGGER trigger = { 0 }; trigger.dwTriggerType = SERVICE_TRIGGER_TYPE_IP_ADDRESS_AVAILABILITY; trigger.dwAction = SERVICE_TRIGGER_ACTION_SERVICE_START; trigger.pTriggerSubtype = (GUID*)&NETWORK_MANAGER_FIRST_IP_ADDRESS_ARRIVAL_GUID; SERVICE_TRIGGER_INFO info = { 0 }; info.cTriggers = 1; info.pTriggers = &trigger; ChangeServiceConfig2(hService, SERVICE_CONFIG_TRIGGER_INFO, &info);

  18. Trigger Start Services In Windows 7 DEMO

  19. Troubleshooting Platform

  20. Windows Troubleshooting Platform Consistent troubleshooting experience • Reduces helpdesk costs and drive higher user satisfaction • Automates standard diagnoses, verify cycle Extensible–write your scripts and you’re good to go • Based on Windows PowerShell™ scripts, can invoke any code • Windows Troubleshooting Pack Designer (SDK) • Easily integrated into your application • Many troubleshooters available out of the box • Leverage Windows troubleshooting for common issues

  21. Windows Troubleshooting Platform In Action DEMO

  22. Troubleshooting Components • Troubleshooting Pack: • Implemented in PowerShell V2 • Uses a standard wizard interface • Signed by a certificate • Deployed as .cab files • Can run remotely, can run unattended • Troubleshooting Platform: • Executes troubleshooting packs • Generates reports for analysis

  23. Troubleshooting PackAnatomy Identification Metadata • Name and description • List of configuration issues • Security signature Detection Scripts • Checks current configuration with expected configuration Trouble-shooting Pack Resolution Scripts • Sets the current configurationto what is expected Verification Scripts • Verifies that current configuration is now what is expected Localized Resources • Contains localized display strings in MUI format

  24. Component Interaction Process 1 GUI CMD Troubleshooting Pack Windows Troubleshooting Framework Troubleshooting Runtime Engine Results and Reports Get-DiagInput Update-DiagReport Add-DiagRootCause Write-DiagProgress PowerShell Scripts Platform cmdlets Process 2 PowerShell Runtime

  25. Windows Troubleshooting Platform In Action Built your own troubleshooting package DEMO

  26. Windows Instrumentation

  27. Windows Instrumentation • Key Features • High-performance, low overhead, highly scalable • Native and Managed APIs • Dynamic enablement of data collection • Multiple data collection options • Technology options • (Windows Management Instrumentation) • Performance Counters • Event Log • Event Tracing for Windows (ETW)

  28. Windows Performance Counters • Always-present, always-on instrumentation infrastructure • Numeric information grouped into categories, counters and instances • Access • Programmatically (native and managed) • Through script languages • Using the Performance Monitor tool (perfmon)

  29. Exposing Performance Counters • Native • Create a manifest • Use the CTRPP preprocessing tool • PerfAutoInitialize • PerfCreateInstance • PerfSet*Counter*Value • Managed: System.Diagnostics namespace • PerformanceCounterCategory class • CounterCreationDataCollection class • PerformanceCounter class

  30. Windows Performance Counters Exporting and viewing custom performance counters DEMO

  31. ETW/Event LogEvent tracing for Windows • Always-present, selectively-on logging infrastructure • Information defined by event templates • Access • Programmatically (native and managed) • Script languages (PowerShell) • Command Line tools (tracerpt) • Event Viewer

  32. Windows Event Overview

  33. Xperf Scenarios • Profile applications or the system itself (sampling profiler mode) • Capture ETW data for later analysis • Determine whether an application is I/O- or CPU-bound • …and many others!

  34. Windows Performance Toolkit • xperf.exe: Command-line tool for ETW capturing and processing • xperfview.exe: Visual trace analysis tool • xbootmgr.exe: On/off transition state capture tool • Works on Windows Vista SP1, Windows Server 2008 and Windows 7

  35. Capturing A Trace • Turn tracing on: xperf -on <PROVIDER> • Perform activities • Capture a log: xperf -d <LOG_FILE_NAME> • Analyze it: xperf <LOG_FILE_NAME> • xperf -on Base • xperf -d result.etl • xperfview result.etl

  36. XperfDisk utilization

  37. XperfHard page faults

  38. XperfOverlay graph

  39. Using Xperf to identify performance issues Capture and analyze DEMO

  40. Optimize for Windows 7 Summary • Use Windows 7 features to optimize for performance • I/O priorities and cancelable I/O • File System and Registry Transaction Support • Windows Error Reporting • Application restart and recovery with Restart Manager • Power efficiency improvements • Trigger-Start Services • Windows Troubleshooting Platform • Windows Instrumentation • Use Windows Performance Tool Kit to profile

  41. Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Track Resources • Learn about Windows Client Development: http://developforwindows.com • Try out the Internet Explorer 9 Platform Preview: www.ietestdrive.com • Interested in Windows hardware or software? Check it out: http://ReadySet7.com

  42. Required Slide Resources Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet • http://microsoft.com/msdn

  43. Required Slide Complete an evaluation on CommNet and enter to win!

  44. Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st http://northamerica.msteched.com/registration You can also register at the North America 2011 kiosk located at registrationJoin us in Atlanta next year

  45. © 2010 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.

  46. Required Slide

More Related