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

Method getTotalObjSizeBytes

cachelib/object_cache/ObjectCacheSizeController.h:109–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107
108template <typename AllocatorT>
109size_t ObjectCacheSizeController<AllocatorT>::getTotalObjSizeBytes() const {
110 auto totalObjSize = objCache_.getTotalObjectSize();
111 if (objCache_.config_.fragmentationTrackingEnabled &&
112 folly::usingJEMalloc()) {
113 auto [jemallocAllocatedBytes, jemallocActiveBytes] =
114 trackJemallocMemStats();
115 // proportionally add Jemalloc external fragmentation bytes (i.e.
116 // jemallocActiveBytes - jemallocAllocatedBytes)
117 totalObjSize = static_cast<size_t>(
118 1.0 * totalObjSize / jemallocAllocatedBytes * jemallocActiveBytes);
119 }
120 return totalObjSize;
121}
122
123template <typename AllocatorT>
124void ObjectCacheSizeController<AllocatorT>::work() {

Callers

nothing calls this directly

Calls 1

getTotalObjectSizeMethod · 0.80

Tested by

no test coverage detected