]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: PerfCountersBuilder helper for priorities
authorJohn Spray <john.spray@redhat.com>
Wed, 13 Sep 2017 11:06:24 +0000 (07:06 -0400)
committerJohn Spray <john.spray@redhat.com>
Wed, 1 Nov 2017 23:03:25 +0000 (23:03 +0000)
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 <john.spray@redhat.com>
(cherry picked from commit 66f61eeda6a2465b5fc0e40a4f1300913db065dc)

src/common/perf_counters.cc
src/common/perf_counters.h

index d73a1b9ea07afe35f9f06a8cd09c39b5b53c3b8f..34c6d5e29428633eead8975eaf7607d928fd04f2 100644 (file)
@@ -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);
 }
index 8208140d28b617e183802bab4ea70d066c7a5225..10cd0450e5230c9c6e151d9b273b9e12554d8c40 100644 (file)
@@ -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<PerfHistogram<>> histogram = nullptr);
 
   PerfCounters *m_perf_counters;
+
+  int prio_default = 0;
 };
 
 #endif