Struct SerialSenderStats

Immutable snapshot of a SerialSender's traffic counters.

Namespace: MOSAIC.Components.Manager.Serial
Assembly: MOSAIC.dll
Syntax
public readonly record struct SerialSenderStats : IEquatable<SerialSenderStats>
Remarks

Why a snapshot: the counters are written from two threads — the pipeline thread enqueues, the writer thread transmits — so reading them one property at a time would let a caller observe a torn view. GetStats samples them together and hands back a value type that cannot change underneath the reader.

Invariant: Enqueued == Written + Dropped + Pending holds at every sampling instant, with one exception: a line that has been dequeued but whose write has not yet returned is counted in none of the three. It settles into Written or Dropped as soon as the write resolves, and Dispose settles it on the writer's behalf if the write never does, so the stricter Enqueued == Written + Dropped is exact on any drained queue — including after a disposal that had to abandon a stalled port.

Constructors

SerialSenderStats(long, long, long, long, long, long, long, int, bool, string?)

Immutable snapshot of a SerialSender's traffic counters.

Declaration
public SerialSenderStats(long Enqueued, long Written, long Dropped, long Timeouts, long Errors, long DumpErrors, long Reconnects, int Pending, bool IsConnected, string? LastError)
Parameters
Type Name Description
long Enqueued

Samples handed to the queue, whether or not they survived.

long Written

Lines successfully written to the port.

long Dropped

Samples discarded: rejected by the queue policy, lost to a failed write, or abandoned unsent at disposal.

long Timeouts

Writes abandoned after writeTimeoutMs. A subset of Dropped; a rising count means the receiver is not draining its buffer.

long Errors

Port failures recorded, counting both timeouts and link errors.

long DumpErrors

Failures writing the wire dump. Independent of the counters above: a dump failure never costs a line, it only means the file is an incomplete record of one that was sent successfully.

long Reconnects

Successful opens after the first one.

int Pending

Lines currently queued and not yet handed to the port.

bool IsConnected

Whether the port was open at the sampling instant.

string LastError

Message of the most recent failure, or null.

Remarks

Why a snapshot: the counters are written from two threads — the pipeline thread enqueues, the writer thread transmits — so reading them one property at a time would let a caller observe a torn view. GetStats samples them together and hands back a value type that cannot change underneath the reader.

Invariant: Enqueued == Written + Dropped + Pending holds at every sampling instant, with one exception: a line that has been dequeued but whose write has not yet returned is counted in none of the three. It settles into Written or Dropped as soon as the write resolves, and Dispose settles it on the writer's behalf if the write never does, so the stricter Enqueued == Written + Dropped is exact on any drained queue — including after a disposal that had to abandon a stalled port.

Properties

Dropped

Samples discarded: rejected by the queue policy, lost to a failed write, or abandoned unsent at disposal.

Declaration
public long Dropped { get; init; }
Property Value
Type Description
long

DumpErrors

Failures writing the wire dump. Independent of the counters above: a dump failure never costs a line, it only means the file is an incomplete record of one that was sent successfully.

Declaration
public long DumpErrors { get; init; }
Property Value
Type Description
long

Enqueued

Samples handed to the queue, whether or not they survived.

Declaration
public long Enqueued { get; init; }
Property Value
Type Description
long

Errors

Port failures recorded, counting both timeouts and link errors.

Declaration
public long Errors { get; init; }
Property Value
Type Description
long

IsConnected

Whether the port was open at the sampling instant.

Declaration
public bool IsConnected { get; init; }
Property Value
Type Description
bool

LastError

Message of the most recent failure, or null.

Declaration
public string? LastError { get; init; }
Property Value
Type Description
string

Pending

Lines currently queued and not yet handed to the port.

Declaration
public int Pending { get; init; }
Property Value
Type Description
int

Reconnects

Successful opens after the first one.

Declaration
public long Reconnects { get; init; }
Property Value
Type Description
long

Timeouts

Writes abandoned after writeTimeoutMs. A subset of Dropped; a rising count means the receiver is not draining its buffer.

Declaration
public long Timeouts { get; init; }
Property Value
Type Description
long

Written

Lines successfully written to the port.

Declaration
public long Written { get; init; }
Property Value
Type Description
long

Implements

IEquatable<T>

Search documentation

Start typing to search the documentation.