Skip to content

Commit e697342

Browse files
committed
Remove redundant early hits stats
1 parent 94dc90e commit e697342

1 file changed

Lines changed: 0 additions & 18 deletions

File tree

src/cache/multilevel.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ pub struct LevelStats {
136136
pub struct MultiLevelStats {
137137
/// Per-level statistics
138138
pub levels: Vec<LevelStats>,
139-
/// Number of times a hit occurred before checking all levels
140-
pub early_hits: u64,
141139
}
142140

143141
impl LevelStats {
@@ -264,14 +262,6 @@ impl MultiLevelStats {
264262
0,
265263
));
266264

267-
if self.early_hits > 0 {
268-
result.push((
269-
"Multi-level early hits".to_string(),
270-
self.early_hits.to_string(),
271-
0,
272-
));
273-
}
274-
275265
// Per-level stats
276266
for level_stats in &self.levels {
277267
result.extend(level_stats.format_stats());
@@ -296,8 +286,6 @@ pub struct MultiLevelStorage {
296286
write_policy: WritePolicy,
297287
/// Lock-free atomic statistics per level
298288
atomic_stats: Vec<Arc<AtomicLevelStats>>,
299-
/// Early hits counter
300-
early_hits: AtomicU64,
301289
}
302290

303291
impl MultiLevelStorage {
@@ -312,7 +300,6 @@ impl MultiLevelStorage {
312300
levels,
313301
write_policy: WritePolicy::default(),
314302
atomic_stats,
315-
early_hits: AtomicU64::new(0),
316303
}
317304
}
318305

@@ -324,15 +311,13 @@ impl MultiLevelStorage {
324311
levels,
325312
write_policy,
326313
atomic_stats,
327-
early_hits: AtomicU64::new(0),
328314
}
329315
}
330316

331317
/// Get a snapshot of current multi-level cache statistics.
332318
pub fn stats(&self) -> MultiLevelStats {
333319
MultiLevelStats {
334320
levels: self.atomic_stats.iter().map(|s| s.snapshot()).collect(),
335-
early_hits: self.early_hits.load(Ordering::Relaxed),
336321
}
337322
}
338323

@@ -565,9 +550,6 @@ impl Storage for MultiLevelStorage {
565550
.hit_duration_nanos
566551
.fetch_add(duration.as_nanos() as u64, Ordering::Relaxed);
567552
}
568-
if idx > 0 {
569-
self.early_hits.fetch_add(1, Ordering::Relaxed);
570-
}
571553
// Mark misses for all levels checked before this hit
572554
for miss_idx in 0..idx {
573555
if let Some(stats) = self.atomic_stats.get(miss_idx) {

0 commit comments

Comments
 (0)