Struct Metrics

Source
pub struct Metrics(/* private fields */);

Implementations§

Source§

impl Metrics

Source

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.

Source

pub fn total_gc_allocation(&self) -> usize

Returns the total bytes allocated by the arena itself, used as the backing storage for Gc pointers.

Source

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.

Source

pub fn total_allocation(&self) -> usize

Returns the sum of Metrics::total_gc_allocation() and Metrics::total_external_allocation().

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Metrics

Source§

fn clone(&self) -> Metrics

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl Freeze for Metrics

§

impl !RefUnwindSafe for Metrics

§

impl !Send for Metrics

§

impl !Sync for Metrics

§

impl Unpin for Metrics

§

impl !UnwindSafe for Metrics

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.