pub struct Metrics(/* private fields */);
Implementations§
Source§impl Metrics
impl Metrics
Sourcepub fn set_pacing(&self, pacing: Pacing)
pub fn set_pacing(&self, pacing: Pacing)
Sets the pacing parameters used by the collection algorithm.
The factors that affect the gc pause time will not take effect until the start of the next collection.
Sourcepub fn total_gc_allocation(&self) -> usize
pub fn total_gc_allocation(&self) -> usize
Returns the total bytes allocated by the arena itself, used as the backing storage for Gc
pointers.
Sourcepub fn total_external_allocation(&self) -> usize
pub fn total_external_allocation(&self) -> usize
Returns the total bytes that have been marked as externally allocated.
A call to Metrics::mark_external_allocation
will increase this count, and a call to
Metrics::mark_external_deallocation
will decrease it.
Sourcepub fn total_allocation(&self) -> usize
pub fn total_allocation(&self) -> usize
Returns the sum of Metrics::total_gc_allocation()
and
Metrics::total_external_allocation()
.
Sourcepub fn allocation_debt(&self) -> f64
pub fn allocation_debt(&self) -> f64
All arena allocation causes the arena to accumulate “allocation debt”. This debt is then
used to time incremental garbage collection based on the tuning parameters in the current
Pacing
. The allocation debt is measured in bytes, but will generally increase at a rate
faster than that of allocation so that collection will always complete.
Sourcepub fn mark_external_allocation(&self, bytes: usize)
pub fn mark_external_allocation(&self, bytes: usize)
Call to mark that bytes have been externally allocated that are owned by an arena.
This affects the GC pacing, marking external bytes as allocated will trigger allocation debt.
Sourcepub fn mark_external_deallocation(&self, bytes: usize)
pub fn mark_external_deallocation(&self, bytes: usize)
Call to mark that bytes which have been marked as allocated with
Metrics::mark_external_allocation
have been since deallocated.
This affects the GC pacing, marking external bytes as deallocated will reduce allocation debt.
It is safe, but may result in unspecified behavior (such as very weird or non-existent gc pacing), if the amount of bytes marked for deallocation is greater than the number of bytes marked for allocation.