fix: cache calculation
This commit is contained in:
@@ -51,7 +51,11 @@ impl TierResult {
|
||||
capacity_blocks,
|
||||
hits,
|
||||
misses,
|
||||
hit_rate: if total == 0 { 0.0 } else { hits as f64 / total as f64 },
|
||||
hit_rate: if total == 0 {
|
||||
0.0
|
||||
} else {
|
||||
hits as f64 / total as f64
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,12 +72,7 @@ pub fn analyze(records: &[RequestRecord], capacity_blocks: u64) -> OracleResult
|
||||
|
||||
// 1. Unlimited cache
|
||||
let unlimited_hits = run_unlimited(records);
|
||||
let unlimited = TierResult::from_counts(
|
||||
"unlimited",
|
||||
u64::MAX,
|
||||
unlimited_hits,
|
||||
total_blocks,
|
||||
);
|
||||
let unlimited = TierResult::from_counts("unlimited", u64::MAX, unlimited_hits, total_blocks);
|
||||
|
||||
// 2. Precompute next-use index for Belady
|
||||
let next_use = build_next_use(records);
|
||||
|
||||
Reference in New Issue
Block a user