From: Pan Liu Date: Sun, 23 Jul 2017 07:55:47 +0000 (+0800) Subject: common: the latency dumped by "ceph osd perf" is not real X-Git-Tag: v12.1.2~147^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F16512%2Fhead;p=ceph.git common: the latency dumped by "ceph osd perf" is not real Signed-off-by: Pan Liu --- diff --git a/src/common/perf_counters.h b/src/common/perf_counters.h index 5eaa59fb699a..e831b73ad682 100644 --- a/src/common/perf_counters.h +++ b/src/common/perf_counters.h @@ -133,11 +133,9 @@ public: pair last; pair cur; avg_tracker() : last(0, 0), cur(0, 0) {} - T avg() const { + T current_avg() const { if (cur.first == last.first) - return cur.first ? - cur.second / cur.first : - 0; // no change, report avg over all time + return 0; return (cur.second - last.second) / (cur.first - last.first); } void consume_next(const pair &next) { diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index f437d5d68470..890475ead819 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -2357,8 +2357,8 @@ public: objectstore_perf_stat_t get_cur_stats() const { objectstore_perf_stat_t ret; - ret.os_commit_latency = os_commit_latency.avg(); - ret.os_apply_latency = os_apply_latency.avg(); + ret.os_commit_latency = os_commit_latency.current_avg(); + ret.os_apply_latency = os_apply_latency.current_avg(); return ret; } diff --git a/src/os/filestore/FileStore.h b/src/os/filestore/FileStore.h index 020044a03a9d..7f2edb91a033 100644 --- a/src/os/filestore/FileStore.h +++ b/src/os/filestore/FileStore.h @@ -135,8 +135,8 @@ public: objectstore_perf_stat_t get_cur_stats() const { objectstore_perf_stat_t ret; - ret.os_commit_latency = os_commit_latency.avg(); - ret.os_apply_latency = os_apply_latency.avg(); + ret.os_commit_latency = os_commit_latency.current_avg(); + ret.os_apply_latency = os_apply_latency.current_avg(); return ret; }