summaryrefslogtreecommitdiffstats
path: root/src/mgr/OSDPerfMetricCollector.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/mgr/OSDPerfMetricCollector.h
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/mgr/OSDPerfMetricCollector.h')
-rw-r--r--src/mgr/OSDPerfMetricCollector.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/mgr/OSDPerfMetricCollector.h b/src/mgr/OSDPerfMetricCollector.h
new file mode 100644
index 00000000..89e33091
--- /dev/null
+++ b/src/mgr/OSDPerfMetricCollector.h
@@ -0,0 +1,55 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef OSD_PERF_METRIC_COLLECTOR_H_
+#define OSD_PERF_METRIC_COLLECTOR_H_
+
+#include "common/Mutex.h"
+
+#include "mgr/OSDPerfMetricTypes.h"
+
+#include <map>
+
+/**
+ * OSD performance query class.
+ */
+class OSDPerfMetricCollector {
+public:
+ struct Listener {
+ virtual ~Listener() {
+ }
+
+ virtual void handle_query_updated() = 0;
+ };
+
+ OSDPerfMetricCollector(Listener &listener);
+
+ std::map<OSDPerfMetricQuery, OSDPerfMetricLimits> get_queries() const;
+
+ OSDPerfMetricQueryID add_query(
+ const OSDPerfMetricQuery& query,
+ const std::optional<OSDPerfMetricLimit> &limit);
+ int remove_query(OSDPerfMetricQueryID query_id);
+ void remove_all_queries();
+
+ int get_counters(OSDPerfMetricQueryID query_id,
+ std::map<OSDPerfMetricKey, PerformanceCounters> *counters);
+
+ void process_reports(
+ const std::map<OSDPerfMetricQuery, OSDPerfMetricReport> &reports);
+
+private:
+ typedef std::optional<OSDPerfMetricLimit> OptionalLimit;
+ typedef std::map<OSDPerfMetricQuery,
+ std::map<OSDPerfMetricQueryID, OptionalLimit>> Queries;
+ typedef std::map<OSDPerfMetricQueryID,
+ std::map<OSDPerfMetricKey, PerformanceCounters>> Counters;
+
+ Listener &listener;
+ mutable Mutex lock;
+ OSDPerfMetricQueryID next_query_id = 0;
+ Queries queries;
+ Counters counters;
+};
+
+#endif // OSD_PERF_METRIC_COLLECTOR_H_