pub struct MemoryCounter { /* private fields */ }Expand description
Per-party allocation tally.
The harness calls MemoryCounter::track when a plugin reports it
has allocated on behalf of a party; the counter keeps a running peak.
This is cooperative accounting — the framework can’t intercept every
malloc — but it gives the bench a consistent, comparable number
across schemes that all play by the same rule.
Implementations§
Source§impl MemoryCounter
impl MemoryCounter
pub fn new() -> Self
Sourcepub fn track(&self, bytes: u64)
pub fn track(&self, bytes: u64)
Account bytes of live allocation. Updates the peak if the new
current exceeds it.
Sourcepub fn release(&self, bytes: u64)
pub fn release(&self, bytes: u64)
Release previously tracked bytes. Never underflows past zero.
Sourcepub fn peak_bytes(&self) -> u64
pub fn peak_bytes(&self) -> u64
Highest live-allocation watermark seen since construction.
Sourcepub fn current_bytes(&self) -> u64
pub fn current_bytes(&self) -> u64
Currently live tracked bytes.
Trait Implementations§
Source§impl Debug for MemoryCounter
impl Debug for MemoryCounter
Source§impl Default for MemoryCounter
impl Default for MemoryCounter
Source§fn default() -> MemoryCounter
fn default() -> MemoryCounter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for MemoryCounter
impl RefUnwindSafe for MemoryCounter
impl Send for MemoryCounter
impl Sync for MemoryCounter
impl Unpin for MemoryCounter
impl UnsafeUnpin for MemoryCounter
impl UnwindSafe for MemoryCounter
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