Instrumenting Your Code for Better Performance using ETW
Have you ever refactored a routine and needed to measure the performance difference between the original and new code? Ever have a customer tell you your application is slow? As you add new features, do you know how performance changes in your latest deployment? Do you know how performance changes when server hardware is upgraded? Ever experienced performance issues as the number of users increase? How quickly can you identify bottlenecks in your application? How do you determine the relationship between memory and CPU utilization, network traffic, or database access and your application’s operations?
Before you can effectively respond to performance problems, you need to have baseline measurements. You need to be proactive and build instrumentation into your application as you develop it and acquire performance data during development and testing.
The Event Tracing for Windows (ETW) subsystem has been built into Windows since Windows 2000. ETW provides a low overhead mechanism to capture data from various event sources built into the operating system as well as from your application.
Prior to .NET 4.5, interfacing to ETW was a pain for .NET developers. With the introduction of the EventSource class in .NET 4.5, instrumenting your application using ETW has become as easy as falling off a log.
This presentation gives an overview of ETW and shows you various techniques to instrument your application. The presentation will demonstrate use of Aspect Oriented Programming (AOP), using WCF custom behaviors to capture data inside the WCF call stack, using a Pub/Sub model via NServiceBus to consolidate instrumentation, and demonstrate the upcoming Semantic Logging Application Block (SLAB).