MCPcopy Create free account
hub / github.com/facebook/CacheLib / getStats

Method getStats

cachelib/allocator/memory/MemoryPool.cpp:567–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565}
566
567MPStats MemoryPool::getStats() const {
568 LockHolder l(lock_);
569 folly::F14FastMap<ClassId, ACStats> acStats;
570 acStats.reserve(ac_.size());
571 std::set<ClassId> classIds;
572 for (const auto& ac : ac_) {
573 acStats.insert({ac->getId(), ac->getStats()});
574 classIds.insert(ac->getId());
575 }
576
577 const auto availableMemory = getUnAllocatedSlabMemory();
578 const auto slabsUnAllocated =
579 availableMemory > 0 ? availableMemory / Slab::kSize - freeSlabs_.size()
580 : 0;
581 return MPStats{std::move(classIds), std::move(acStats), freeSlabs_.size(),
582 slabsUnAllocated, nSlabResize_, nSlabRebalance_,
583 curSlabsAdvised_};
584}

Callers 15

TEST_FFunction · 0.45
TEST_FFunction · 0.45
doWorkMethod · 0.45
TEST_FFunction · 0.45
createSimpleContainerMethod · 0.45
testAddBasicMethod · 0.45
testRemoveBasicMethod · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45

Calls 3

sizeMethod · 0.45
insertMethod · 0.45
getIdMethod · 0.45

Tested by 15

TEST_FFunction · 0.36
TEST_FFunction · 0.36
doWorkMethod · 0.36
TEST_FFunction · 0.36
createSimpleContainerMethod · 0.36
testAddBasicMethod · 0.36
testRemoveBasicMethod · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36