From: Yan, Zheng Date: Mon, 20 Nov 2017 10:15:39 +0000 (+0800) Subject: mds: don't decay load counters when printing load X-Git-Tag: v12.2.6~41^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F21412%2Fhead;p=ceph.git mds: don't decay load counters when printing load Changing load counters while printing load results confusing output. Signed-off-by: "Yan, Zheng" (cherry picked from commit 831c5d91cc3863c8ec6ef76ff71f4b7d237ee089) --- diff --git a/src/common/DecayCounter.h b/src/common/DecayCounter.h index e45aed8d2f2a..4addb1ce34e7 100644 --- a/src/common/DecayCounter.h +++ b/src/common/DecayCounter.h @@ -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; } diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index eaaa36caf349..cd9164927ccd 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -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