pub struct CombinedCounterIndex<'counter> { /* private fields */ }Expand description
An allocated index for a CombinedCounter
Implementations§
Source§impl<'counter> CombinedCounterIndex<'counter>
impl<'counter> CombinedCounterIndex<'counter>
Sourcepub fn into_parts(self) -> (&'counter CombinedCounter, u32)
pub fn into_parts(self) -> (&'counter CombinedCounter, u32)
Decomposes a combined counter index into its component parts
Sourcepub unsafe fn from_parts(counter: &'counter CombinedCounter, index: u32) -> Self
pub unsafe fn from_parts(counter: &'counter CombinedCounter, index: u32) -> Self
Creates a CombinedCounterIndex from component parts
§Safety
- Must only be done from VPP worker threads or the main thread
indexmust be a valid (previously allocated) index for the counter
Sourcepub fn increment(&self, vm: &MainRef, packets: u64, bytes: u64)
pub fn increment(&self, vm: &MainRef, packets: u64, bytes: u64)
Increment this thread’s per-thread counter
Sourcepub unsafe fn zero(&self)
pub unsafe fn zero(&self)
Zero all threads’ per-thread counters
§Safety
- There must be no concurrent writers to this index. For example, worker threads without the barrier held.
Sourcepub fn get(&self, _vm: &MainRef) -> CombinedCount
pub fn get(&self, _vm: &MainRef) -> CombinedCount
Get the total count, summing for all threads
Trait Implementations§
impl Send for CombinedCounterIndex<'_>
impl Sync for CombinedCounterIndex<'_>
Auto Trait Implementations§
impl<'counter> Freeze for CombinedCounterIndex<'counter>
impl<'counter> RefUnwindSafe for CombinedCounterIndex<'counter>
impl<'counter> Unpin for CombinedCounterIndex<'counter>
impl<'counter> UnsafeUnpin for CombinedCounterIndex<'counter>
impl<'counter> UnwindSafe for CombinedCounterIndex<'counter>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more