windows – 使用WPP跟踪多个ETW提供程序

前端之家收集整理的这篇文章主要介绍了windows – 使用WPP跟踪多个ETW提供程序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试通过WPP实现使用“ Windows事件跟踪”.根据 Getting Started with Software Tracing in Windows Drivers中的文档,可以从单个驱动程序向多个提供程序发出跟踪,但我没有看到这样做的示例:

A driver can specify more than one control GUID. Each control GUID identifies a unique provider. For example,if a driver defines two control GUIDs,one for a shared library and one for the driver,the library and the driver can be enabled as two different providers. Tracing can be enabled for either the library or the driver,or both.

我试图创建两个头文件,每个文件都使用不同的guid WPP_CONTROL_GUIDS.然后我包含来自c / cpp文件的不同头文件,我希望将这些文件发布到不同的提供者.但似乎主文件中的定义覆盖了这个分隔,并且所有跟踪都到达了它使用的提供程序……

有什么建议吗?有样品吗?谢谢!!

解决方法

我现在避免像瘟疫那样的WPP跟踪,但跟踪模板提供了如何执行此操作的示例.您应该在某个TMH文件中的某处看到此注释:

// template C:\WinDDK\7600.16385.1\bin\wppconfig\rev1\control.tpl
//
//     Defines a set of macro that expand control model specified
//     with WPP_CONTROL_GUIDS (example shown below)
//     into an enum of trace levels and required structures that
//     contain the mask of levels,logger handle and some information
//     required for registration.
//

///////////////////////////////////////////////////////////////////////////////////
//
// #define WPP_CONTROL_GUIDS \
//     WPP_DEFINE_CONTROL_GUID(Regular,(81b20fea,73a8,4b62,95bc,354477c97a6f),\
//       WPP_DEFINE_BIT(Error)      \
//       WPP_DEFINE_BIT(Unusual)    \
//       WPP_DEFINE_BIT(Noise)      \
//    )        \
//    WPP_DEFINE_CONTROL_GUID(HiFreq,(91b20fea,\
//       WPP_DEFINE_BIT(Entry)      \
//       WPP_DEFINE_BIT(Exit)       \
//       WPP_DEFINE_BIT(ApiCalls)   \
//       WPP_DEFINE_BIT(RandomJunk) \
//       WPP_DEFINE_BIT(LovePoem)   \
//    )

因此,您应该在同一个WPP_CONTROL_GUIDS宏中定义两个GUID.

猜你在找的Windows相关文章