Table of Contents

Class LiveStreamProtocol

Namespace
Typhon.Profiler
Assembly
Typhon.Profiler.dll

Frame envelope for the Tracy-style profiler's live TCP stream. Each frame: [u8 type][u32 length][payload length bytes].

public static class LiveStreamProtocol
Inheritance
LiveStreamProtocol
Inherited Members

Remarks

The live stream carries the same content as the file format but delivered incrementally: Init sends the file header + metadata tables, Block sends one compressed record block per consumer drain, Shutdown signals end-of-session.

Fields

FrameHeaderSize

Size of the frame header in bytes: 1 (type) + 4 (length) = 5.

public const int FrameHeaderSize = 5

Field Value

int

MaxFrameBytes

The largest frame a receiver accepts, header included. A longer one is a malformed stream, not a big message: the length field is the only thing a reader has to trust before it allocates, so an unbounded value is an allocation an attacker — or a corrupted socket — chooses. It lives here rather than in one reader because it binds BOTH ends: a producer that writes a larger frame is not sending a message a reader merely declines, it is dropping the connection. The Init frame is the only one that can approach it (it carries the whole schema), and TcpExporter checks against this constant before sending.

public const int MaxFrameBytes = 8388608

Field Value

int

Methods

ReadFrameHeader(ReadOnlySpan<byte>)

Read a frame header from source.

public static (LiveFrameType Type, int PayloadLength) ReadFrameHeader(ReadOnlySpan<byte> source)

Parameters

source ReadOnlySpan<byte>

Returns

(LiveFrameType Type, int PayloadLength)

WriteFrameHeader(Span<byte>, LiveFrameType, int)

Write a frame header into destination.

public static void WriteFrameHeader(Span<byte> destination, LiveFrameType type, int payloadLength)

Parameters

destination Span<byte>
type LiveFrameType
payloadLength int