Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ebd4670
wip: tracelog support for streaming an eventpipe source
vaind May 3, 2023
a9433c5
tracelog streaming fixes
vaind May 4, 2023
392c9fa
TraceLog support for initial rundown session
vaind May 19, 2023
6286887
fix stacktrace resolution on system frames
vaind May 23, 2023
f714892
feat: realtime streaming without queue
vaind May 30, 2023
382b8fe
update CreateFromEventPipeEventSource to support providing preloaded…
vaind May 30, 2023
4db0a45
review changes
vaind Jun 7, 2023
f890e71
review changes
vaind Aug 3, 2023
dbd71ff
test: TraceLog StreamingSession
vaind Aug 4, 2023
f1fcf81
fix CI
vaind Aug 9, 2023
3c65579
test: fix not disposing
vaind Aug 9, 2023
f5b49e4
update test dependencies
vaind Aug 9, 2023
53024ea
wip: find crashing test
vaind Aug 9, 2023
bed3d38
Merge branch 'main' into feat/eventpipe-tracelog-streaming
vaind Mar 20, 2024
68c1081
use net8 in testutils
vaind Mar 20, 2024
b2bb4e5
roll back debug assert change in tracelog
vaind Mar 25, 2024
36d2e2c
fix: clean up termporary data structures for realtime eventpipe source
vaind May 23, 2024
69a09db
Merge remote-tracking branch 'origin/main' into feat/eventpipe-tracel…
vaind May 23, 2024
fee63f9
chore: roll back some changes
vaind May 23, 2024
5153769
docs
vaind May 23, 2024
44c8fee
Merge branch 'main' into feat/eventpipe-tracelog-streaming
vaind Jun 6, 2024
2270d69
set NuspecProperties
vaind Jun 27, 2024
d161492
Merge branch 'main' into feat/eventpipe-tracelog-streaming
vaind Jun 27, 2024
e21e9c7
fix traceevent.csproj
vaind Jun 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review changes
  • Loading branch information
vaind committed Aug 9, 2023
commit 4db0a459409ac798babeeaab618d0d413d495cc6
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<AzureCoreVersion>1.24.0</AzureCoreVersion>
<AzureIdentityVersion>1.6.0</AzureIdentityVersion>
<MicroBuildCoreVersion>0.2.0</MicroBuildCoreVersion>
<MicrosoftDiagnosticsNETCoreClientVersion>0.2.421201</MicrosoftDiagnosticsNETCoreClientVersion>
<MicrosoftNETCorePortableCompatibilityVersion>1.0.1</MicrosoftNETCorePortableCompatibilityVersion>
<MicrosoftIdentityClientVersion>4.39.0</MicrosoftIdentityClientVersion>
<MicrosoftIdentityClientExtensionsMsalVersion>2.19.3</MicrosoftIdentityClientExtensionsMsalVersion>
Expand Down
4 changes: 0 additions & 4 deletions src/TraceEvent/TraceEvent.Tests/Parsing/EventPipeParsing.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
using FastSerialization;
using Microsoft.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tracing.AutomatedAnalysis;
using Microsoft.Diagnostics.Tracing.Etlx;
using Microsoft.Diagnostics.Tracing.EventPipe;
using Microsoft.Diagnostics.Tracing.Parsers;
using Microsoft.Diagnostics.Tracing.Parsers.Clr;
using Microsoft.Diagnostics.Tracing.Parsers.Kernel;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Tracing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Xunit;
using Xunit.Abstractions;
Expand Down
2 changes: 1 addition & 1 deletion src/TraceEvent/TraceEvent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.421201" />
<PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="$(MicrosoftNETCorePortableCompatibilityVersion)" />
<PackageReference Include="Microsoft.Diagnostics.NETCore.Client" Version="$(MicrosoftDiagnosticsNETCoreClientVersion)" />
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles" Version="$(MicrosoftDiagnosticsTracingTraceEventSupportFilesVersion)" />
<PackageReference Include="Microsoft.Win32.Registry" Version="$(MicrosoftWin32RegistryVersion)" />
<PackageReference Include="System.Diagnostics.Process" Version="$(SystemDiagnosticsProcessVersion)" />
Expand Down
38 changes: 6 additions & 32 deletions src/TraceEvent/TraceLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,34 +204,12 @@ public static TraceLogEventSource CreateFromTraceEventSession(TraceEventSession
/// </example>
public static TraceLogEventSource CreateFromEventPipeSession(EventPipeSession session, EventPipeSession rundownSession = null)
{
var tlEventSource = CreateFromEventPipeEventSource(new EventPipeEventSource(session.EventStream));
var traceLog = new TraceLog(new EventPipeEventSource(session.EventStream));
traceLog.rawEventSourceToConvert.AllEvents += traceLog.OnAllEventPipeEventsRealTime;

if (rundownSession != null)
{
tlEventSource.TraceLog.ProcessInitialRundown(rundownSession);
}

return tlEventSource;
}

/// <summary>
/// From a EventPipeEventSource, create a real time TraceLog Event Source. Like an EventPipeEventSource a TraceLogEventSource
/// will deliver events in real time. However an TraceLogEventSource has an underlying Tracelog (which you can access with
/// 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>
/// <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);
traceLog.ProcessInitialRundown(rundownSession);
}

return traceLog.realTimeSource;
Expand All @@ -258,12 +236,6 @@ 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 Expand Up @@ -334,7 +306,7 @@ private void SetupInitialRundownCallbacks(EventPipeEventSource rawEvents)
};
}

private unsafe void onAllEventPipeEventsRealTime(TraceEvent data)
private unsafe void OnAllEventPipeEventsRealTime(TraceEvent data)
{
TraceEventCounts countForEvent = Stats.GetEventCounts(data);
// Debug.Assert((int)data.EventIndex == eventCount);
Expand Down Expand Up @@ -1284,6 +1256,8 @@ private unsafe void SetupCallbacks(TraceEventDispatcher rawEvents)
jsJittedMethods = new List<MethodLoadUnloadJSTraceData>();
sourceFilesByID = new Dictionary<JavaScriptSourceKey, string>();

// We need to copy some information from the event source.
// An EventPipeEventSource won't have headers set until Process() is called, so we wait for the event trigger instead of copying right away.
if (rawEvents is EventPipeEventSource eventPipeEventSource)
{
eventPipeEventSource.HeadersDeserialized += delegate () { CopyHeadersFrom(rawEvents); };
Expand Down