Skip to content

Commit

Permalink
Add parser support for compressed frames
Browse files Browse the repository at this point in the history
  • Loading branch information
xoofx committed Dec 16, 2024
1 parent 0dbd59a commit 7100bf4
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/Ultra.Core/Parser/UltraSamplerParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public sealed class UltraNativeCallstackTraceEvent : TraceEvent
private static readonly string[] _payloadNames =
[
nameof(FrameThreadId),
nameof(ThreadState),
nameof(ThreadCpuUsage),
nameof(PreviousFrameCount),
nameof(FrameSize),
nameof(FrameAddresses)
];
Expand All @@ -81,9 +84,15 @@ internal UltraNativeCallstackTraceEvent(Action<UltraNativeCallstackTraceEvent>?

public ulong FrameThreadId => (ulong)GetInt64At(0);

public int FrameSize => GetInt32At(8);
public UltraSamplerThreadState ThreadState => (UltraSamplerThreadState)GetInt32At(8);

public unsafe ReadOnlySpan<ulong> FrameAddresses => new((byte*)DataStart + 12, FrameSize / sizeof(ulong));
public double ThreadCpuUsage => GetInt32At(12) / 1000.0;

public int PreviousFrameCount => GetInt32At(16);

public int FrameSize => GetInt32At(20);

public unsafe ReadOnlySpan<ulong> FrameAddresses => new((byte*)DataStart + 24, FrameSize / sizeof(ulong));

/// <inheritdoc />

Expand All @@ -94,8 +103,14 @@ public override object PayloadValue(int index)
case 0:
return FrameThreadId;
case 1:
return FrameSize;
return (int)ThreadState;
case 2:
return GetInt32At(12);
case 3:
return PreviousFrameCount;
case 4:
return FrameSize;
case 5:
return FrameAddresses.ToArray();
default:
throw new ArgumentOutOfRangeException(nameof(index));
Expand Down

0 comments on commit 7100bf4

Please sign in to comment.