Using Xperfinfo and Xperf
Using Xperfinfo and Xperf
Cristian Levcovici
Windows Client Performance
j
ntroduction
Overview of xperf
Overview of xperfinfo
Extensibility
References
What is xperfinfo/xperf?
What is ETW?
ntroduction
Capture--anywhere process-
Capture process-anywhere
ntroduction
0
High level control and decoding of a large number
of ETW events built into the NT kernel
ƛ process lifetime ƛ disk /O
ƛ thread lifetime ƛ file /O
ƛ image lifetime ƛ registry
ƛ sample profile ƛ hardfault
ƛ context switch ƛ pagefault
ƛ DPC (Deferred Procedure Call) ƛ virtual allocation
ƛ SR (nterrupt Service Routine) ƛ heap
ƛ driver delay ƛ TCP/UDP
R
R
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-
self-instrumentation
R
R
Event Tracing for Windows
ƛ Fast, reliable, and versatile set of features for logging
events raised by user-
user-mode applications and kernel-
kernel-mode
drivers
R R
R
Provider
ƛ Provides event traces. Can be user-
user-mode app,
kernel--mode driver, or the kernel itself
kernel
ƛ Providers are instrumented with ETW APs 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
j
Overview of xperf
Selection
Overview of xperf
Context-Menu Summary Table
Overview of xperf
CP||
Selected
% Total
Time
Time % of Time excluding DPC and SR
nterval
Close
Summary
Table
Sidebar
Overview of xperf
Sidebar
Overview of xperf
Sidebar Scrollbar
Overview of xperf
Scrollbar
Overview of xperf
Scrollbar
Overview of xperf
Scrollbar
Selection
Overview of xperf
j
Expand
Overview of xperf
j
Expand
Overview of xperf
j Close
Summary
Table
Disk Service Time /O Size /O Priority
Expand
ndividual /Os
Overview of xperf
Overview of xperf
Selection
Overview of xperf
Change Disk
Overview of xperf
Change Disk
Overview of xperf
Selection
Overview of xperf
Disk Service Time Disk Queue Depth File Path
ndividual /Os
in time order
by completion
time
Overview of xperf
Context-Menu
Overview of xperf
Context-Menu Summary Table
Overview of xperf
CP|
Expand
Overview of xperf
CP|
Expand
Overview of xperf
Overview of xperf
Overview of xperf
Load Symbols
Overview of xperf
Context-Menu
Overview of xperf
Context-Menu Summary Table
Overview of xperf
CP|
Expand
Overview of xperf
CP|
Expand
Overview of xperf
CP|
Expand
Overview of xperf
Run scenario
C:\analysis> MyTestApp.exe
ëüü You can retrieve all known kernel flags and groups with
ë
C:\analysis> xperfinfo ±help providers
Overview of xperfinfo
Run scenario
C:\analysis> MyTestApp.exe
Run scenario
C:\analysis> MyTestApp.exe
x ë
C:\analysis> 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/13:16:05:14.5000000
Native Pointer Size : 4 (32bit)
Start time : 2005/10/14:04:03:14.3388906
End time : 2005/10/14:04:03:23.8073376 (+ 0:00:00:09.4684470)
Total # Lost Buffers : 0
Total # Lost Events : 0
Number of Traces : 1
x
C:\analysis> xperfinfo -i trace.etl -a tracestats -detail
{01853a65-418f-4f36-aefc-dc0f1d2fd235}
58 39376 SysConfig
...
Overview of xperfinfo
Action invocation:
Action help:
üü C:\analysis> xperfinfo ±help tracestats
Overview of xperfinfo
C:\analysis> xperfinfo -i trace.etl ±o trace.txt
[1/2] 100.0%
[2/2] 100.0%
C:\analysis> notepad trace.txt
Overview of xperfinfo
C:\analysis> set _NT_SYMBOL_PATH=srv*C:\symbols*\\symbols\symbols
C:\analysis> xperfinfo -i trace.etl ±o trace_symbols.txt -symbols
[1/2] 100.0%
[2/2] 100.0%
C:\analysis> notepad trace_symbols.txt
ëü C:\analysis> xperfinfo ±help symbols
Overview of xperfinfo
jë
README.TXT
ƛ \\ntperformance\
ntperformance\tools\
tools\xperf\
xperf\x86\
x86\latest\
latest\README.TXT
C