]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: add per-instance new allocator perf counters
authorJaya Prakash <jayaprakash@ibm.com>
Tue, 16 Jun 2026 16:24:41 +0000 (16:24 +0000)
committerJaya Prakash <jayaprakash@ibm.com>
Thu, 25 Jun 2026 10:42:25 +0000 (10:42 +0000)
Fixes: https://tracker.ceph.com/issues/76936
Signed-off-by: Jaya Prakash <jayaprakash@ibm.com>
src/os/bluestore/AllocatorBase.cc
src/os/bluestore/AllocatorBase.h

index 62d78974e278dfcd206551435f0126d93a4725ef..a7c068dcfebe007f577736e522640e7302d56141 100644 (file)
@@ -207,3 +207,31 @@ void AllocatorBase::FreeStateHistogram::foreach(
     ++i;
   }
 }
+void AllocatorPerf::_init_logger(std::string_view name) {
+  PerfCountersBuilder b(cct,
+                        "bluestore-alloc-" + std::string(name),
+                        l_bluestore_allocator_first,
+                        l_bluestore_allocator_last);
+
+  b.add_time_avg(l_bluestore_allocator_alloc_process_lat,
+    "alloc_process_lat",
+    "Allocator processing latency",
+    "apl",
+    PerfCountersBuilder::PRIO_USEFUL);
+  b.add_time_avg(l_bluestore_allocator_lock_wait_lat,
+    "lock_wait_lat",
+    "Allocator lock wait latency",
+    "lwl",
+    PerfCountersBuilder::PRIO_USEFUL);
+
+  logger = b.create_perf_counters();
+
+  cct->get_perfcounters_collection()->add(logger);
+}
+void AllocatorPerf::_shutdown_logger() {
+  if (logger) {
+    cct->get_perfcounters_collection()->remove(logger);
+    delete logger;
+    logger = nullptr;
+  }
+}
index eedf766dc803d373e112ed44fc3e8aeaa5339664..dc567c3c2c9a60ea5941714413dbce6db926a870 100644 (file)
 #include "bluestore_types.h"
 #include "common/ceph_mutex.h"
 #include "Allocator.h"
+#include "common/perf_counters.h"
+#include "common/perf_counters_collection.h"
+
+enum {
+  l_bluestore_allocator_first = 732300,
+  l_bluestore_allocator_alloc_process_lat,
+  l_bluestore_allocator_lock_wait_lat,
+  l_bluestore_allocator_last
+};
 
 class AllocatorBase : public Allocator {
 protected:
@@ -295,4 +304,24 @@ private:
   SocketHook* asok_hook = nullptr;
 };
 
+class AllocatorPerf {
+private:
+  CephContext* cct = nullptr;
+protected:
+  PerfCounters *logger = nullptr;
+public:
+  AllocatorPerf() = delete;
+  AllocatorPerf(CephContext* cct, std::string_view name)
+    : cct(cct)
+  {
+    _init_logger(name);
+  }
+  ~AllocatorPerf() {
+    _shutdown_logger();
+  }
+private:
+  void _init_logger(std::string_view name);
+  void _shutdown_logger();
+};
+
 #endif