From: Max Kellermann Date: Thu, 14 Aug 2025 08:53:50 +0000 (+0200) Subject: mgr/DaemonHealthMetric: un-inline methods to reduce header dependencies X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=437e8949ea6a4e2f582369266e964beb2e2f2bf8;p=ceph.git mgr/DaemonHealthMetric: un-inline methods to reduce header dependencies Signed-off-by: Max Kellermann --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c0732cb43eef..e323eb92cda2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -537,6 +537,7 @@ set(libcommon_files mon/MonMap.cc mon/MonSub.cc mon/error_code.cc + mgr/DaemonHealthMetric.cc mgr/MgrClient.cc mon/MgrMap.cc mon/PGMap.cc diff --git a/src/mgr/DaemonHealthMetric.cc b/src/mgr/DaemonHealthMetric.cc new file mode 100644 index 000000000000..eb79de9ed5aa --- /dev/null +++ b/src/mgr/DaemonHealthMetric.cc @@ -0,0 +1,27 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#include "DaemonHealthMetric.h" + +#include + +#include "common/Formatter.h" + +void DaemonHealthMetric::dump(ceph::Formatter *f) const { + f->dump_string("type", get_type_name()); + f->dump_int("n", get_n()); + f->dump_int("n1", get_n1()); + f->dump_int("n2", get_n2()); +} + +std::list DaemonHealthMetric::generate_test_instances() { + std::list o; + o.push_back(DaemonHealthMetric(daemon_metric::SLOW_OPS, 1)); + o.push_back(DaemonHealthMetric(daemon_metric::PENDING_CREATING_PGS, 1, 2)); + return o; +} + +std::ostream& operator<<(std::ostream& out, const DaemonHealthMetric& m) { + return out << daemon_metric_name(m.get_type()) << "(" + << m.get_n() << "|(" << m.get_n1() << "," << m.get_n2() << "))"; +} diff --git a/src/mgr/DaemonHealthMetric.h b/src/mgr/DaemonHealthMetric.h index 8081d0a611d2..26381375fb81 100644 --- a/src/mgr/DaemonHealthMetric.h +++ b/src/mgr/DaemonHealthMetric.h @@ -5,11 +5,11 @@ #include #include -#include +#include #include -#include "common/Formatter.h" #include "include/denc.h" -#include "common/Formatter.h" + +namespace ceph { class Formatter; } enum class daemon_metric : uint8_t { SLOW_OPS, @@ -70,26 +70,13 @@ public: denc(v.value.n, p); DENC_FINISH(p); } - void dump(Formatter *f) const { - f->dump_string("type", get_type_name()); - f->dump_int("n", get_n()); - f->dump_int("n1", get_n1()); - f->dump_int("n2", get_n2()); - } - static std::list generate_test_instances() { - std::list o; - o.push_back(DaemonHealthMetric(daemon_metric::SLOW_OPS, 1)); - o.push_back(DaemonHealthMetric(daemon_metric::PENDING_CREATING_PGS, 1, 2)); - return o; - } + void dump(ceph::Formatter *f) const; + static std::list generate_test_instances(); std::string get_type_name() const { return daemon_metric_name(get_type()); } - friend std::ostream& operator<<(std::ostream& out, const DaemonHealthMetric& m) { - return out << daemon_metric_name(m.get_type()) << "(" - << m.get_n() << "|(" << m.get_n1() << "," << m.get_n2() << "))"; - } + friend std::ostream& operator<<(std::ostream& out, const DaemonHealthMetric& m); private: daemon_metric type = daemon_metric::NONE; daemon_metric_t value;