pub struct FastPathCacheManager {
pub caches: [SizeClassCache; 52],
pub config: FastPathCacheConfig,
pub fast_path_allocations: usize,
pub fast_path_deallocations: usize,
pub slow_path_allocations: usize,
}Expand description
Thread-local fast-path cache manager.
This structure manages multiple per-size-class caches, allowing threads to satisfy allocation requests from thread-local pools without contention on global allocator structures.
Fields§
§caches: [SizeClassCache; 52]Per-size-class caches.
config: FastPathCacheConfigConfiguration for this cache manager.
fast_path_allocations: usizeTotal allocations served from fast-path.
fast_path_deallocations: usizeTotal deallocations through fast-path.
slow_path_allocations: usizeFallback allocations (slow path).
Implementations§
Source§impl FastPathCacheManager
impl FastPathCacheManager
Sourcepub fn new() -> FastPathCacheManager
pub fn new() -> FastPathCacheManager
Creates a new fast-path cache manager with default configuration.
Sourcepub fn with_config(config: FastPathCacheConfig) -> FastPathCacheManager
pub fn with_config(config: FastPathCacheConfig) -> FastPathCacheManager
Creates a new fast-path cache manager with a custom configuration.
Sourcepub fn try_allocate(&mut self, size_class: usize) -> Option<usize>
pub fn try_allocate(&mut self, size_class: usize) -> Option<usize>
Attempts to allocate from the fast-path cache for the given size class. Returns Some(index) if successful, None if the cache is disabled or full.
Sourcepub fn record_deallocation(&mut self, size_class: usize)
pub fn record_deallocation(&mut self, size_class: usize)
Records a deallocation in the fast-path cache.
Sourcepub fn reset_class_cache(&mut self, size_class: usize)
pub fn reset_class_cache(&mut self, size_class: usize)
Resets the cache for a specific size class.
Sourcepub fn class_stats(&self, size_class: usize) -> Option<(usize, u8)>
pub fn class_stats(&self, size_class: usize) -> Option<(usize, u8)>
Returns cache statistics for a specific size class.
Sourcepub fn efficiency_metrics(&self) -> FastPathEfficiencyMetrics
pub fn efficiency_metrics(&self) -> FastPathEfficiencyMetrics
Returns overall fast-path cache efficiency metrics.