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: AtomicUsizeTotal number of allocations
total_allocated_bytes: AtomicU64Total bytes allocated
minor_collections: AtomicUsizeNumber of minor collections performed
major_collections: AtomicUsizeNumber of major collections performed
minor_collection_time: AtomicU64Total time spent in minor collections
major_collection_time: AtomicU64Total time spent in major collections
minor_objects_collected: AtomicUsizeObjects collected in minor collections
major_objects_collected: AtomicUsizeObjects collected in major collections
objects_promoted: AtomicUsizeObjects promoted between generations
peak_memory_usage: AtomicUsizePeak memory usage
current_memory_usage: AtomicUsizeCurrent memory usage
Implementations§
Source§impl GcStats
impl GcStats
pub fn new() -> Self
Sourcepub fn record_allocation(&self, size: usize)
pub fn record_allocation(&self, size: usize)
Record an allocation
Sourcepub fn record_minor_collection(
&self,
objects_collected: usize,
duration: Duration,
)
pub fn record_minor_collection( &self, objects_collected: usize, duration: Duration, )
Record a minor collection
Sourcepub fn record_major_collection(
&self,
objects_collected: usize,
duration: Duration,
)
pub fn record_major_collection( &self, objects_collected: usize, duration: Duration, )
Record a major collection
Sourcepub fn record_promotion(&self, count: usize)
pub fn record_promotion(&self, count: usize)
Record object promotion
Sourcepub fn record_deallocation(&self, size: usize)
pub fn record_deallocation(&self, size: usize)
Record memory deallocation
Sourcepub fn allocation_rate(&self) -> f64
pub fn allocation_rate(&self) -> f64
Get current allocation rate (allocations per second)
Sourcepub fn average_minor_collection_time(&self) -> Duration
pub fn average_minor_collection_time(&self) -> Duration
Get average minor collection time
Sourcepub fn average_major_collection_time(&self) -> Duration
pub fn average_major_collection_time(&self) -> Duration
Get average major collection time
Sourcepub fn gc_overhead_percentage(&self) -> f64
pub fn gc_overhead_percentage(&self) -> f64
Get GC overhead as percentage of total runtime
Sourcepub fn memory_utilization(&self) -> f64
pub fn memory_utilization(&self) -> f64
Get memory utilization percentage
Sourcepub fn collection_frequency(&self) -> (f64, f64)
pub fn collection_frequency(&self) -> (f64, f64)
Get collection frequency (collections per minute)
Sourcepub fn recent_collections(&self, limit: usize) -> Vec<CollectionEvent>
pub fn recent_collections(&self, limit: usize) -> Vec<CollectionEvent>
Get recent collection history
Sourcepub fn summary_report(&self) -> String
pub fn summary_report(&self) -> String
Generate a summary report