Skip to content

Commit 2a3fcfd

Browse files
committed
fix test with new stats struct
1 parent 99a317d commit 2a3fcfd

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

cachelib/allocator/tests/AllocatorMemoryTiersTest.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class AllocatorMemoryTiersTest : public AllocatorTest<AllocatorT> {
195195
const auto& mpStats = allocator->getPoolByTid(poolId, 0).getStats();
196196
//cache is 10MB should move about 1MB to reach 10% free
197197
uint32_t approxEvict = (1024*1024)/mpStats.acStats.at(cid).allocSize;
198-
while (stats.evictionStats.numMovedItems < approxEvict*0.95 && (1-slabStats.usageFraction()) >= 0.095) {
198+
while (stats.evictionStats[0].numMovedItems < approxEvict*0.95 && (1-slabStats.usageFraction()) >= 0.095) {
199199
std::this_thread::sleep_for(std::chrono::seconds(1));
200200
stats = allocator->getGlobalCacheStats();
201201
slabStats = allocator->getACStats(0,0,cid);
@@ -205,12 +205,14 @@ class AllocatorMemoryTiersTest : public AllocatorTest<AllocatorT> {
205205
auto perclassEstats = allocator->getBackgroundMoverClassStats(MoverDir::Evict);
206206
auto perclassPstats = allocator->getBackgroundMoverClassStats(MoverDir::Promote);
207207

208-
ASSERT_GE(stats.evictionStats.numMovedItems,1);
209-
ASSERT_GE(stats.evictionStats.runCount,1);
210-
ASSERT_GE(stats.promotionStats.numMovedItems,1);
211-
212-
ASSERT_GE(perclassEstats[0][0][cid], 1);
213-
ASSERT_GE(perclassPstats[1][0][cid], 1);
208+
ASSERT_GE(stats.evictionStats[0].numMovedItems,1);
209+
ASSERT_GE(stats.evictionStats[0].runCount,1);
210+
ASSERT_GE(stats.promotionStats[0].numMovedItems,1);
211+
212+
MemoryDescriptorType tier0(0,0,cid);
213+
MemoryDescriptorType tier1(1,0,cid);
214+
ASSERT_GE(perclassEstats[tier0], 1);
215+
ASSERT_GE(perclassPstats[tier1], 1);
214216

215217
}
216218

0 commit comments

Comments
 (0)