Module metrics

Source
Expand description

Cache metrics system.

Provides a flexible metrics collection and reporting system for all cache algorithms. Each algorithm can track algorithm-specific metrics while implementing a common interface. Cache Metrics System

Provides a flexible metrics system for cache algorithms using BTreeMap-based metrics reporting. Each cache algorithm can track its own specific metrics while implementing a common CacheMetrics trait.

§Why BTreeMap over HashMap?

BTreeMap is used instead of HashMap for several critical reasons:

  • Deterministic ordering: Metrics always appear in consistent order
  • Reproducible output: Essential for testing and benchmarking comparisons
  • Stable serialization: JSON/CSV exports have predictable key ordering
  • Better debugging: Consistent output makes logs more readable

The performance difference (O(log n) vs O(1)) is negligible with ~15 metric keys, but the deterministic behavior is invaluable for a simulation system.

Re-exports§

pub use gdsf::GdsfCacheMetrics;
pub use lfu::LfuCacheMetrics;
pub use lfuda::LfudaCacheMetrics;
pub use lru::LruCacheMetrics;
pub use slru::SlruCacheMetrics;

Modules§

gdsf
GDSF Cache Metrics
lfu
LFU Cache Metrics
lfuda
LFUDA Cache Metrics
lru
LRU Cache Metrics
slru
SLRU Cache Metrics

Structs§

CoreCacheMetrics
Common metrics tracked by all cache algorithms

Traits§

CacheMetrics
Trait that all cache algorithms must implement for metrics reporting