]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't decay load counters when printing load 21412/head
authorYan, Zheng <zyan@redhat.com>
Mon, 20 Nov 2017 10:15:39 +0000 (18:15 +0800)
committerYan, Zheng <zyan@redhat.com>
Sat, 2 Jun 2018 14:49:39 +0000 (22:49 +0800)
Changing load counters while printing load results confusing output.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 831c5d91cc3863c8ec6ef76ff71f4b7d237ee089)

src/common/DecayCounter.h
src/mds/mdstypes.h

index e45aed8d2f2a5f590859898a2928e7e188fdba7f..4addb1ce34e7864ae8769689766e3c6f0c8299cd 100644 (file)
@@ -86,15 +86,15 @@ public:
     return val+delta;
   }
 
-  double get_last() {
+  double get_last() const {
     return val;
   }
   
-  double get_last_vel() {
+  double get_last_vel() const {
     return vel;
   }
 
-  utime_t get_last_decay() 
+  utime_t get_last_decay() const {
     return last_decay; 
   }
 
index eaaa36caf349dd32d0504c33aa5101154b60456c..cd9164927ccd8d380573526098277180bd75c851 100644 (file)
@@ -1491,7 +1491,7 @@ public:
       2*vec[META_POP_FETCH].get(now, rate) +
       4*vec[META_POP_STORE].get(now, rate);
   }
-  double meta_load() {
+  double meta_load() const {
     return 
       1*vec[META_POP_IRD].get_last() + 
       2*vec[META_POP_IWR].get_last() +
@@ -1524,14 +1524,10 @@ inline void decode(dirfrag_load_vec_t& c, bufferlist::iterator &p) {
   c.decode(sample, p);
 }
 
-inline std::ostream& operator<<(std::ostream& out, dirfrag_load_vec_t& dl)
+inline std::ostream& operator<<(std::ostream& out, const dirfrag_load_vec_t& dl)
 {
-  // ugliness!
-  utime_t now = ceph_clock_now();
-  DecayRate rate(g_conf->mds_decay_halflife);
-  return out << "[" << dl.vec[0].get(now, rate) << "," << dl.vec[1].get(now, rate) 
-            << " " << dl.meta_load(now, rate)
-            << "]";
+  return out << "[" << dl.vec[0].get_last() << "," << dl.vec[1].get_last()
+            << " " << dl.meta_load() << "]";
 }
 
 
@@ -1575,7 +1571,7 @@ inline void decode(mds_load_t &c, bufferlist::iterator &p) {
   c.decode(sample, p);
 }
 
-inline std::ostream& operator<<( std::ostream& out, mds_load_t& load )
+inline std::ostream& operator<<(std::ostream& out, const mds_load_t& load)
 {
   return out << "mdsload<" << load.auth << "/" << load.all
              << ", req " << load.req_rate