From: John Spray Date: Wed, 13 Sep 2017 11:06:24 +0000 (-0400) Subject: common: PerfCountersBuilder helper for priorities X-Git-Tag: v12.2.2~61^2~57 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=278188c76ebdbaaa36b3d185b1378abf7665f3fc;p=ceph.git common: PerfCountersBuilder helper for priorities Let the caller set a priority as the defaul, to enable them to create a bunch at a given priority. This is just a convenience. Signed-off-by: John Spray (cherry picked from commit 66f61eeda6a2465b5fc0e40a4f1300913db065dc) --- diff --git a/src/common/perf_counters.cc b/src/common/perf_counters.cc index d73a1b9ea07a..34c6d5e29428 100644 --- a/src/common/perf_counters.cc +++ b/src/common/perf_counters.cc @@ -547,7 +547,7 @@ void PerfCountersBuilder::add_impl( assert(strlen(nick) <= 4); } data.nick = nick; - data.prio = prio; + data.prio = prio ? prio : prio_default; data.type = (enum perfcounter_type_d)ty; data.histogram = std::move(histogram); } diff --git a/src/common/perf_counters.h b/src/common/perf_counters.h index 8208140d28b6..10cd0450e523 100644 --- a/src/common/perf_counters.h +++ b/src/common/perf_counters.h @@ -318,6 +318,11 @@ public: const char* nick = NULL, int prio=0); + void set_prio_default(int prio_) + { + prio_default = prio_; + } + PerfCounters* create_perf_counters(); private: PerfCountersBuilder(const PerfCountersBuilder &rhs); @@ -327,6 +332,8 @@ private: unique_ptr> histogram = nullptr); PerfCounters *m_perf_counters; + + int prio_default = 0; }; #endif