我能够通过EventSource类的静态方法GenerateManifest生成清单,这将为EventSource类中的myevents提供清单,但不包含有关通道的详细信息。
我的问题是,如何在生成perfmon跟踪会话的清单文件后添加特定于通道的信息?我还想使用Perfmon的跟踪会话来启用提供程序,而不是perfview。
非常感谢您提供任何意见。
Registering your EventSource
When you install the EventSource NuGet package, the build step previously mentioned generates the following files for each EventSource in your application:
<AssemblyName>.<EventSourceTypeName>.etwManifest.man <AssemblyName>.<EventSourceTypeName>.etwManifest.dll.
These files need to be registered with the operating system to enable channel support. To do this you run the following command after the files are in their final deployed location:
wevtutil.exe im <EtwManifestManFile> /rf:"<EtwManifestDllFile>" /mf:"<EtwManifestDllFile>"
Once this registration command is executed, all subsequent calls to MinimalEventSource.Log.Load(), from any process on that machine, will automatically result in events in the Windows Event log.
注册成功后,您应该在读取已安装提供程序的所有工具中看到它。
即使您修改清单,EventSource实现也会防止您指定通道。在将事件写入ETW时,您传递一个描述符块,在其中指定通道ID。不幸的是,EventSource没有提供通过属性或其他方式设置此项的方法,并且始终将其设置为零,这意味着不使用任何通道。
EventSource的行为与普通的ETW提供程序有些不同,因为它不通过win32资源公开其清单,而是发送一个“已知”的ETW事件,其中清单作为其有效负载。这就是为什么perfmon是唯一能够识别来自.NET 4.5 EventSource发送的事件的ETW启用工具。
*您始终可以使用perfmon或类似的工具接收事件,但它们无法解码有效负载,例如传递给WriteEvent的参数。
编辑:请参见类似问题的答案
祝好 Lars