Top Banner
Event Tracing for Windows (ETW) Uwe Hartmann 27.05.2013 1
19

Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Aug 20, 2018

Download

Documents

trinhhanh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Event Tracing for Windows (ETW)Uwe Hartmann

27.05.2013 1

Page 2: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

ETW Classification/General

• ETW = tracing facility

• efficient, general purpose, holistic performance analysis

• kernel-level

• Purpose: Debugging, performance profiling, monitoring/logging

• Enable/Disable tracing: dynamically, (without application restart)

• Live production system analysis

• Originally developed for windows development performance analysis

27.05.2013 2

Page 3: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

ETW Architecture Overview

27.05.2013 3Source:http://msdn.microsoft.com/en-us/magazine/cc163437.aspx

Page 4: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

ETW Architecture Deep Dive

27.05.2013 4

Page 5: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Controller

• Any Process

• Functions• Start/stop Session• Configure Session

• Size/type/location of log file/process for real-time delivery

• Enable providers• Manage size of buffer pool• Resolution of time stamp• Verbosity, filtering• Update Session

• Obtain execution statistics of the Session• Number of events lost

27.05.2013 5

Page 6: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Session

• Record events from (multiple) providers. • Managing and flushing the buffers• Buffers per processor, in nonpaged pool kernel memory• Not statically tied to providers• Log to

• Disk• Memory• Real time delivery• Ring buffer …

• NT Kernel Logger Session• The NT Kernel Logger event tracing session records predefined system events

generated by the operating system, for example, disk IO or page fault events.

27.05.2013 6

Page 7: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Provider

• User-mode or kernel-mode

• for capturing log data

27.05.2013 7

Page 8: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Consumer

• Uses data collected by the sessions

• Can register callback for real-time consumption

• Reads recorded data from binary file

27.05.2013 8

Page 9: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Special Purpose Sessions

• Global Logger Session• The Global Logger event tracing session records events that occur early in the

operating system boot process, such as those generated by device drivers.

• Private Session• user-mode event tracing session that runs in the same process as its event

trace provider

27.05.2013 9

Page 10: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

ETW Library

• Contained in Ntdll.dll

• Parts in ntoskrnl.dll

• ETW kernel-mode API• For drivers

• Mirror ETW Library principles, slightly different functions

• Completly Contained in ntoskrnl.dll

27.05.2013 10

Page 11: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Control Flow Kernel logging

Controller

• Enables providers

• Enables and configures session (Ntdll)

ETW (Ntdll)

• Calls NtTracwControl system call

ETW

(Kernel)

• Submits configuration to NT Kernel Logger Session

• If file logging, create writer system process

NT Kernel Logger Session

• Receives eventrecords to buffer

• File logging thread periodically writes out disk

27.05.2013 11

Page 12: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Consumer Controller Provider

XPerfView Xperf Windows kernel

Windows Performance Analyzer (WPA)

Windows Performance Recorder (WPR)

Ressources (CPU, Memory, Disk, File IO, Networking, Power, GPU …)

PerfMon Process monitor, exlporer .Net, XAML

Resource Monitor Resource Monitor SQL Server, ASP.net

… Microsoft Message Analyzer (Network Monitor)

Audio, Video

PerfMon …

27.05.2013 12

Page 13: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

ETW vs. DTrace

13

Dtrace

• Application predefines places to log

• Probes

• D Language

• Selection and transformation at recording Time

• Can be dynamicallyenabled/disabled

• Low Overhead, usable forproduction enviromment, lockless

ETW

• Application predefines informationand places to log

• Events

• Static typed

• Selection and transformation at analysis Time

• Can be dynamicallyenabled/disabled

• Low Overhead, usable forproduction enviromment, lockless

Page 14: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Dropped Events

• Events to large

• Real-time consumer not fast enough

• When logging to file disk too slow

27.05.2013 14

Page 15: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Windows Performance Toolkit (WPR + WPR)

• Used within Microsoft to build Windows, Office etc.

Windows Performance Recorder ETW Controller

Windows Performance AnalyzerETW Consumer

27.05.2013 15

Page 16: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Powerpoint Demo

27.05.2013 16

Page 17: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Purpose

• Visual Studio Profiling Tools• During development in particular for CPU and memory issues

• EWT• For everything else in windows

• Pick your tool or write your own

• In particular for production environment profiling and debugging, operating system profiling

• Advanced issues

27.05.2013 17

Page 18: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

Scenarios

• Debugging• Monitoring• Diagnosis• Capacity Planning

• Scanning• Delta Analysis• Statistical Analysis• State Machine and Resource Tracking• End-To-End Tracing

27.05.2013 18

Page 19: Event Tracing for Windows (ETW) - Welcome! - … · ETW vs. DTrace 13 Dtrace •Application predefines places to log •Probes •D Language •Selection and transformation at recording

End

1927.05.2013