GcStats

Struct GcStats 

Source
pub struct GcStats {
    pub total_allocations: AtomicUsize,
    pub total_allocated_bytes: AtomicU64,
    pub minor_collections: AtomicUsize,
    pub major_collections: AtomicUsize,
    pub minor_collection_time: AtomicU64,
    pub major_collection_time: AtomicU64,
    pub minor_objects_collected: AtomicUsize,
    pub major_objects_collected: AtomicUsize,
    pub objects_promoted: AtomicUsize,
    pub peak_memory_usage: AtomicUsize,
    pub current_memory_usage: AtomicUsize,
    /* private fields */
}
Expand description

Comprehensive GC statistics

Fields§

§total_allocations: AtomicUsize

Total number of allocations

§total_allocated_bytes: AtomicU64

Total bytes allocated

§minor_collections: AtomicUsize

Number of minor collections performed

§major_collections: AtomicUsize

Number of major collections performed

§minor_collection_time: AtomicU64

Total time spent in minor collections

§major_collection_time: AtomicU64

Total time spent in major collections

§minor_objects_collected: AtomicUsize

Objects collected in minor collections

§major_objects_collected: AtomicUsize

Objects collected in major collections

§objects_promoted: AtomicUsize

Objects promoted between generations

§peak_memory_usage: AtomicUsize

Peak memory usage

§current_memory_usage: AtomicUsize

Current memory usage

Implementations§

Source§

impl GcStats

Source

pub fn new() -> Self

Source

pub fn record_allocation(&self, size: usize)

Record an allocation

Source

pub fn record_minor_collection( &self, objects_collected: usize, duration: Duration, )

Record a minor collection

Source

pub fn record_major_collection( &self, objects_collected: usize, duration: Duration, )

Record a major collection

Source

pub fn record_promotion(&self, count: usize)

Record object promotion

Source

pub fn record_deallocation(&self, size: usize)

Record memory deallocation

Source

pub fn allocation_rate(&self) -> f64

Get current allocation rate (allocations per second)

Source

pub fn average_minor_collection_time(&self) -> Duration

Get average minor collection time

Source

pub fn average_major_collection_time(&self) -> Duration

Get average major collection time

Source

pub fn gc_overhead_percentage(&self) -> f64

Get GC overhead as percentage of total runtime

Source

pub fn memory_utilization(&self) -> f64

Get memory utilization percentage

Source

pub fn collection_frequency(&self) -> (f64, f64)

Get collection frequency (collections per minute)

Source

pub fn recent_collections(&self, limit: usize) -> Vec<CollectionEvent>

Get recent collection history

Source

pub fn reset(&self)

Reset all statistics

Source

pub fn summary_report(&self) -> String

Generate a summary report

Trait Implementations§

Source§

impl Clone for GcStats

Source§

fn clone(&self) -> Self

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for GcStats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GcStats

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.