Skip to content

Add MethodDetails CTF event mapping for LTTng trace support#2392

Open
benaadams wants to merge 4 commits intomicrosoft:mainfrom
benaadams:fix/add-methoddetails-ctf-mapping
Open

Add MethodDetails CTF event mapping for LTTng trace support#2392
benaadams wants to merge 4 commits intomicrosoft:mainfrom
benaadams:fix/add-methoddetails-ctf-mapping

Conversation

@benaadams
Copy link

Summary

  • Add missing DotNETRuntime:MethodDetails CTF event mapping to ClrTraceEventParser.EnumerateCtfEventMappings()

Problem

MethodDetailsTraceData (event ID 72, task Method, opcode 43) was added in .NET 5 but its CTF event mapping was never included in EnumerateCtfEventMappings(). This causes CtfTraceEventSource to skip DotNETRuntime:MethodDetails events when parsing perfcollect .trace.zip files.

dotnet-pgo checks for MethodDetailsTraceData events at Program.cs line 1115 and fails with:

Error: No MethodDetails
Was the trace collected with provider at least "Microsoft-Windows-DotNETRuntime:0x4000080018:5"?

The events ARE in the LTTng CTF trace (verified via CTF metadata inspection), but CtfTraceEventSource.TryGetEventMapping() returns false because the mapping is not registered, so the events are silently dropped.

This blocks SPGO (Sample-based Profile-Guided Optimization) on Linux when using perfcollect for trace collection.

Fix

One line: add the CTF mapping for DotNETRuntime:MethodDetails alongside the existing Method event mappings.

Test plan

  • Verified DotNETRuntime:MethodDetails events appear in perfcollect .trace.zip CTF metadata
  • Confirmed the event is defined in ClrEtwAll.man as event ID 72, task CLRMethod, opcode 43, keyword MethodDiagnosticKeyword
  • Confirmed the ETW/EventPipe path works (.nettrace files parse MethodDetailsTraceData correctly)
  • Verify dotnet-pgo create-mibc --spgo succeeds with a perfcollect trace after this fix

MethodDetailsTraceData (event ID 72, task Method, opcode 43) was added
in .NET 5 but its CTF event mapping was never added to
EnumerateCtfEventMappings(). This causes CtfTraceEventSource to skip
DotNETRuntime:MethodDetails events when parsing perfcollect .trace.zip
files, making dotnet-pgo fail with "No MethodDetails" when processing
LTTng traces for SPGO profile generation.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a missing LTTng/CTF event mapping so CtfTraceEventSource can translate DotNETRuntime:MethodDetails events into the corresponding CLR TraceEvent template when parsing perfcollect .trace.zip traces (enabling tooling like dotnet-pgo --spgo to find MethodDetailsTraceData).

Changes:

  • Register a DotNETRuntime:MethodDetails entry in ClrTraceEventParser.EnumerateCtfEventMappings().

@brianrob
Copy link
Member

@benaadams its been a while since I used dotnet-pgo, but if I recall correctly, it depends on the output coming from a nettrace file via dotnet-trace. Does it know how to use the output from lttng?

@benaadams
Copy link
Author

@benaadams its been a while since I used dotnet-pgo, but if I recall correctly, it depends on the output coming from a nettrace file via dotnet-trace. Does it know how to use the output from lttng?

We got it to; but had to jump though a bunch of hoops NethermindEth/nethermind#10877

@benaadams
Copy link
Author

Not sure using the data improved things; but need the data to improve the improvements 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants