Skip to content

Commit 19c6828

Browse files
byrnedjvinser52
authored andcommitted
AC stats multi-tier
1 parent cdf2522 commit 19c6828

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

cachelib/allocator/Cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class CacheBase {
112112
//
113113
// @param poolId the pool id
114114
// @param classId the class id
115-
virtual ACStats getACStats(TierId tid,PoolId poolId, ClassId classId) const = 0;
115+
virtual ACStats getACStats(TierId tid, PoolId poolId, ClassId classId) const = 0;
116116

117117
// @param poolId the pool id
118118
virtual AllSlabReleaseEvents getAllSlabReleaseEvents(PoolId poolId) const = 0;

cachelib/cachebench/cache/CacheStats.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,17 @@ struct Stats {
193193
}
194194
};
195195

196-
foreachAC(allocationClassStats, [&](auto tid, auto pid, auto cid, auto stats) {
196+
auto foreachAC = [&](auto cb) {
197+
for (auto& tidStat : allocationClassStats) {
198+
for (auto& pidStat : tidStat.second) {
199+
for (auto& cidStat : pidStat.second) {
200+
cb(tidStat.first, pidStat.first, cidStat.first, cidStat.second);
201+
}
202+
}
203+
}
204+
};
205+
206+
foreachAC([&](auto tid, auto pid, auto cid, auto stats) {
197207
auto [allocSizeSuffix, allocSize] = formatMemory(stats.allocSize);
198208
auto [memorySizeSuffix, memorySize] =
199209
formatMemory(stats.totalAllocatedSize());
@@ -203,7 +213,7 @@ struct Stats {
203213
<< std::endl;
204214
});
205215

206-
foreachAC(allocationClassStats, [&](auto tid, auto pid, auto cid, auto stats) {
216+
foreachAC([&](auto tid, auto pid, auto cid, auto stats) {
207217
auto [allocSizeSuffix, allocSize] = formatMemory(stats.allocSize);
208218

209219
// If the pool is not full, extrapolate usageFraction for AC assuming it

0 commit comments

Comments
 (0)