Class SchedulerMetronomeEventCodec
Wire codec for Scheduler:Metronome (kind 241) and Scheduler:Overload:Detector (kind 242). Issue #289 follow-up — surfaces the previously invisible inter-tick wait + per-tick detector state so the profiler can answer "why did the engine wait for nothing".
public static class SchedulerMetronomeEventCodec
- Inheritance
-
SchedulerMetronomeEventCodec
- Inherited Members
Fields
DetectorSize
Fixed wire size in bytes of an OverloadDetector sample (common header + 24-byte payload).
public const int DetectorSize = 36
Field Value
Methods
ComputeSizeWait(bool)
Wire size in bytes of a MetronomeWait span, including the 16-byte trace context when hasTraceContext is true.
public static int ComputeSizeWait(bool hasTraceContext)
Parameters
hasTraceContextbool
Returns
DecodeDetector(ReadOnlySpan<byte>)
Decode an OverloadDetector instant sample from source.
public static SchedulerOverloadDetectorData DecodeDetector(ReadOnlySpan<byte> source)
Parameters
sourceReadOnlySpan<byte>
Returns
DecodeWait(ReadOnlySpan<byte>)
Decode a MetronomeWait span from source.
public static SchedulerMetronomeWaitData DecodeWait(ReadOnlySpan<byte> source)
Parameters
sourceReadOnlySpan<byte>
Returns
- SchedulerMetronomeWaitData
The decoded SchedulerMetronomeWaitData.
EncodeWait(Span<byte>, byte, long, long, ulong, ulong, long, byte, byte, byte, out int)
Encode a SchedulerMetronomeWait span record. The wait happens on the timer thread between
ticks. We accept a caller-supplied spanId so each emitted span is uniquely
addressable by trace-tree features (filters, parent-child grouping); parentSpanId
is typically 0 because the wait has no lexically enclosing span. No distributed-trace context
(the wait is a self-contained internal event).
public static void EncodeWait(Span<byte> destination, byte threadSlot, long startTimestamp, long endTimestamp, ulong spanId, ulong parentSpanId, long scheduledTimestamp, byte multiplier, byte intentClass, byte phaseFlags, out int bytesWritten)
Parameters
destinationSpan<byte>threadSlotbytestartTimestamplongendTimestamplongspanIdulongparentSpanIdulongscheduledTimestamplongmultiplierbyteintentClassbytephaseFlagsbytebytesWrittenint
WriteDetector(Span<byte>, byte, long, long, float, ushort, ushort, ushort, int, byte, byte)
Encode an OverloadDetector instant sample into destination (must be at least DetectorSize bytes).
public static void WriteDetector(Span<byte> destination, byte threadSlot, long timestamp, long tick, float overrunRatio, ushort consecutiveOverrun, ushort consecutiveUnderrun, ushort consecutiveQueueGrowth, int queueDepth, byte level, byte multiplier)