From: Adam Kupczyk Date: Wed, 20 May 2020 13:49:06 +0000 (+0200) Subject: common/PriorityCache: Added ability to give custom name to Manager's perf_counters X-Git-Tag: v16.1.0~2139^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ab0905619c9960f7fce71c5fd12f42f9f9dfa0e1;p=ceph.git common/PriorityCache: Added ability to give custom name to Manager's perf_counters Signed-off-by: Adam Kupczyk --- diff --git a/src/common/PriorityCache.cc b/src/common/PriorityCache.cc index bb4366b6cc61..af1fc213f324 100644 --- a/src/common/PriorityCache.cc +++ b/src/common/PriorityCache.cc @@ -62,16 +62,18 @@ namespace PriorityCache uint64_t min, uint64_t max, uint64_t target, - bool reserve_extra) : + bool reserve_extra, + const std::string& name) : cct(c), caches{}, min_mem(min), max_mem(max), target_mem(target), tuned_mem(min), - reserve_extra(reserve_extra) + reserve_extra(reserve_extra), + name(name.empty() ? "prioritycache" : name) { - PerfCountersBuilder b(cct, "prioritycache", + PerfCountersBuilder b(cct, name, MallocStats::M_FIRST, MallocStats::M_LAST); b.add_u64(MallocStats::M_TARGET_BYTES, "target_bytes", @@ -170,7 +172,7 @@ namespace PriorityCache ceph_assert(end < PERF_COUNTER_MAX_BOUND); indexes.emplace(name, std::vector(Extra::E_LAST + 1)); - PerfCountersBuilder b(cct, "prioritycache:" + name, start, end); + PerfCountersBuilder b(cct, this->name + ":" + name, start, end); b.add_u64(cur_index + Priority::PRI0, "pri0_bytes", "bytes allocated to pri0", "p0", diff --git a/src/common/PriorityCache.h b/src/common/PriorityCache.h index 6ac607022414..362b5477da2f 100644 --- a/src/common/PriorityCache.h +++ b/src/common/PriorityCache.h @@ -117,10 +117,10 @@ namespace PriorityCache { uint64_t target_mem = 0; uint64_t tuned_mem = 0; bool reserve_extra; - + std::string name; public: Manager(CephContext *c, uint64_t min, uint64_t max, uint64_t target, - bool reserve_extra); + bool reserve_extra, const std::string& name = std::string()); ~Manager(); void set_min_memory(uint64_t min) { min_mem = min; diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 8e10a4476927..fe9554a63a7c 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -3788,7 +3788,7 @@ void *BlueStore::MempoolThread::entry() binned_kv_cache = store->db->get_priority_cache(); if (store->cache_autotune && binned_kv_cache != nullptr) { pcm = std::make_shared( - store->cct, min, max, target, true); + store->cct, min, max, target, true, "bluestore-pricache"); pcm->insert("kv", binned_kv_cache, true); pcm->insert("meta", meta_cache, true); pcm->insert("data", data_cache, true); @@ -3864,6 +3864,7 @@ void *BlueStore::MempoolThread::entry() // do final dump store->_record_allocation_stats(); stop = false; + pcm = nullptr; return NULL; }