microsoft / microsoft/perfview

CreateFromLinuxEventSources should produce SampledProfileTraceData from perf.data

Open
#2,393 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.7k
Forks
775
Avg merge
5d 11h
Merged PRs (30d)
9

Description

Summary

TraceLog.CreateFromLinuxEventSources converts perfcollect .trace.zip bundles (LTTng CLR events + perf CPU samples) to .etlx. The resulting .etlx contains the CLR events (MethodLoad, MethodDetails, etc.) but does not produce SampledProfileTraceData events from the perf CPU samples in perf.data.

This means consumers like dotnet-pgo create-mibc cannot build:

  • Call graph data (caller-callee edge weights from callstacks) needed for Pettis-Hansen method layout
  • Exclusive sample counts per method needed for ExclusiveWeight

Both are built by iterating SampledProfileTraceData events in Program.cs, which finds zero events from perfcollect traces.

Expected behavior

CreateFromLinuxEventSources should parse perf.data.txt (the text-format perf sample dump included in perfcollect's .trace.zip), resolve sample IPs against the CLR method load events to build managed symbol mappings, and emit SampledProfileTraceData events with resolved CallStack chains in the .etlx.

Current behavior

The perf CPU samples remain only in perf.data / perf.data.txt inside the zip. The .etlx contains only LTTng-originated CLR events. p.EventsInProcess.ByEventType<SampledProfileTraceData>() returns zero events.

Impact

dotnet-pgo create-mibc --method-layout pettishansen silently falls back to default ordering because CallWeights is empty. SPGO block attribution also misses the perf samples (only ETW-originated samples are attributed). See dotnet/runtime#125932 for the workaround we currently use (supplementary sample files).

Context

We're collecting PGO profiles for Nethermind using perfcollect on Linux. perfcollect captures ~9.6M CPU samples over 10 minutes alongside LTTng CLR events. The CLR events convert fine, but the CPU samples are lost in the .etlx conversion.

Related:

  • #2392 - Missing MethodDetails + MethodILToNativeMap_V1 CTF event mappings (fixes CLR event coverage)
  • dotnet/runtime#125932 - Feature request for supplementary sample file support in dotnet-pgo (workaround)
  • dotnet/runtime#125883 - SPGO fails with perfcollect traces (umbrella issue)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at TraceLog.CreateFromLinuxEventSources and inspect how the perf.data.txt contents in the trace.zip are handled, then read the SampledProfileTraceData processing in Program.cs. Trace how CLR method load events can provide managed symbol mappings for sample IPs and how events enter the .etlx. Done means ByEventType() returns resolved call-stack events for perfcollect traces so call weights and exclusive samples are available.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, linux
Domain
operating-systems, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.