Skip to content

Commit be4a81c

Browse files
authored
Merge pull request #4 from byrnedj/promotion-stats-v2
updated stats map
2 parents e5b4d91 + a918e25 commit be4a81c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

cachelib/allocator/BackgroundEvictor-inl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ void BackgroundEvictor<CacheT>::checkAndRun() {
8181
tid,pid,cid,batch);
8282
evictions += evicted;
8383

84-
const size_t cid_id = (size_t)mpStats.acStats.at(cid).allocSize;
85-
auto it = evictions_per_class_.find(cid_id);
84+
//const size_t cid_id = (size_t)mpStats.acStats.at(cid).allocSize;
85+
auto it = evictions_per_class_.find(cid);
8686
if (it != evictions_per_class_.end()) {
8787
it->second += evicted;
88-
} else {
89-
evictions_per_class_[cid_id] = 0;
88+
} else if (evicted > 0) {
89+
evictions_per_class_[cid] = evicted;
9090
}
9191
}
9292

cachelib/allocator/BackgroundPromoter-inl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ void BackgroundPromoter<CacheT>::checkAndRun() {
8080
tid,pid,cid,batch);
8181
promotions += promoted;
8282

83-
const size_t cid_id = (size_t)mpStats.acStats.at(cid).allocSize;
84-
auto it = promotions_per_class_.find(cid_id);
83+
//const size_t cid_id = (size_t)mpStats.acStats.at(cid).allocSize;
84+
auto it = promotions_per_class_.find(cid);
8585
if (it != promotions_per_class_.end()) {
8686
it->second += promoted;
87-
} else {
88-
promotions_per_class_[cid_id] = 0;
87+
} else if (promoted > 0) {
88+
promotions_per_class_[cid] = promoted;
8989
}
9090
}
9191

cachelib/allocator/CacheAllocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ class CacheAllocator : public CacheBase {
18991899

19001900
size_t traverseAndPromoteItems(unsigned int tid, unsigned int pid, unsigned int cid, size_t batch) {
19011901
auto& mmContainer = getMMContainer(tid, pid, cid);
1902-
size_t promotions;
1902+
size_t promotions = 0;
19031903
std::vector<Item*> candidates;
19041904
candidates.reserve(batch);
19051905

0 commit comments

Comments
 (0)