From 67991e1f6f7ad92ae86e279efe68c6a1963d915c Mon Sep 17 00:00:00 2001 From: Pan Liu Date: Sun, 23 Jul 2017 15:55:47 +0800 Subject: [PATCH] common: the latency dumped by "ceph osd perf" is not real Signed-off-by: Pan Liu --- src/common/perf_counters.h | 6 ++---- src/os/bluestore/BlueStore.h | 4 ++-- src/os/filestore/FileStore.h | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) 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; } -- 2.47.3