Class TickTelemetryRing
Pre-allocated circular buffer for tick telemetry. Zero allocation on Record(in TickTelemetry, ReadOnlySpan<SystemTelemetry>). Single writer (tick driver thread), multiple readers (diagnostics, metrics).
public sealed class TickTelemetryRing
- Inheritance
-
TickTelemetryRing
- Inherited Members
Remarks
Default capacity: 1024 entries (~17 seconds at 60Hz). Memory: 1024 × (sizeof(TickTelemetry) + systemCount × sizeof(SystemTelemetry)). For a 20-system DAG: ~1024 × (32 + 20 × 48) ≈ ~1 MB.
Constructors
TickTelemetryRing(int, int)
Creates a new telemetry ring buffer.
public TickTelemetryRing(int capacity, int systemCount)
Parameters
Properties
Capacity
Ring buffer capacity.
public int Capacity { get; }
Property Value
NewestTick
Tick number of the newest recorded entry, or -1 if no ticks recorded yet.
public long NewestTick { get; }
Property Value
OldestAvailableTick
Tick number of the oldest available entry, or -1 if no ticks recorded yet.
public long OldestAvailableTick { get; }
Property Value
TotalTicksRecorded
Number of ticks recorded so far (may exceed capacity — only last Capacity are retained).
public long TotalTicksRecorded { get; }
Property Value
Methods
GetSystemMetrics(long)
Returns the per-system telemetry for a given tick number.
public ReadOnlySpan<SystemTelemetry> GetSystemMetrics(long tickNumber)
Parameters
tickNumberlongAbsolute tick number.
Returns
- ReadOnlySpan<SystemTelemetry>
Span over the system metrics array for this tick.
Exceptions
- ArgumentOutOfRangeException
Tick is not in the buffer.
GetTick(long)
Returns the tick telemetry for a given tick number.
public ref readonly TickTelemetry GetTick(long tickNumber)
Parameters
tickNumberlongAbsolute tick number.
Returns
- TickTelemetry
Reference to the stored telemetry. Only valid if the tick is still in the buffer.
Exceptions
- ArgumentOutOfRangeException
Tick is not in the buffer (too old or not yet recorded).
Record(in TickTelemetry, ReadOnlySpan<SystemTelemetry>)
Records a tick's telemetry data into the ring buffer. Called at the end of each tick by the scheduler. Zero allocation — copies data into pre-allocated slots.
public void Record(in TickTelemetry tick, ReadOnlySpan<SystemTelemetry> systems)
Parameters
tickTickTelemetryTick-level telemetry.
systemsReadOnlySpan<SystemTelemetry>Per-system telemetry for this tick. Length must equal systemCount.