Table of Contents

Class PageCacheEventCodec

Namespace
Typhon.Profiler
Assembly
Typhon.Profiler.dll

Shared wire codec for all five page-cache event kinds. Every kind writes a 4-byte "primary value" slot (FilePageIndex for most, PageCount for Flush) plus a 1-byte optMask, plus optional trailing fields keyed by the mask bits.

public static class PageCacheEventCodec
Inheritance
PageCacheEventCodec
Inherited Members

Remarks

Phase 5 wire-additive extension: OptDirtyBit (0x02) appends one trailing byte for the PageEvicted dirty flag (1 = displaced page was dirty, 0 = clean). Old decoders see an unknown mask bit and stop reading at the cursor they expect; the record-size header in the common header tells them where the next record begins, so wire compatibility is preserved.

Fields

OptDirtyBit

Optional-mask bit 1 (Phase 5) — trailing 1-byte dirtyBit on PageEvicted.

public const byte OptDirtyBit = 2

Field Value

byte

OptPageCount

Optional-mask bit 0 — PageCount on DiskWrite (contiguous run length).

public const byte OptPageCount = 1

Field Value

byte

Methods

ComputeSize(TraceEventKind, bool, byte, ushort)

Total on-wire record size in bytes for a page-cache event, accounting for the optional fields the mask selects.

public static int ComputeSize(TraceEventKind kind, bool hasTraceContext, byte optMask, ushort sourceLocationId = 0)

Parameters

kind TraceEventKind

Event kind (does not affect size; carried for symmetry with the encoder).

hasTraceContext bool

Whether a 16-byte trace context is included in the span header.

optMask byte

Optional-field mask — see OptPageCount / OptDirtyBit.

sourceLocationId ushort

Non-zero adds a 2-byte source-location id to the header.

Returns

int

Decode(ReadOnlySpan<byte>)

Decode any page-cache span record into structured form. The event kind is read from the common header.

public static PageCacheEventData Decode(ReadOnlySpan<byte> source)

Parameters

source ReadOnlySpan<byte>

Returns

PageCacheEventData