Title: Using xperfinfoxperf
1Usingxperfinfo/xperf
- Cristian Levcovici
- Windows Client Performance
2Outline
- Introduction
- Overview of xperf
- Overview of xperfinfo
- Extensibility
- References
3Introduction
- What is xperfinfo/xperf?
- What is ETW?
4xperfinfo/xperf
Introduction
- Extensible performance analysis toolset
- Based on ETW instrumentation
- Performs high-level decoding
- Cross-platform (XPSP1, W2K3, LH)
- Cross-architecture (x86, x64, ia64)
- Capture-anywhere process-anywhere
5Main strength
Introduction
- High level control and decoding of a large number
of ETW events built into the NT kernel
- process lifetime
- thread lifetime
- image lifetime
- sample profile
- context switch
- DPC (Deferred Procedure Call)
- ISR (Interrupt Service Routine)
- driver delay
- disk I/O
- file I/O
- registry
- hardfault
- pagefault
- virtual allocation
- heap
- TCP/UDP
and many others
Stackwalking support (LH only)
6What is ETW?
Introduction
- Event Tracing for Windows
- High performance, low overhead, highly scalable
tracing facility provided by the Windows OS
(Win2K) - Extensively used by the NT kernel for
self-instrumentation - On a typical server setup, TraceEvent() takes
1,500 to 2,000 cycles - lt2 CPU overhead for a sustained rate of 20,000
events/sec on a 2GHz processor - Uses an efficient buffering and logging mechanism
- Non-blocking and uses per-processor buffers that
are written to disk by a separate writer thread
7What is ETW? (contd.)
Introduction
- Event Tracing for Windows
- Fast, reliable, and versatile set of features for
logging events raised by user-mode applications
and kernel-mode drivers - Turn tracing on/off dynamically without requiring
reboots or application restarts - The disk log is a binary file
- Event format is encoded by GUID type version
- Trace must be post processed
- events must be correlated with context events and
domain specific knowledge for high-level decoding
8What is ETW used for?
Introduction
- Debug application bugs including hangs, crashes,
or unexpected behavior - Diagnose performance problems
- Track computing resource consumption at
application transaction level for capacity
planning
9ETW Architecture
Introduction
- Provider
- Provides event traces. Can be user-mode app,
kernel-mode driver, or the kernel itself - Providers are instrumented with ETW APIs to
register with the ETW framework to send event
traces from various points in the code. - When enabled dynamically by the trace controller
application, the provider sends event traces to a
specific trace session designated by the
controller. - Controller
- Assists in starting, stopping or updating trace
sessions in the kernel as well as enabling or
disabling providers - Used to set trace session properties such as
sequential or circular file logging or direct
delivery to consumers - Consumer
- Application that reads trace files or listens to
active trace sessions and processes logged events - Not aware of the Providers
- Only receive event traces from the trace sessions
or log files - Event Trace Session infrastructure
- Brokers the event traces from the provider to
consumer and in the process adds valuable data to
each event such as TimeStamp, Thread, Process, CPU
10Overview of xperf
- Detailed interactive analysis of ETW traces
- Emphasis on kernel events
- Support for 3rd party events, primarily in
conjunction with kernel events
11Timeline
Overview of xperf
12Timeline
Overview of xperf
13Timeline
Overview of xperf
14CPU Usage Summary Table
Overview of xperf
15Timeline
Overview of xperf
16Timeline
Overview of xperf
17Timeline
Overview of xperf
18Timeline
Overview of xperf
19Timeline
Overview of xperf
20Timeline
Overview of xperf
21Timeline
Overview of xperf
22Disk I/O Summary Table
Overview of xperf
23Disk I/O Summary Table
Overview of xperf
24Disk I/O Summary Table
Overview of xperf
25Timeline
Overview of xperf
26Timeline
Overview of xperf
27Timeline
Overview of xperf
28Disk Detail
Overview of xperf
29Disk Detail
Overview of xperf
30Disk Detail
Overview of xperf
31Disk Detail Summary Table
Overview of xperf
32Timeline
Overview of xperf
33Timeline
Overview of xperf
34Timeline
Overview of xperf
35CPU Summary Table
Overview of xperf
36CPU Summary Table
Overview of xperf
37Timeline
Overview of xperf
38Timeline
Overview of xperf
39Timeline
Overview of xperf
40Timeline
Overview of xperf
41Timeline
Overview of xperf
42CPU Summary Table Symbol Decoding Enabled
Overview of xperf
43CPU Summary Table Symbol Decoding Enabled
Overview of xperf
44CPU Summary Table Symbol Decoding Enabled
Overview of xperf
45Available Graphs
Overview of xperf
- xperf provides many graphs and summary tables
- Sample Profile
- CPU Availability
- CPU Scheduling
- Disk Counts
- Disk Utilization
- Disk Detail
- Process Lifetime
- DPC (Deferred Procedure Call)
- ISR (Interrupt Service Routine)
- Registry counts
- Driver Delay
- Hardfault
- Pagefault
- Services
- Plug n Play
- Marks
- Generic
46Overview of xperfinfo
- High level control and decoding
- Dumping of ETW traces
- Command line analysis of ETW traces
- emphasis on kernel events
- support for 3rd party events
47Taking a kernel trace
Overview of xperfinfo
- Start kernel trace
- Run scenario
- Stop and merge kernel trace
C\analysisgt xperfinfo on basecswitch
C\analysisgt MyTestApp.exe
C\analysisgt xperfinfo d trace.etl Merged Etl
trace.etl
48Taking a user trace
Overview of xperfinfo
- Start user trace
- Run scenario
- Stop user trace
C\analysisgt xperfinfo start MySession on
KerberosMRxSmb f kerberos.etl
C\analysisgt MyTestApp.exe
C\analysisgt xperfinfo stop MySession
49Taking a kerneluser trace
Overview of xperfinfo
- Start kernel and user traces
- Run scenario
- Stop user trace
C\analysisgt xperfinfo on basecswitch C\analysi
sgt xperfinfo start MySession on KerberosMRxSmb
f kerberos.etl
C\analysisgt MyTestApp.exe
C\analysisgt xperfinfo stop MySession stop d
trace.etl Merged Etl trace.etl
50Retrieving Trace Header
Overview of xperfinfo
C\analysisgt xperfinfo -i trace.etl -a
tracestats Number of Processors 4 CPU Speed
2372 MHz OS Version
05.01.01.00 OS Build Number 2600 Clock
type PerfCounter Boot time
2005/10/13160514.5000000 Native Pointer Size
4 (32bit) Start time
2005/10/14040314.3388906 End time
2005/10/14040323.8073376 (
0000009.4684470) Total Lost Buffers
0 Total Lost Events 0 Number of Traces
1 Trace name trace.etl Log file mode
Relogged Pointer size 4
(32bit) Start time
2005/10/14040314.3388906 End time
2005/10/14040323.8073376 (
0000009.4684470) Lost Buffers 0
Lost Events 0
51Retrieving Trace Summary
Overview of xperfinfo
C\analysisgt xperfinfo -i trace.etl -a tracestats
-detail Classic EventGuid TotalCount
TotalSize Name
66838
1703946 ltAllgt 01853a65-418f-4f36-aefc-dc0f1d2f
d235 58
39376 SysConfig Type Level Version
Count TotalSize Name ---- -----
------- ---------- ---------------
--------------------------- 0x0a 0x00 0x0001
1 952 SysConfig CPUs
0x0b 0x00 0x0001 2 1224
SysConfig Physical Disks 0x0c 0x00 0x0001
4 448 SysConfig Logical
Disks 0x0d 0x00 0x0001 1
744 SysConfig Network Cards 0x0e 0x00
0x0001 2 5168 SysConfig
Video Adapters 0x0f 0x00 0x0001
47 30832 SysConfig Services 0x10
0x00 0x0001 1 8
SysConfig Power Management ...
52Retrieving Action Help
Overview of xperfinfo
C\analysisgt xperfinfo -i trace.etl -a tracestats
/? Action invocation xperfinfo -i
lttrace filegt ... -o ltoutputgt -a tracestats
... Action help tracestats
-timespan actual -detail -timespan
actual Show information about session and
traces. default Without
parameters, -timespan requires inspection of
trace headers only no pass
is performed through the traces in
the session. When
the parameter "actual" is specified, the actual
times of the first event and
the last event in the session
are added to the report. In this case, a pass
through the traces in the
session is required. -detail Show
detailed information about providers, ids,
tasks, opcodes, versions,
channels and levels of events in the
session along with provider and opcode
friendly names. Requires a
full pass through the traces in the session.
53Dumping a Trace
Overview of xperfinfo
C\analysisgt xperfinfo -i trace.etl o
trace.txt 1/2 100.0 2/2
100.0 C\analysisgt notepad trace.txt
54Dumping a Trace with Symbol Decoding
Overview of xperfinfo
C\analysisgt set _NT_SYMBOL_PATHsrvC\symbols\\
symbols\symbols C\analysisgt xperfinfo -i
trace.etl o trace_symbols.txt -symbols 1/2
100.0 2/2 100.0 C\analysisgt notepad
trace_symbols.txt
55Available Actions
Overview of xperfinfo
- xperfinfo provides many actions
- dumper
- tracestats
- sysconfig
- marks
- process
- perfctrs
- profile
- cswitch
- dpcisr
- registry
- diskio
- filename
- hardfault
- pagefault
- drvdelay
- reference_set
- boot
- suspend
- shutdown
and many others
56Online Help
Overview of xperfinfo
- Your best friend is the online help
C\analysisgt xperfinfo -help Usage
xperfinfo options ... xperfinfo -help
start for logger start options
xperfinfo -help providers for known
tracing flags xperfinfo -help stop
for logger stop options xperfinfo
-help merge for merge multiple trace
files xperfinfo -help processing
for trace processing options xperfinfo
-help symbols for symbol decoding
configuration xperfinfo -help query
for query options xperfinfo -help
mark for mark and mark-flush
xperfinfo -help format for time and
timespan formats on
the command line xperfinfo
-help advanced for advanced options
(things you
don't need to know -))
57Extensibility
- xperfinfo and xperf are built on top of an
extensible core, xperfcore, that supports 3rd
party binary addins providing custom - Event dumpers
- Infosources
- Event name databases
- Graphs summary tables
- Application drivers
- xperfinfo Actions
- For details, please see the Extending xperfcore
presentation
58References
- Homepage
- http//toolbox/sites/xperf
- Tools distribution point
- \\ntperformance\tools\xperf\x86\latest
- \\ntperformance\tools\xperf\amd64\latest
- \\ntperformance\tools\xperf\ia64\latest
- README.TXT
- \\ntperformance\tools\xperf\x86\latest\README.TXT
59Context Slides