Class PageCacheEventCodec
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
OptPageCount
Optional-mask bit 0 — PageCount on DiskWrite (contiguous run length).
public const byte OptPageCount = 1
Field Value
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
kindTraceEventKindEvent kind (does not affect size; carried for symmetry with the encoder).
hasTraceContextboolWhether a 16-byte trace context is included in the span header.
optMaskbyteOptional-field mask — see OptPageCount / OptDirtyBit.
sourceLocationIdushortNon-zero adds a 2-byte source-location id to the header.
Returns
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
sourceReadOnlySpan<byte>