1
0
Fork 0

prevent unlikely division by zero

This commit is contained in:
jsteemann 2017-03-23 18:17:47 +01:00
parent eaca014406
commit 30b4b2b402
1 changed files with 2 additions and 1 deletions

View File

@ -754,7 +754,8 @@ std::shared_ptr<Manager::PriorityList> Manager::priorityList() {
for (auto s : *stats) {
totalAccesses += s.second;
}
double normalizer = remainingWeight / static_cast<double>(totalAccesses);
double normalizer = remainingWeight / (std::max)(1.0, static_cast<double>(totalAccesses));
// gather all accessed caches in order
for (auto s : *stats) {