++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;
+ }
+}
#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:
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