Using Instrumentation And Troubleshooting To Develop High-Quality Software
Ricky BuchProgram ManagerMicrosoft Corporation
Kevin Michael WoleyProgram ManagerMicrosoft Corporation
PC50
Solving software problems in Windows Instrumentation and Troubleshooting platform
Windows Instrumentation Event and Counter platform Windows 7 improvements Design principles
Windows Troubleshooting Key Features Architecture Deployment
Agenda
When software is inconsistent with expectations
Why are software problems bad? Lower customer satisfaction Reduced profit
Software problems can be caused by Design Issues Configuration conflicts
Software Problems
Address in standard, structured way Minimize development cost Programmatic analysis Enable problem detection and resolution
Windows provides two platforms that address above criteria Instrumentation Platform Troubleshooting Platform
Solving Software Problems
Windows Instrumentation: Performance Counters And Events
Kevin Michael WoleyProgram ManagerMicrosoft Corporation
The purpose of instrumentation Diagnose and debug problems Manage and maintain software
Instrumentation is used by Developers
Ex: Measuring performance of an application System administrators and IT Professionals
Ex: Determining system workload characteristics
Instrumentation Overview
Instrumentation exposes internal OS and application state in a discoverable, easily consumable, standardized way
Key Features High-performance, low overhead, highly scalable Native and Managed APIs Dynamic enablement of data collection Data delivered in real-time or persisted in files
Windows Instrumentation
Performance Counters EventsExample Usages
• Expose processing rates• Measure performance
• General notifications• Errors and warnings• Trace actions for debugging
Data Types Strictly Numerical No restrictionData Consumption
• Polled in real-time• Written to a log file
• Delivered in real-time• Written to a log file• Buffered in memory
Applications can make use of both Performance Counters and Events
Event Audience Developer Developer; IT Professional
System Administrator
Technology WPP ETW Event LogEvent Control Manual Manual Always OnMax Event Rate High (10^4 / sec) High (10^4 / sec) Medium (10^2 - 10^4 / sec)
Features • Easy Implementation• Requires symbol-like files to decode
• Declaratively defined in manifests• Programmatic Consumption• Discoverability• Localizable Strings• Flexible Data Model• Higher dev cost than WPP
Same Features of ETW plus:• Remote Collection• Data Query Support• Inbox Tool Support• Centralized event logs• Reduced logging rate
Windows Event Overview
Common API Set and Development Model
New Version 2.0 Kernel Mode APIs Declaratively defined in XML Leverages Version 2.0 infrastructure from Vista
Fundamental Quality Investments Enhanced performance, scalability, and robustness Several new system counters exposing
Windows internals Improved design-time validation
Scriptable Consumption using PowerShell Consume live counters (get-counter) Read and write counter log files
(import-counter/export-counter)
Performance Counter Improvements In Windows 7
Fundamental Quality Investments Enhanced performance, scalability, and robustness Several new Windows events and event providers
Event Development Improved design-time validation Automatically generate code from XML
Event Consumption Scriptable consumption using PowerShell (get-event)
Discover and read ETW or Eventlog events locally or remotely Portable event log file decoding Improved data formatting Windows Performance Toolkit Improvements
ETW/Event Log Improvements In Windows 7
Design for the appropriate audience Provide meaningful event messages and
counter descriptions Provide actionable events and counters
for System Administrators and IT Professionals Use recommended interfaces
Performance Counters Version 2.0 Managed – System.Diagnostics.PerformanceData User Mode – PerfSet*(), PerfIncrement*(), etc. Kernel Mode – PcwRegister(), PcwCreateInstance(), etc.
Manifest-based ETW and Event Log APIs Managed – System.Diagnostics.Eventing User Mode – EventWrite(), etc. Kernel Mode – EtwWrite(), etc.
Instrumentation Design Considerations
Design your application’s events and counters with a goal in mind
Windows Instrumentation Design Workflow
Design
1 DesignCreate
InstrumentationManifest
(ECMangen)
XML Manifest
2 InstrumentationDefinition
CTRPP / MCpreprocessors
.rc
.c
.h
3 GenerateCode
Instrumentprovider APIs
New provider
code
4 Instrument
BuildNew
Provider
5 Build
5 StepsWin7: Event Logging Code
Generation & Improved Manifest Validation
Automating Troubleshooting Spend less time fixing problems Deflect calls or reduce minutes-per-incident
Different types of software problems Design issues Configuration conflicts
Troubleshooting configuration Verify if desired user state can be supported Set configuration to support desired state
Windows 7 Troubleshooting Approach
Troubleshooting is the process of detecting and resolving a problem
Windows 7 troubleshoots configuration problems using Troubleshooting Packs
A Troubleshooting Pack is a program that Launched by the user or an application Detects and resolves configuration issues Verifies that configuration
has been set properly
Windows 7 Troubleshooting Implementation
Troubleshooting Packs detect and resolve configuration problems
Easy to Discover Inbox or online help documentation Windows Troubleshooting Interface
Simple to Execute Each pack uses a standard wizard user interface Single-click problem resolution
Secure Signed by a certificate to ensure pack integrity
End-User Troubleshooting Features
Easy to Deploy Deploy as .cab files onto a file share or website
Flexible Execution Run interactively or in unattended mode Run on local or remote machines
Secure Signed by a certificate to ensure pack integrity Group Policy can control which packs
can execute
System-Administrator Troubleshooting Features
Easy to Develop Packs use Windows PowerShell
Detection, resolution and verification code Capturing user input and relaying progress
Can be deployed with application Simple to Debug
Errors and exceptions from PowerShell scripts captured in a debug report
Secure Signed by a certificate to ensure pack integrity
Developer Troubleshooting Features
Troubleshooting Pack consists of metadata and script files Troubleshooting Platform executes the
Troubleshooting Pack Leverages the PowerShell runtime to execute scripts Interacts with the GUI or command-line Generates reports for analysis
Architecture Overview
Trouble-shooting
Packs
Troubleshooting Platform
PowerShell
GUI
Reports
CMD
Diagram Of A Troubleshooting Pack
Identification Metadata
Resolution Scripts
Verification Scripts
Localized Resources
Trouble-shooting
Pack
• Name and description• List of configuration issues• Security signature
• Checks current configuration with expected configuration
• Sets the current configuration to what is expected
•Verifies that current configuration is now what is expected
• Contains localized display strings in MUI format
Detection Scripts
Diagram Of Component Interaction
Troubleshooting Platform
PowerShell Runtime
Reports
GUI CMD
Identification Metadata
Detection Scripts
Resolution Scripts
Verification Scripts
Localized Resources
• Detect a problem• Get input from user• Provide progress• Write to the report
Identify configuration issues Develop troubleshooting PowerShell scripts Troubleshooting toolkit
Graphical authoring environment Links to Graphical PowerShell editor Signs each pack with a certificate Packages the Troubleshooting
Pack for deployment
Authoring Troubleshooting Packs
Windows will Ship critical packs inbox Target additional packs using Windows Online
Troubleshooting Service You should
Ship troubleshooting packs with your client software
Post troubleshooting packs online Link to packs from your help documentation
Deploying Troubleshooting Packs
Troubleshooting Packs offer multiple deployment options.
Windows Instrumentation and Troubleshooting Platforms provide Centralized, standard, structured platforms to
improve manageability Consistent ways to debug and diagnose
software problems Detection and resolution of
configuration problems
Solving Software Problems
Review and revise your existing debugging techniques
Add or upgrade existing debug messages with the appropriate Windows Event or Performance Counter technologies
Review “An Overview of Windows Troubleshooting” whitepaper
Develop and deploy an appropriate troubleshooting pack with your application
Call To Action
Additional software quality sessions on video Driving for software quality through
customer feedback Developing compatible applications
for Windows Hands On Analysis with Windows
Performance Toolkit Best practices for signing and verifying code
on Windows 7 Meet us at the Windows
Fundamentals booth!
Related Content
Evals & Recordings
Please fill
out your
evaluation for
this session at:
This session will be available as a recording at:
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.