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

Function getRandomAllocSize

cachelib/allocator/memory/tests/TestBase.cpp:117–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117uint32_t getRandomAllocSize() {
118 // Reserve some space for the intrusive list's hook
119 constexpr uint32_t kReservedSize = 8;
120 assert(Slab::kSize >= kReservedSize);
121 return folly::Random::rand32(Slab::kSize - kReservedSize + 1) + kReservedSize;
122}
123
124std::set<uint32_t> getRandomPow2AllocSizes(unsigned int n) {
125 unsigned int numBits = static_cast<unsigned int>(log2(Slab::kSize));

Callers 5

getRandomAllocSizesFunction · 0.70
TEST_FFunction · 0.70
TEST_FFunction · 0.70
TEST_FFunction · 0.70
getValidAllocSizesMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected