]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/PriorityCache: Added ability to give custom name to Manager's perf_counters 35176/head
authorAdam Kupczyk <akupczyk@redhat.com>
Wed, 20 May 2020 13:49:06 +0000 (15:49 +0200)
committerAdam Kupczyk <akupczyk@redhat.com>
Thu, 21 May 2020 14:05:55 +0000 (10:05 -0400)
Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
src/common/PriorityCache.cc
src/common/PriorityCache.h
src/os/bluestore/BlueStore.cc

index bb4366b6cc61e9cccaa396d986d2805589658eff..af1fc213f324d4f35728de1f6c6d571de0c6219c 100644 (file)
@@ -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<int>(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",
index 6ac607022414838d32587836fce5bdf3b3129976..362b5477da2f70142bb887517b4e5f18577741ef 100644 (file)
@@ -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;
index 8e10a4476927746a1b8b8d79d08e9a303c7ecb58..fe9554a63a7c82caa6d98cfb3ad728427c467deb 100644 (file)
@@ -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<PriorityCache::Manager>(
-        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;
 }