diff options
author | Xiubo Li <xiubli@redhat.com> | 2020-03-19 23:45:01 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2020-06-01 13:22:51 +0200 |
commit | 97e27aaa9a2cbd6238c66b3251d397e0eacc9968 (patch) | |
tree | cc34ba226bc715dac52a87025351d3ae5e8d1465 /fs/ceph/metric.h | |
parent | 1af16d547f3080d71060092d22e79a34527d1d08 (diff) |
ceph: add read/write latency metric support
Calculate the latency for OSD read requests. Add a new r_end_stamp
field to struct ceph_osd_request that will hold the time of that
the reply was received. Use that to calculate the RTT for each call,
and divide the sum of those by number of calls to get averate RTT.
Keep a tally of RTT for OSD writes and number of calls to track average
latency of OSD writes.
URL: https://tracker.ceph.com/issues/43215
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/metric.h')
-rw-r--r-- | fs/ceph/metric.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/ceph/metric.h b/fs/ceph/metric.h index 098ee8a9adaf..ab1543c70a75 100644 --- a/fs/ceph/metric.h +++ b/fs/ceph/metric.h @@ -4,6 +4,7 @@ #include <linux/types.h> #include <linux/percpu_counter.h> +#include <linux/ktime.h> /* This is the global metrics */ struct ceph_client_metric { @@ -13,6 +14,20 @@ struct ceph_client_metric { struct percpu_counter i_caps_hit; struct percpu_counter i_caps_mis; + + spinlock_t read_latency_lock; + u64 total_reads; + ktime_t read_latency_sum; + ktime_t read_latency_sq_sum; + ktime_t read_latency_min; + ktime_t read_latency_max; + + spinlock_t write_latency_lock; + u64 total_writes; + ktime_t write_latency_sum; + ktime_t write_latency_sq_sum; + ktime_t write_latency_min; + ktime_t write_latency_max; }; extern int ceph_metric_init(struct ceph_client_metric *m); @@ -27,4 +42,11 @@ static inline void ceph_update_cap_mis(struct ceph_client_metric *m) { percpu_counter_inc(&m->i_caps_mis); } + +extern void ceph_update_read_latency(struct ceph_client_metric *m, + ktime_t r_start, ktime_t r_end, + int rc); +extern void ceph_update_write_latency(struct ceph_client_metric *m, + ktime_t r_start, ktime_t r_end, + int rc); #endif /* _FS_CEPH_MDS_METRIC_H */ |