]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: Update perf_counters.h to work without using namespace
authorAdam C. Emerson <aemerson@redhat.com>
Fri, 29 Mar 2019 01:26:15 +0000 (21:26 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Fri, 29 Mar 2019 14:30:37 +0000 (10:30 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/common/perf_counters.h

index dca8885815ebfdde74dd5353efe936d52e7d624a..8373db75e1ba97bc31a93d5e5bd536382842f035 100644 (file)
@@ -115,7 +115,7 @@ private:
   PerfCountersBuilder& operator=(const PerfCountersBuilder &rhs);
   void add_impl(int idx, const char *name,
                 const char *description, const char *nick, int prio, int ty, int unit=UNIT_NONE,
-                unique_ptr<PerfHistogram<>> histogram = nullptr);
+                std::unique_ptr<PerfHistogram<>> histogram = nullptr);
 
   PerfCounters *m_perf_counters;
 
@@ -166,7 +166,7 @@ public:
         type(other.type),
         unit(other.unit),
         u64(other.u64.load()) {
-      pair<uint64_t,uint64_t> a = other.read_avg();
+      auto a = other.read_avg();
       u64 = a.first;
       avgcount = a.second;
       avgcount2 = a.second;
@@ -201,27 +201,27 @@ public:
     // read <sum, count> safely by making sure the post- and pre-count
     // are identical; in other words the whole loop needs to be run
     // without any intervening calls to inc, set, or tinc.
-    pair<uint64_t,uint64_t> read_avg() const {
+    std::pair<uint64_t,uint64_t> read_avg() const {
       uint64_t sum, count;
       do {
        count = avgcount2;
        sum = u64;
       } while (avgcount != count);
-      return make_pair(sum, count);
+      return { sum, count };
     }
   };
 
   template <typename T>
   struct avg_tracker {
-    pair<uint64_t, T> last;
-    pair<uint64_t, T> cur;
+    std::pair<uint64_t, T> last;
+    std::pair<uint64_t, T> cur;
     avg_tracker() : last(0, 0), cur(0, 0) {}
     T current_avg() const {
       if (cur.first == last.first)
         return 0;
       return (cur.second - last.second) / (cur.first - last.first);
     }
-    void consume_next(const pair<uint64_t, T> &next) {
+    void consume_next(const std::pair<uint64_t, T> &next) {
       last = cur;
       cur = next;
     }
@@ -250,7 +250,7 @@ public:
                                  const std::string &counter = "") {
     dump_formatted_generic(f, schema, true, counter);
   }
-  pair<uint64_t, uint64_t> get_tavg_ns(int idx) const;
+  std::pair<uint64_t, uint64_t> get_tavg_ns(int idx) const;
 
   const std::string& get_name() const;
   void set_name(std::string s) {