]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't decay load counters when printing load
authorYan, Zheng <zyan@redhat.com>
Mon, 20 Nov 2017 10:15:39 +0000 (18:15 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 10 Apr 2018 01:19:46 +0000 (09:19 +0800)
Changing load counters while printing load results confusing output.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/common/DecayCounter.h
src/mds/mdstypes.h

index 620db834f1fe97be65ee8a298d5a1c3f7e051aeb..5e0e0d3b52dc8c7fd53f4740f1a40244fa7dfa29 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 b4f080faabc5ad90de6ce6469ce77276d5752a56..88b8041d56081a7f93bbe47b2cac9b69cc716ec6 100644 (file)
@@ -1502,7 +1502,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() +
@@ -1535,14 +1535,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() << "]";
 }
 
 
@@ -1586,7 +1582,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