Best Practices: Design for Diagnosability


Generating trace messages is a relatively easy way to record what your driver is doing. You can use the messages to track the path of an I/O request through your code, to figure out where bugs might be, and determine which routines are called frequently and which are rarely exercised. With this information, you can diagnose driver problems more easily.

To get the most out of tracing, observe these best practices:

  • Define trace flags that correspond to the types of information that you find most helpful during debugging.

    For example, as you incrementally implement and test your code, you could define a new flag for each new driver module.

  • Do not conditionally compile the trace statements in your driver.

    Leave them in the retail binaries-trace messages have a noticeable performance impact only if a trace consumer explicitly enables them.

  • Place a trace message in every error path.

    The message can provide detailed information to help diagnose the cause of the error with relatively little overhead.




Developing Drivers with the Microsoft Windows Driver Foundation
Developing Drivers with the Windows Driver Foundation (Pro Developer)
ISBN: 0735623740
EAN: 2147483647
Year: 2007
Pages: 224

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net