]>
Commit | Line | Data |
---|---|---|
f9009efa XL |
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef _FS_CEPH_MDS_METRIC_H | |
3 | #define _FS_CEPH_MDS_METRIC_H | |
4 | ||
5 | #include <linux/types.h> | |
6 | #include <linux/percpu_counter.h> | |
97e27aaa | 7 | #include <linux/ktime.h> |
f9009efa XL |
8 | |
9 | /* This is the global metrics */ | |
10 | struct ceph_client_metric { | |
11 | atomic64_t total_dentries; | |
12 | struct percpu_counter d_lease_hit; | |
13 | struct percpu_counter d_lease_mis; | |
1af16d54 | 14 | |
4f1d756d | 15 | atomic64_t total_caps; |
1af16d54 XL |
16 | struct percpu_counter i_caps_hit; |
17 | struct percpu_counter i_caps_mis; | |
97e27aaa XL |
18 | |
19 | spinlock_t read_latency_lock; | |
20 | u64 total_reads; | |
21 | ktime_t read_latency_sum; | |
22 | ktime_t read_latency_sq_sum; | |
23 | ktime_t read_latency_min; | |
24 | ktime_t read_latency_max; | |
25 | ||
26 | spinlock_t write_latency_lock; | |
27 | u64 total_writes; | |
28 | ktime_t write_latency_sum; | |
29 | ktime_t write_latency_sq_sum; | |
30 | ktime_t write_latency_min; | |
31 | ktime_t write_latency_max; | |
70c94820 XL |
32 | |
33 | spinlock_t metadata_latency_lock; | |
34 | u64 total_metadatas; | |
35 | ktime_t metadata_latency_sum; | |
36 | ktime_t metadata_latency_sq_sum; | |
37 | ktime_t metadata_latency_min; | |
38 | ktime_t metadata_latency_max; | |
f9009efa XL |
39 | }; |
40 | ||
41 | extern int ceph_metric_init(struct ceph_client_metric *m); | |
42 | extern void ceph_metric_destroy(struct ceph_client_metric *m); | |
1af16d54 XL |
43 | |
44 | static inline void ceph_update_cap_hit(struct ceph_client_metric *m) | |
45 | { | |
46 | percpu_counter_inc(&m->i_caps_hit); | |
47 | } | |
48 | ||
49 | static inline void ceph_update_cap_mis(struct ceph_client_metric *m) | |
50 | { | |
51 | percpu_counter_inc(&m->i_caps_mis); | |
52 | } | |
97e27aaa XL |
53 | |
54 | extern void ceph_update_read_latency(struct ceph_client_metric *m, | |
55 | ktime_t r_start, ktime_t r_end, | |
56 | int rc); | |
57 | extern void ceph_update_write_latency(struct ceph_client_metric *m, | |
58 | ktime_t r_start, ktime_t r_end, | |
59 | int rc); | |
70c94820 XL |
60 | extern void ceph_update_metadata_latency(struct ceph_client_metric *m, |
61 | ktime_t r_start, ktime_t r_end, | |
62 | int rc); | |
f9009efa | 63 | #endif /* _FS_CEPH_MDS_METRIC_H */ |