21 September, 2012

Identifiers in ETW and Profiling API

CLR v4.0/v4.5 can generate ETW CLR events. There is special section and for operations relating to loading and unloading application domains, assemblies, and modules. This article contains a lot of identifiers such as AppDomainID, AssemblyID, ModuleID. Descriptions of them sometimes contains word "unique". This word is parasite. All identifiers are unique, but unique only during object life. It means that it possible to have two and more different objects with the same identifier, but in different moments of an application life.

On the other side, identifiers look like as profiling API identifiers. In fact they are the same!

However, ModuleIDs aren't exactly the same! They are a bit different in ETW events! CLR method clr!ETW::LoaderLog::SendModuleEvent() makes a little fix for module identifiers before publish them in ETW:

  • +3F8h in CLR v4.0 x86 (build v4.0.40319.269)
  • +5C8h in CLR v4.0 x64 (build v4.0.40319.269)
  • +350h in CLR v4.5 x86 (build v4.0.40319.17929)
  • +5A0h in CLR v4.5 x64 (build v4.0.40319.17929)

P.S. As I understand the fix can be changed by any CLR update in any time. So, it isn't a constant.

P.P.S. There's the information that it'll be fixed in next version CLR, but not in v4.0/v4.5.

No comments: