pub struct MemoryLedger { /* private fields */ }Expand description
Shared, cloneable handle to the per-principal peak-memory ledger.
Cloning is an Arc bump; every clone observes the same map, so the kernel
hands one clone to each WasmEngine and they all record into the same
per-principal high-water marks.
Implementations§
Source§impl MemoryLedger
impl MemoryLedger
Sourcepub fn record_peak(&self, principal: &PrincipalId, bytes: u64)
pub fn record_peak(&self, principal: &PrincipalId, bytes: u64)
Raise principal’s recorded peak to bytes if it exceeds the current
high-water mark (else no-op).
Lock-free in steady state: once a principal has an entry the common path
takes a shard read guard and a Relaxed compare-exchange max. Only the
first observation of a never-seen principal takes a shard write guard.
Relaxed is correct — a monotonic high-water mark with no ordering
dependency on other memory.
Sourcepub fn peak(&self, principal: &PrincipalId) -> u64
pub fn peak(&self, principal: &PrincipalId) -> u64
Read principal’s peak linear-memory high-water mark in bytes, or 0 if
it has never grown a Store. A snapshot via a shard read guard + a single
Relaxed load, the same ordering the record path uses.
Trait Implementations§
Source§impl Clone for MemoryLedger
impl Clone for MemoryLedger
Source§fn clone(&self) -> MemoryLedger
fn clone(&self) -> MemoryLedger
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for MemoryLedger
impl Default for MemoryLedger
Source§fn default() -> MemoryLedger
fn default() -> MemoryLedger
Auto Trait Implementations§
impl !RefUnwindSafe for MemoryLedger
impl !UnwindSafe for MemoryLedger
impl Freeze for MemoryLedger
impl Send for MemoryLedger
impl Sync for MemoryLedger
impl Unpin for MemoryLedger
impl UnsafeUnpin for MemoryLedger
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more