pub struct NetworkSnapshot {Show 13 fields
pub name: Box<str>,
pub kind: InterfaceKind,
pub state: MetricState<LinkState>,
pub addresses: Vec<InterfaceAddress>,
pub mac: Option<Box<str>>,
pub rx: MetricState<Rate>,
pub tx: MetricState<Rate>,
pub rx_packets: MetricState<Rate>,
pub tx_packets: MetricState<Rate>,
pub errors: MetricState<InterfaceErrors>,
pub link_speed_mbps: MetricState<u64>,
pub since_launch: TrafficTotals,
pub os_totals: MetricState<TrafficTotals>,
}Expand description
State of one network interface.
Fields§
§name: Box<str>Interface name, e.g. en0 or eth0.
kind: InterfaceKindClassification.
state: MetricState<LinkState>Operational state.
addresses: Vec<InterfaceAddress>Assigned addresses.
mac: Option<Box<str>>Hardware address, where readable.
rx: MetricState<Rate>Receive throughput.
tx: MetricState<Rate>Transmit throughput.
rx_packets: MetricState<Rate>Received packets per second.
tx_packets: MetricState<Rate>Transmitted packets per second.
errors: MetricState<InterfaceErrors>Error and drop counters.
link_speed_mbps: MetricState<u64>Negotiated link speed, where the platform reports it.
since_launch: TrafficTotalsTotals accumulated since monitrs launched.
Distinct from os_totals: this one starts at zero and is always
meaningful, whereas the OS counter may have wrapped or been reset (§7.4).
os_totals: MetricState<TrafficTotals>The OS’s own counters, where exposed.
Implementations§
Source§impl NetworkSnapshot
impl NetworkSnapshot
Sourcepub fn utilization(&self) -> MetricState<Percent>
pub fn utilization(&self) -> MetricState<Percent>
Link utilization, or an explicit unavailability.
Not a stored field: deriving it on demand makes it impossible to persist a utilization that was computed without a known link speed (§7.4). The higher of the two directions is used, since a duplex link saturates in whichever direction fills first.
Sourcepub fn warming_up(name: Box<str>, kind: InterfaceKind) -> Self
pub fn warming_up(name: Box<str>, kind: InterfaceKind) -> Self
An interface whose counters exist but whose rates need a second sample.
Trait Implementations§
Source§impl Clone for NetworkSnapshot
impl Clone for NetworkSnapshot
Source§fn clone(&self) -> NetworkSnapshot
fn clone(&self) -> NetworkSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more