Skip to main content

DatapathStats

Struct DatapathStats 

Source
pub struct DatapathStats {
Show 17 fields pub tx_packets: CachePadded<AtomicU64>, pub tx_bytes: CachePadded<AtomicU64>, pub tx_dropped: CachePadded<AtomicU64>, pub tx_errors: CachePadded<AtomicU64>, pub rx_packets: CachePadded<AtomicU64>, pub rx_bytes: CachePadded<AtomicU64>, pub rx_dropped: CachePadded<AtomicU64>, pub rx_errors: CachePadded<AtomicU64>, pub nat_translations: CachePadded<AtomicU64>, pub nat_fast_path_hits: CachePadded<AtomicU64>, pub nat_slow_path_lookups: CachePadded<AtomicU64>, pub nat_connections_created: CachePadded<AtomicU64>, pub nat_connections_expired: CachePadded<AtomicU64>, pub poll_iterations: CachePadded<AtomicU64>, pub poll_work_done: CachePadded<AtomicU64>, pub poll_busy_spins: CachePadded<AtomicU64>, pub batch_histogram: [CachePadded<AtomicU64>; 8],
}
Expand description

Datapath performance statistics.

All counters are cache-line aligned to prevent false sharing when updated from different threads.

Fields§

§tx_packets: CachePadded<AtomicU64>

Total packets transmitted (guest -> host).

§tx_bytes: CachePadded<AtomicU64>

Total bytes transmitted.

§tx_dropped: CachePadded<AtomicU64>

TX packets dropped due to full queue.

§tx_errors: CachePadded<AtomicU64>

TX errors.

§rx_packets: CachePadded<AtomicU64>

Total packets received (host -> guest).

§rx_bytes: CachePadded<AtomicU64>

Total bytes received.

§rx_dropped: CachePadded<AtomicU64>

RX packets dropped due to full queue.

§rx_errors: CachePadded<AtomicU64>

RX errors.

§nat_translations: CachePadded<AtomicU64>

NAT translations performed.

§nat_fast_path_hits: CachePadded<AtomicU64>

NAT fast path hits.

§nat_slow_path_lookups: CachePadded<AtomicU64>

NAT slow path lookups.

§nat_connections_created: CachePadded<AtomicU64>

NAT connection tracking entries created.

§nat_connections_expired: CachePadded<AtomicU64>

NAT connection tracking entries expired.

§poll_iterations: CachePadded<AtomicU64>

Poll loop iterations.

§poll_work_done: CachePadded<AtomicU64>

Poll loop iterations with work done.

§poll_busy_spins: CachePadded<AtomicU64>

Poll loop busy spins (no work).

§batch_histogram: [CachePadded<AtomicU64>; 8]

Batch sizes histogram (power of 2 buckets). [0]: 1 packet, [1]: 2 packets, [2]: 4 packets, etc.

Implementations§

Source§

impl DatapathStats

Source

pub const fn new() -> Self

Creates new empty statistics.

Source

pub fn record_tx(&self, packets: u64, bytes: u64)

Records transmitted packets.

Source

pub fn record_tx_drop(&self)

Records a TX drop.

Source

pub fn record_tx_error(&self)

Records a TX error.

Source

pub fn record_rx(&self, packets: u64, bytes: u64)

Records received packets.

Source

pub fn record_rx_drop(&self)

Records an RX drop.

Source

pub fn record_rx_error(&self)

Records an RX error.

Source

pub fn record_nat_translation(&self, fast_path: bool)

Records a NAT translation.

Source

pub fn record_nat_connection_created(&self)

Records a new NAT connection.

Source

pub fn record_nat_connection_expired(&self)

Records an expired NAT connection.

Source

pub fn record_poll(&self, work_done: bool)

Records a poll iteration.

Source

pub fn record_batch_size(&self, size: usize)

Records a batch size in the histogram.

Source

pub fn snapshot(&self) -> StatsSnapshot

Returns a snapshot of current statistics.

Source

pub fn reset(&self)

Resets all counters to zero.

Trait Implementations§

Source§

impl Debug for DatapathStats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DatapathStats

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.