LatencyFilter

A latency filter tracks a stream of latency measurements involving a remote node, and returns an expected latency value using a moving median filter.

Filter buffers for each node are allocated on the GC heap, but operate in constant space thereafter.

See "Network Coordinates in the Wild" by Jonathan Ledlie, Paul Gardner, and Margo Seltzer, Section 7.2.

struct LatencyFilter (
T
U
size_t window
) if (
isHashKey!T &&
isFloatingPoint!U
&&
window > 0
) {}

Members

Functions

clear
void clear()

Clears the latency filter of all data collected.

discard
void discard(T node)

Discards data collected for a node.

get
U get(T node)

Returns the current median latency for a node. If no data has been recorded for the node, returns NaN.

push
U push(T node, U rtt)

Pushes a new latency datum into the filter window for a node, and returns the current median value from the filter.

Parameters

T

The node type.

U

The datum type.

window

The size of the moving filter window.

Meta