Skip to content

EventListener doesn't support expose embedded structures on Runtime events #12678

@noahfalk

Description

@noahfalk

Much thanks to @chrisnas who found this issue:

I see missing details with EventListeners/EventPipes. For example, I’m currently focusing on details that are supposed to come with GCPerHeapHistory_V3 event.
The embedded Values structure (https://github.com/dotnet/coreclr/blob/master/src/vm/ClrEtwAll.man#L1074) is not present in the payload received by the EventListener EventWrittenEventArgs:

ID = 204 Name = GCPerHeapHistory_V3  |  opcode=Info  ==>  System.Diagnostics.Tracing.EventWrittenEventArgs
    Name = "ClrInstanceID" Value = "8"  type=System.UInt16
    Name = "FreeListAllocated" Value = "0"  type=System.IntPtr
    Name = "FreeListRejected" Value = "0"  type=System.IntPtr
    Name = "EndOfSegAllocated" Value = "0"  type=System.IntPtr
    Name = "CondemnedAllocated" Value = "0"  type=System.IntPtr
    Name = "PinnedAllocated" Value = "0"  type=System.IntPtr
    Name = "PinnedAllocatedAdvance" Value = "0"  type=System.IntPtr
    Name = "RunningFreeListEfficiency" Value = "0"  type=System.UInt32
    Name = "CondemnReasons0" Value = "0"  type=System.UInt32
    Name = "CondemnReasons1" Value = "0"  type=System.UInt32
    Name = "CompactMechanisms" Value = "2147483650"  type=System.UInt32
    Name = "ExpandMechanisms" Value = "0"  type=System.UInt32
    Name = "HeapIndex" Value = "0"  type=System.UInt32
    Name = "ExtraGen0Commit" Value = "1456816"  type=System.IntPtr
    Name = "Count" Value = "4"  type=System.UInt32
    Task=65330

Maybe due to the <UserData> section of the definition (https://github.com/dotnet/coreclr/blob/master/src/vm/ClrEtwAll.man#L1086) in which there is no Value field. Note that I quickly looked at the other GC event templates and I did not find any other “missing” <UserData>. However, this is also happening for BulkType and GCBulk* other events: the definition is not present under the <UserData> node.

Investigating a bit I think at least the beginning of the missing support is here. This code parses the ETW manifest and produces C# code that will ultimately be the strongly-typed .NET event type that EventListener returns. This code skips the struct keyword entirely. Assuming we solved that aspect there is probably a second layer that occurs at runtime when EventListener needs to read the serialized data and populate it into the object model. Just having the fields declared doesn't necessarily mean that the translating code will write the appropriate values into them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions