Table of Contents

Struct GaugeValue

Namespace
Typhon.Profiler
Assembly
Typhon.Profiler.dll

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

id GaugeId

Gauge identifier.

kind GaugeValueKind

On-wire value kind.

rawValue ulong

Raw 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

int

Properties

Id

Which gauge this value belongs to.

public GaugeId Id { get; }

Property Value

GaugeId

Kind

On-wire representation of RawValue.

public GaugeValueKind Kind { get; }

Property Value

GaugeValueKind

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

int

RawValue

Raw 64-bit container. For U32Count/U32PercentHundredths only the low 32 bits are significant.

public ulong RawValue { get; }

Property Value

ulong

WireSize

Total on-wire footprint for this field: 2 (id) + 1 (kind) + payload.

public int WireSize { get; }

Property Value

int

Methods

FromI64(GaugeId, long)

Build a I64Signed value (stored as its i64 bit-pattern).

public static GaugeValue FromI64(GaugeId id, long value)

Parameters

id GaugeId
value long

Returns

GaugeValue

FromPercentHundredths(GaugeId, uint)

Build a U32PercentHundredths value (e.g. 5025 = 50.25%).

public static GaugeValue FromPercentHundredths(GaugeId id, uint valueHundredths)

Parameters

id GaugeId
valueHundredths uint

Returns

GaugeValue

FromU32(GaugeId, uint)

Build a U32Count value.

public static GaugeValue FromU32(GaugeId id, uint value)

Parameters

id GaugeId
value uint

Returns

GaugeValue

FromU64(GaugeId, ulong)

Build a U64Bytes value.

public static GaugeValue FromU64(GaugeId id, ulong value)

Parameters

id GaugeId
value ulong

Returns

GaugeValue