Table of Contents

Class NetworkStatsPresentation

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

Every rule the network statistics overlay applies between the transport's numbers and the text on screen: units, rounding, what "unknown" looks like, which badge a row wears, and what its tooltip says about why.

public static class NetworkStatsPresentation
Inheritance
NetworkStatsPresentation
Inherited Members

Remarks

Units are decimal (SI) throughout. 1 kB is 1,000 bytes and 1 Mbps is 1,000,000 bits a second, so a byte rate and the bit rate beside it differ by exactly eight — the way an internet plan and a network monitor both count. Binary kibibytes would make "1 MB/s" and "8 Mbps" disagree by five per cent, and a player comparing the overlay against their plan is the reader this is for.

Bytes in the table, bits in the headline. The table's per-layer figures are bytes, which is what the counters count and what adds up across layers; the headline is the on-the-wire rate in bits, because that is the unit a connection's speed is sold in. Every tooltip gives both.

Unknown is a dash, never a zero. The transport reports what it cannot see as -1 or NaN; every formatter here turns those into Unknown. A measured zero is still written as zero.

Culture-invariant, so a comma-decimal machine still reads "1.25 MB".

Fields

BadgeClasses

Every badge class, so a refresh can clear the ones that no longer apply.

public static readonly string[] BadgeClasses

Field Value

string[]

ConnectionStaleSeconds

How old the connection figures may be, relative to the snapshot, before they are shown as unknown. The client socket refreshes them once a second while the overlay is open; older than this means it has stopped (the connection closed between refreshes).

public const double ConnectionStaleSeconds = 5

Field Value

double

SentDatagramCaveat

The one msquic quirk that bounds a figure: its count of datagrams SENT is too high during bursts, so the sent datagrams and the sent wire bytes derived from them are upper bounds. Received counts are exact.

public const string SentDatagramCaveat = "Upload is an upper bound: msquic 2.5.9 counts some sent datagrams twice when a burst (such as a handshake) goes out in several batches, and each extra count adds 28 bytes to the header estimate. Received counts are exact, and the QUIC byte counts are unaffected."

Field Value

string

Unknown

What an unknown value reads as.

public const string Unknown = "—"

Field Value

string

Methods

BackendCaption(in NetworkStatsReadout)

The backend as a short caption for the overlay's header.

public static string BackendCaption(in NetworkStatsReadout readout)

Parameters

readout NetworkStatsReadout

Returns

string

BadgeClass(TrafficMeasure, bool)

USS class of a badge for measure, or the pending class.

public static string BadgeClass(TrafficMeasure measure, bool pending = false)

Parameters

measure TrafficMeasure
pending bool

Returns

string

BadgeText(TrafficMeasure, bool)

The word a badge shows for measure.

public static string BadgeText(TrafficMeasure measure, bool pending = false)

Parameters

measure TrafficMeasure
pending bool

Returns

string

BitRate(double)

A byte rate written in bits, e.g. "345 kbps", or Unknown.

public static string BitRate(double bytesPerSecond)

Parameters

bytesPerSecond double

Returns

string

BuildGraphTooltip(TooltipContent, double, TrafficMeasure)

Writes the explanation of the traffic graph: what a point is, what the scale is, and what a gap means.

public static void BuildGraphTooltip(TooltipContent content, double peak, TrafficMeasure wire)

Parameters

content TooltipContent

The content being assembled.

peak double

The highest known point in the graph, bytes a second, or NaN.

wire TrafficMeasure

The wire layer's measure in the newest snapshot.

BuildTooltip(TooltipContent, NetworkStatsRow, in NetworkStatsReadout)

Writes the explanation of one row into content: what it counts, how it was obtained, and why that is the best this process can do.

public static void BuildTooltip(TooltipContent content, NetworkStatsRow row, in NetworkStatsReadout readout)

Parameters

content TooltipContent
row NetworkStatsRow
readout NetworkStatsReadout

ByteRate(double)

A byte rate, e.g. "43.1 kB/s", or Unknown.

public static string ByteRate(double bytesPerSecond)

Parameters

bytesPerSecond double

Returns

string

Bytes(long)

A byte count, e.g. "12.4 MB", or Unknown when negative.

public static string Bytes(long bytes)

Parameters

bytes long

Returns

string

ConnectionIsCurrent(in TransportTrafficSnapshot)

True when the snapshot carries connection figures that are valid and recent.

public static bool ConnectionIsCurrent(in TransportTrafficSnapshot snapshot)

Parameters

snapshot TransportTrafficSnapshot

Returns

bool

Remarks

A reading older than ConnectionStaleSeconds is not presented as the current round-trip time. The socket withdraws its figures when it disconnects, but a read that failed quietly would otherwise leave the last good number on screen forever.

Count(long)

A count, e.g. "48,210", or Unknown when negative.

public static string Count(long count)

Parameters

count long

Returns

string

Describe(NetworkStatsRow, in NetworkStatsReadout)

The text a row shows for readout.

public static NetworkStatsFigures Describe(NetworkStatsRow row, in NetworkStatsReadout readout)

Parameters

row NetworkStatsRow
readout NetworkStatsReadout

Returns

NetworkStatsFigures

GraphScale(double, double)

The graph's vertical scale: the peak rounded up to 1, 2 or 5 times a power of ten, and never below floor bytes a second.

public static double GraphScale(double peak, double floor = 1000)

Parameters

peak double
floor double

Returns

double

Remarks

The floor keeps an idle connection's few hundred bytes of acknowledgements from being drawn as a full-height mountain. The rounding keeps the scale label a number a person would say ("50 kB/s", not "43.7 kB/s"), and keeps it from twitching every second.

GraphY(double, double, float)

The vertical position of a graph point, 0 at the top, height at the bottom, or NaN for an unknown point (a break in the line, never a zero).

public static float GraphY(double value, double scale, float height)

Parameters

value double
scale double
height float

Returns

float

Headline(in NetworkStatsReadout, out string, out string)

The on-the-wire rate each way in bits, for the headline.

public static void Headline(in NetworkStatsReadout readout, out string down, out string up)

Parameters

readout NetworkStatsReadout
down string
up string

IsKnown(double)

True for a finite, non-negative value.

public static bool IsKnown(double value)

Parameters

value double

Returns

bool

MeasureName(TrafficMeasure)

The measure spelled out, for a tooltip's subtitle.

public static string MeasureName(TrafficMeasure measure)

Parameters

measure TrafficMeasure

Returns

string

Milliseconds(double)

Milliseconds, e.g. "42 ms" or "4.2 ms", or Unknown.

public static string Milliseconds(double ms)

Parameters

ms double

Returns

string

Mtu(int)

A path MTU in bytes, e.g. "1452 B", or Unknown when not positive.

public static string Mtu(int bytes)

Parameters

bytes int

Returns

string

PerSecond(double)

A count per second, e.g. "62/s" or "2.5/s", or Unknown.

public static string PerSecond(double perSecond)

Parameters

perSecond double

Returns

string

Percent(double)

A fraction as a percentage, e.g. "0.20%", "1.5%", "12%", or Unknown.

public static string Percent(double fraction)

Parameters

fraction double

Returns

string

Ratio(double)

A wire-per-app ratio, e.g. "×1.13", or Unknown.

public static string Ratio(double ratio)

Parameters

ratio double

Returns

string

RowMeasure(NetworkStatsRow, in NetworkStatsReadout)

The measure a row's badge names, read from the newest snapshot.

public static TrafficMeasure RowMeasure(NetworkStatsRow row, in NetworkStatsReadout readout)

Parameters

row NetworkStatsRow
readout NetworkStatsReadout

Returns

TrafficMeasure

Remarks

The snapshot, not the interval: the totals come from it, and it is what the next interval will be measured as. The two differ only for the one sample after a layer changes definition, when the rates read unknown anyway.

RowName(NetworkStatsRow)

The row's name as the overlay's first column shows it.

public static string RowName(NetworkStatsRow row)

Parameters

row NetworkStatsRow

Returns

string

RowTitle(NetworkStatsRow)

The row's name as a tooltip's title spells it out.

public static string RowTitle(NetworkStatsRow row)

Parameters

row NetworkStatsRow

Returns

string