Struct GaugeValue
A single packed value inside a PerTickSnapshot record. Constructed via the typed factory helpers and encoded into the snapshot payload verbatim.
public readonly struct GaugeValue
- Inherited Members
Remarks
The struct carries the value in a 64-bit container regardless of the chosen GaugeValueKind; the codec writes only 4 or 8 bytes to the wire depending on the kind. Signed values (I64Signed) are stored in the container as their raw little-endian i64 bit-pattern.
Constructors
GaugeValue(GaugeId, GaugeValueKind, ulong)
Construct a gauge value from its raw container. Prefer the typed From* factories for correct encoding.
public GaugeValue(GaugeId id, GaugeValueKind kind, ulong rawValue)
Parameters
idGaugeIdGauge identifier.
kindGaugeValueKindOn-wire value kind.
rawValueulongRaw 64-bit payload (signed values stored as their i64 bit-pattern).
Fields
GaugeFieldPrefixSize
Size of the (id, kind) tag preceding every field payload on the wire: 2 + 1 = 3 bytes.
public const int GaugeFieldPrefixSize = 3
Field Value
Properties
Id
Which gauge this value belongs to.
public GaugeId Id { get; }
Property Value
Kind
On-wire representation of RawValue.
public GaugeValueKind Kind { get; }
Property Value
PayloadSize
On-wire payload size (4 or 8 bytes depending on Kind), excluding the 2-byte id and 1-byte kind tag.
public int PayloadSize { get; }
Property Value
RawValue
Raw 64-bit container. For U32Count/U32PercentHundredths only the low 32 bits are significant.
public ulong RawValue { get; }
Property Value
WireSize
Total on-wire footprint for this field: 2 (id) + 1 (kind) + payload.
public int WireSize { get; }
Property Value
Methods
FromI64(GaugeId, long)
Build a I64Signed value (stored as its i64 bit-pattern).
public static GaugeValue FromI64(GaugeId id, long value)
Parameters
Returns
FromPercentHundredths(GaugeId, uint)
Build a U32PercentHundredths value (e.g. 5025 = 50.25%).
public static GaugeValue FromPercentHundredths(GaugeId id, uint valueHundredths)
Parameters
Returns
FromU32(GaugeId, uint)
Build a U32Count value.
public static GaugeValue FromU32(GaugeId id, uint value)
Parameters
Returns
FromU64(GaugeId, ulong)
Build a U64Bytes value.
public static GaugeValue FromU64(GaugeId id, ulong value)