| 331 | |
| 332 | template <typename AllocatorT> |
| 333 | void ObjectCacheSizeController<AllocatorT>::getCounters( |
| 334 | const util::CounterVisitor& visitor) const { |
| 335 | visitor("objcache.num_placeholders", objCache_.getNumPlaceholders()); |
| 336 | if (folly::usingJEMalloc()) { |
| 337 | auto [jemallocAllocatedBytes, jemallocActiveBytes] = |
| 338 | trackJemallocMemStats(); |
| 339 | visitor("objcache.jemalloc_active_bytes", jemallocActiveBytes); |
| 340 | visitor("objcache.jemalloc_allocated_bytes", jemallocAllocatedBytes); |
| 341 | } |
| 342 | visitor("objcache.num_entries", objCache_.getNumEntries()); |
| 343 | visitor("objcache.free_mem_bytes", objCache_.config_.getFreeMemBytes()); |
| 344 | visitor("objcache.rss_mem_bytes", objCache_.config_.getRSSMemBytes()); |
| 345 | visitor("objcache.current_entries_limit", |
| 346 | currentEntriesLimit_.load(std::memory_order_relaxed)); |
| 347 | visitor("objcache.total_object_size_limit", |
| 348 | totalObjectSizeLimit_.load(std::memory_order_relaxed)); |
| 349 | visitor("objcache.size_controller.shrink_cache_calls", |
| 350 | shrinkCacheCalls_.get(), util::CounterVisitor::CounterType::RATE); |
| 351 | visitor("objcache.size_controller.expand_cache_calls", |
| 352 | expandCacheCalls_.get(), util::CounterVisitor::CounterType::RATE); |
| 353 | visitor("objcache.size_controller.total_entries_shrunk", |
| 354 | totalEntriesShrunk_.get(), util::CounterVisitor::CounterType::RATE); |
| 355 | visitor("objcache.size_controller.total_entries_expanded", |
| 356 | totalEntriesExpanded_.get(), |
| 357 | util::CounterVisitor::CounterType::RATE); |
| 358 | visitor("objcache.size_controller.ensure_free_memory_calls", |
| 359 | ensureFreeMemoryCalls_.get(), |
| 360 | util::CounterVisitor::CounterType::RATE); |
| 361 | } |
| 362 | |
| 363 | template <typename AllocatorT> |
| 364 | void ObjectCacheSizeController<AllocatorT>::ensureFreeMemoryAboveLowerLimit() { |
no test coverage detected