mirror of
https://github.com/nefarius/WDF-Utils.git
synced 2024-09-07 22:42:32 +02:00
Added example WPP tracing header file
This commit is contained in:
parent
cf5303e27c
commit
b062fead9b
73
Templates/trace.h
Normal file
73
Templates/trace.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* !!! DO NOT REUSE THE EXAMPLE GUID HERE, CREATE YOUR OWN !!!
|
||||
*/
|
||||
|
||||
//
|
||||
// Define the tracing flags.
|
||||
//
|
||||
// Tracing GUID - 15ec41aa-5642-4960-86fa-451b6add5e42
|
||||
//
|
||||
|
||||
#define WPP_CONTROL_GUIDS \
|
||||
WPP_DEFINE_CONTROL_GUID( \
|
||||
myDriverTraceGuid, (15ec41aa,5642,4960,86fa,451b6add5e42), \
|
||||
\
|
||||
WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
|
||||
WPP_DEFINE_BIT(DMF_TRACE) \
|
||||
WPP_DEFINE_BIT(TRACE_DRIVER) \
|
||||
WPP_DEFINE_BIT(TRACE_DEVICE) \
|
||||
WPP_DEFINE_BIT(TRACE_QUEUE) \
|
||||
)
|
||||
|
||||
#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
|
||||
WPP_LEVEL_LOGGER(flag)
|
||||
|
||||
#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
|
||||
(WPP_LEVEL_ENABLED(flag) && \
|
||||
WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
|
||||
|
||||
#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \
|
||||
WPP_LEVEL_LOGGER(flags)
|
||||
|
||||
#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
|
||||
(WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
|
||||
|
||||
//
|
||||
// WPP orders static parameters before dynamic parameters. To support the Trace function
|
||||
// defined below which sets FLAGS=MYDRIVER_ALL_INFO, a custom macro must be defined to
|
||||
// reorder the arguments to what the .tpl configuration file expects.
|
||||
//
|
||||
#define WPP_RECORDER_FLAGS_LEVEL_ARGS(flags, lvl) WPP_RECORDER_LEVEL_FLAGS_ARGS(lvl, flags)
|
||||
#define WPP_RECORDER_FLAGS_LEVEL_FILTER(flags, lvl) WPP_RECORDER_LEVEL_FLAGS_FILTER(lvl, flags)
|
||||
|
||||
/* Useful macros to simplify tracing calls */
|
||||
|
||||
//
|
||||
// This comment block is scanned by the trace preprocessor to define our
|
||||
// Trace function.
|
||||
//
|
||||
// USEPREFIX and USESUFFIX strip all trailing whitespace, so we need to surround
|
||||
// FuncExit messages with brackets
|
||||
//
|
||||
// begin_wpp config
|
||||
// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
|
||||
// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
|
||||
// FUNC FuncEntry{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS);
|
||||
// FUNC FuncEntryArguments{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, MSG, ...);
|
||||
// FUNC FuncExit{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, MSG, ...);
|
||||
// FUNC FuncExitVoid{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS);
|
||||
// FUNC TraceError{LEVEL=TRACE_LEVEL_ERROR}(FLAGS, MSG, ...);
|
||||
// FUNC TraceInformation{LEVEL=TRACE_LEVEL_INFORMATION}(FLAGS, MSG, ...);
|
||||
// FUNC TraceVerbose{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, MSG, ...);
|
||||
// FUNC FuncExitNoReturn{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS);
|
||||
// USEPREFIX(FuncEntry, "%!STDPREFIX! [%!FUNC!] --> Entry");
|
||||
// USEPREFIX(FuncEntryArguments, "%!STDPREFIX! [%!FUNC!] --> Entry <");
|
||||
// USEPREFIX(FuncExit, "%!STDPREFIX! [%!FUNC!] <-- Exit <");
|
||||
// USESUFFIX(FuncExit, ">");
|
||||
// USEPREFIX(FuncExitVoid, "%!STDPREFIX! [%!FUNC!] <-- Exit");
|
||||
// USEPREFIX(TraceError, "%!STDPREFIX! [%!FUNC!] ERROR:");
|
||||
// USEPREFIX(TraceEvents, "%!STDPREFIX! [%!FUNC!] ");
|
||||
// USEPREFIX(TraceInformation, "%!STDPREFIX! [%!FUNC!] ");
|
||||
// USEPREFIX(TraceVerbose, "%!STDPREFIX! [%!FUNC!] ");
|
||||
// USEPREFIX(FuncExitNoReturn, "%!STDPREFIX! [%!FUNC!] <--");
|
||||
// end_wpp
|
Loading…
Reference in New Issue
Block a user