Software tracing consists of embedding trace message statements in the driver code to record its behavior at various points. The messages can then be viewed in real time-while the driver is in operation-or retrieved later from log files. Tracing is typically used to determine the location and cause of bugs, but it can also be used for such tasks as profiling how frequently different routines are called.
Driver tracing is usually based on Event Tracing for Windows (ETW), a kernel-level facility that logs trace messages for both kernel-mode and user-mode processes. Because ETW can be somewhat complicated to use, most driver developers use WPP, which simplifies and enhances the process of instrumenting a driver for ETW tracing.
For this chapter, you need… | From… |
---|---|
| |
Tools and files | |
WDK tracing tools | %wdk%\tools\tracing\ |
KMDF template files | %wdk%\bin\wppconfig |
Sample drivers | |
Evntdrv | %wdk%\src\general\evntdrv |
Fx2_Driver | %wdk%\src\umdf\usb\fx_2driver |
Osrusbfx2 | %wdk%\src\kmdf\toaster |
WDK documentation | |
WPP Software Tracing | http://go.microsoft.com/fwlink/?LinkId=80090 |
Other | |
"Event Tracing" in the Platform SDK | http://go.microsoft.com/fwlink/?LinkId=84477 |