Export (0) Print
Expand All

What is the performance cost of software tracing?

In general, the performance cost of software tracing is very small. The code is minimized, the buffers are managed efficiently, and the messages are written in binary format. Also, formatting trace messages, which is a big performance drain, is deferred until the user chooses to format and display the trace messages.

When you use WPP software tracing macros to add software tracing to a driver, there is almost no performance cost at all, unless the provider is enabled for a trace session.

The WPP macros amounts to three conditional checks within an If statement to the software tracing code. These checks prevent any trace messages from being generated unless the provider is enabled. The WPP macros generate code in the following form:


If (WPP_CHECK_INIT && WPP_LEVEL_FLAGS_ENABLED) {
    Call trace_message_routine
}

In this generated code, WPP_CHECK_INIT consists of one conditional check. WPP_LEVEL_FLAGS_ENABLED consists of one conditional check, if you have only one level or flag filter. Otherwise, WPP_LEVEL_FLAGS_ENABLED consists of two conditional checks.

For more information about how to exclude the WPP_CHECK_INIT check for better performance, see Can I optimize the conditional checks that the WPP macros produce before the tracing?.

Note  There might be some performance cost if you use methods other than WPP software tracing to implement software tracing in your driver. The effect depends on the implementation method.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft