Skip to content

Commit

Permalink
update CreateFromEventPipeEventSource to support providing preloaded…
Browse files Browse the repository at this point in the history
… rundown source
  • Loading branch information
vaind committed May 30, 2023
1 parent 576bba9 commit 0aeb827
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/TraceEvent/TraceLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,20 @@ public static TraceLogEventSource CreateFromEventPipeSession(EventPipeSession se
/// the .Log Property) which lets you get at aggregated information (Processes, threads, images loaded, and perhaps most
/// importantly TraceEvent.CallStack() will work. Thus you can get real time stacks from events).
/// </summary>
public static TraceLogEventSource CreateFromEventPipeEventSource(EventPipeEventSource source)
/// <param name="rundownSource">
/// If given, the rundownSource is used to initialize module and method information.
/// This only makes sense in realtime sessions when you need to resolve function names.
/// </param>
public static TraceLogEventSource CreateFromEventPipeEventSource(EventPipeEventSource source, EventPipeSession rundownSource = null)
{
var traceLog = new TraceLog(source);
traceLog.rawEventSourceToConvert.AllEvents += traceLog.onAllEventPipeEventsRealTime;

if (rundownSource != null)
{
traceLog.ProcessInitialRundown(rundownSource);
}

return traceLog.realTimeSource;
}

Expand All @@ -248,6 +258,12 @@ private void ProcessInitialRundown(EventPipeSession session)
}
}

private void ProcessInitialRundown(EventPipeEventSource source)
{
SetupInitialRundownCallbacks(source);
source.Process();
}

/// <summary>
/// Attaches callbacks to initialize modules and methods based on the rundown events.
/// Unlike SetupCallbacks(), these callbacks are attached before any events are processed so
Expand Down

0 comments on commit 0aeb827

Please sign in to comment.