From 831c5d91cc3863c8ec6ef76ff71f4b7d237ee089 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Mon, 20 Nov 2017 18:15:39 +0800 Subject: [PATCH] mds: don't decay load counters when printing load Changing load counters while printing load results confusing output. Signed-off-by: "Yan, Zheng" --- src/common/DecayCounter.h | 6 +++--- src/mds/mdstypes.h | 14 +++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/common/DecayCounter.h b/src/common/DecayCounter.h index 620db834f1fe9..5e0e0d3b52dc8 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 b4f080faabc5a..88b8041d56081 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -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 -- 2.39.5