Techniques for tracing the real-time operation of software for the
purposes of testing, debugging, or performance analysis are disclosed.
Diagnostic instrumentation for generating records containing details of
software operation is incorporated in the software by inserting calls to
diverse macros or inline functions. Each macro takes an argument
specifying both a subsystem and a category of instrumentation within the
subsystem. Based on the specified subsystem and category, the
instrumentation can be included or excluded from the compiled object code
and, if included, can be dynamically enabled at run-time. Disabled
instrumentation does not result in a function call, but only a single,
inline "if," thereby reducing overhead. One macro accepts both software
parameters and a custom format specifier describing how the parameters
should be displayed. However, the parameters are not formatted during
logging, nor is the format specifier included in the record. Instead, the
formatting is performed when displayed.