title | description | ms.date |
---|---|---|
How do I Redefine an Fprintf Function as a Tracing Call |
How do I redefine an fprintf function as a tracing call |
04/20/2017 |
An fprintf function call, which is eventually converted to an sprintf function call, is a very resource-intensive call that can degrade performance perceptibly, especially when it is used repeatedly.
Redefining an fprintf function as a tracing call is much more efficient, because the trace messages are stored in binary format and formatting is postponed until you display the trace log.
To redefine a printing function such as fprintf as a tracing call, the resulting call must do two things:
-
Assign a default level for the tracing function, such as error, warning, or noise.
-
Ignore the handle.
The following example shows a function description that does both:
-func:fprintf{LEVEL=Noise}(NULL,MSG,...)
You can define this function description in a local configuration file, such as localwpp.ini, or use the -func parameter of RUN_WPP (the macro that invokes the WPP preprocessor) to define the function description.
For a complete list of the optional parameters for RUN_WPP, see WPP Preprocessor.