pub struct Ledger { /* private fields */ }Expand description
The aggregate heap and charges of the registered threads, observed at
each event. cost is the charge unit of a block’s size (the core’s
heap_cost, which the testkit does not link): a test passes it.
Implementations§
Source§impl Ledger
impl Ledger
Sourcepub fn arm(&self, allowance: u64) -> (i64, i64)
pub fn arm(&self, allowance: u64) -> (i64, i64)
Starts a measured window: from now each event’s residual, the heap’s
rise since now less the charges’, is held against allowance, the
uncharged bytes the window may hold, and the peaks and the first
violation start again. The live heap and charges are not reset.
Returns the coherent (heap, charged) at the arm for phase-local
absolute residual comparisons.
Sourcepub fn observe(&self) -> Observation
pub fn observe(&self) -> Observation
The state now, read inside the critical section: one instant.
Trait Implementations§
Source§impl Tally for Ledger
Counted conservatively: a block is counted before System is asked for
it and uncounted once System has freed it, so the ledger’s heap is
never below the live heap, whatever the threads’ interleaving; a
moving realloc counts its new block before the call and drops its old
one after success; a failed request is rolled back. A nonmoving shrink
holds the old cost through the call, then replaces it in one event.
impl Tally for Ledger
Counted conservatively: a block is counted before System is asked for
it and uncounted once System has freed it, so the ledger’s heap is
never below the live heap, whatever the threads’ interleaving; a
moving realloc counts its new block before the call and drops its old
one after success; a failed request is rolled back. A nonmoving shrink
holds the old cost through the call, then replaces it in one event.
Source§fn shrunk(&self, old: usize, new: usize)
fn shrunk(&self, old: usize, new: usize)
Source§fn growing(&self, size: usize)
fn growing(&self, size: usize)
size bytes is about to be asked of System on a
counted thread (a fresh block, or a realloc’s new one): told before
it can be live, so a tally that counts here never holds less than the
live heap. Nothing, by default.Source§fn failed(&self, size: usize)
fn failed(&self, size: usize)
Self::growing told of failed: no block was made.
Nothing, by default.Source§fn shrank(&self, size: usize)
fn shrank(&self, size: usize)
size bytes was freed on a counted thread: told once
System has freed it.Source§fn refuses(&self, size: usize) -> bool
fn refuses(&self, size: usize) -> bool
size bytes fails without reaching System,
on any thread (a test that refuses huge requests rather than meet the
machine’s limit). Never, by default.Source§fn refuses_realloc(&self, new_size: usize) -> bool
fn refuses_realloc(&self, new_size: usize) -> bool
realloc to new_size bytes fails without reaching
System: Self::refuses, by default. A test that refuses one
fresh allocation of a size, and never a growth or shrink the code
under test makes infallibly, answers false here.