从多个进程和同一进程内注册相同的 ETW TraceLogging 提供程序 GUID

Posted

技术标签:

【中文标题】从多个进程和同一进程内注册相同的 ETW TraceLogging 提供程序 GUID【英文标题】:Registering the same ETW TraceLogging Provider GUID from multiple processes and within the same process 【发布时间】:2019-07-01 06:10:37 【问题描述】:

来自TraceLogging documentation:

如果您尝试注册已经注册的提供者,注册将失败。

目前尚不清楚“提供者”是指 GUID 还是 hProvider 表示的对象。任何人都可以确认注册相同的 GUID 是否是有效操作 1. 多进程 2.同一进程中的多个模块(DLL/EXE) 3.在同一个模块内?

我已经尝试过 1 和 2 并且它们一直在工作 - 我可以从两个进程/模块中获取事件。只需确保这是预期的行为。

【问题讨论】:

我也对它感兴趣。 【参考方案1】:

我会说它指的是 handle 对象本身。

The scope of a TraceLogging provider handle is strictly limited to the module (the DLL or EXE) in which it is defined. The provider handle from one module must not be shared with code in other modules. In other words, for any handle g_hProvider, all instances of TraceLoggingWrite(g_hProvider, ...) must reside in the same EXE or DLL as the TRACELOGGING_DEFINE_PROVIDER(g_hProvider, ...) definition. If this rule is not followed, the behavior of TraceLoggingWrite is unpredictable, especially regarding the way it handles event IDs (e.g. event ID collisions are likely).

TraceLoggingProvider.h中的评论

【讨论】:

以上是关于从多个进程和同一进程内注册相同的 ETW TraceLogging 提供程序 GUID的主要内容,如果未能解决你的问题,请参考以下文章

操作系统01_进程与线程

从输入URL到页面渲染完成

linux中的进程和线程

操作系统概述

操作系统的特征

11.1 线程简介