(Xperf) : Introduction and Case Studies
(Xperf) : Introduction and Case Studies
Tate Calhoun
Platforms Global Escalation Services
Core Team
Agenda
What is Xperf?
Case Studies!
What is Xperf?
No application or driver is an island! Triaging system wide
performance issues via multiple trace streams introduces complexity.
Data must be aggregated, visualized, and understood to determine
root cause. Xperf is the long term investment Microsoft is making to
meet this diagnostic need.
Support Engineer Trends/Challenges:
1.) Memory.dmps are not getting smaller! (yet)
2.) Classic yet challenging application and system hangs, slow I/O, and
other system wide issues
3.) User observation to code behavior. Stackwalking!
4.) The visualization of complex ETW data
What is Xperf?
Visual Trace Analysis too Xperfview.exe Presents trace content in the form of
l
interactive graphs and summary tables.
On/Off Transition Trace
Capture tool
What is Xperf?
Capture and analysis model follows this general flow:
1.
2.
3.
4.
5.
ETW Overview
ETW, or Event Tracing for Windows, is a high performance kernel level tracing system that
made its first
appearance in Windows 2000 and has found widespread use since. Most operations
throughout the
operating system that are interesting to a performance analyst are already instrumented.
If you are interested in instrumenting your own applications, please see the
ETW documentation in MSDN
ETW Components
By default all events are disabled and the call to EventWrite() incurs
a very minimal overhead just a flag check. This allows retail
(shipping) code to be fully instrumented and enables tracing to be
enabled in shipping components at any time.
Even when enabled, event tracing has a very low run-time overhead,
even when large numbers of events are generated per second.
Once begun, an ETW logging session has a defined maximum
memory footprint. The disk footprint can be similarly limited. CPU
load is directly proportional to the event rate and scales very well.
Events from multiple providers, sessions and the kernel logger can
be merged seamlessly when collected simultaneously on the same
machine. This allows different kinds of events and settings to be
used on different logging sessions and then merged together after
the fact.
The Windows kernel and multiple components are already
extensively instrumented.
Let's take a view of the advanced stackwalk options and other Kernel
groups
(xperf -providers K)
Using the following is a good head start and we see that massive
customization is possible with stackwalk, etc.
(-d MergedETL Merge the ETL files of stopped logging sessions into
MergedETL; if no session is stopped explicitly, the "NT Kernel Logger"
stopped implicitly.)
Case
CaseStudy
Study11IE
IEHang
Hang
Case Study 2
Everything slow
Case Study 2
Everything slow
Case Study 2
Everything slow
What is cbscore.dll?
Component-Based Servicing
Component-Based Servicing (CBS) is part of the servicing stack. The
servicing stack is a set of files and resources that are required to service
a Windows image or operating system. The servicing stack is available
on all Windows Vista and Windows Server2008 installations, as well as
in the Windows Automated Installation Kit AIK (Windows AIK) and the
Windows OEM Preinstallation Kit (Windows OPK). CBS provides various
APIs (which are not publicly available) to its client installers to service
the operating system components. Client installers such as Windows
Update or Windows Installer work with CBS to enumerate, install,
update, and uninstall component packages on the destination operating
system. CBS interacts with the Component Servicing Infrastructure to
perform the necessary system changes.
For more information about CBS, see
http://go.microsoft.com/fwlink/?LinkId=91917.
Case Study 2
Everything slow
Summary: My machine is working hard scanning for updates, so
this seems "expected". However, it turns out there are actually
performance improvements exactly here in cbscore for Windows
7 and Vista SP1 to mitigate this issue!
I've got a DPC issue on this machine to track down further with the NIC :)
.15% DPC time as a constant is not good for performance!
The situation is that on two different platforms (physical vs. virtual) of stated same
build are displaying two different scheduling behaviors when viewing CPU time for
RunScottRun.exe. The exe doesn't stay on a processor
xperf -on
PROFILE+DISPATCHER+PROC_THREAD+LOADER+HARD_FAULTS+INTERRUPT+DPC+CS
WITCH -maxbuffers 1024
Here is what the "good" trace looks likeWe have our Process level view to clone the
selection.
Now the CPU Scheduling section. At a high level the problem reported is
that RunScottRun.exe is having trouble getting enough time on a single CPU
and we see context switches...
We can see this at a little bit lower level what is getting to run
If you are an Excel wiz :) the data can be exported for another view.
Here's the "good" trace summary/pivot
Good
Bad
Case Study 5 A
Random Stackwalk CreateProcess
Case Study 5 A
Random Stackwalk CreateProcess
Case Study 5 A
Random Stackwalk CreateProcess
Case Study 5 A
Random Stackwalk CreateProcess
Case Study 5 A
Random Stackwalk CreateProcess
Case Study 6 A
Random Stackwalk File
I/O
C:\xperf>xperf -on FileIO+FILENAME -stackwalk @file.txt
C:\xperf>xperf -d file.etl
Merged Etl: file.etl
C:\xperf>xperf file.etl
(shows stacks with 08 ver, in File IO Section)
Case Study 6 A
Random Stackwalk File
I/O
Case Study 7 A
Random Stackwalk
Registry
Case Study 7 A
Random Stackwalk
Registry
Case Study 8 A
Random Stackwalk
Power
Case Study 8 A
Random Stackwalk
Power
Top Questions
Can I usePerformance Analyzer on Windows XP or Windows
Server 2003?
Unfortunately, the answer is 'no'.While Windows XP and Windows
Server 2003 do support collection of ETL traces, these OSes do
notcontain instrumentation for most of the events needed by
Performance Analyzer (PA). You need Windows Vista or later OS to use
PA. An example of crucial instrumentation added in Vista is stack
walking. Performance analysis without stacks can be an extremely
daunting task that only a true expert with access to source code can
tackle.
With the Windows Vista release, Microsoft has really taken the OS to
next level in terms of system diagnosibility and a lot of the analysis
based on this instrumentation isn't feasible on Windows XP/Server
2003 ETL traces.
Top Questions
How do I find out the time span of the trace my customer
collected to correlate with other data? (-a tracestats)
Top Questions
How to enable stackwalking on x64 systems?
x64 ETW stackwalking is only supported on Windows Vista SP1,
Windows Server 2008, and above, and requires setting a certain
registry value (see below) to 1 and rebooting the machine ( so that
Windows kernel picks it up).
HKLM\System\CurrentControlSet\Control\Session Manager\Memory
Management
DisablePagingExecutive 1
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.
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 conditio
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.