]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/inc/ocf_stats_builder.h
bump version to 15.2.11-pve1
[ceph.git] / ceph / src / spdk / ocf / inc / ocf_stats_builder.h
1 /*
2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
4 */
5
6 /**
7 * @file
8 * @brief OCF API for collecting statistics
9 *
10 * This file contains routines pertaining to retrieval and
11 * manipulation of OCF IO statistics.
12 */
13
14 #ifndef __OCF_STATS_BUILDER_H__
15 #define __OCF_STATS_BUILDER_H__
16
17 /**
18 * Entire row of statistcs
19 */
20 struct ocf_stat {
21 /** Value */
22 uint64_t value;
23 /** percent x10 */
24 uint64_t percent;
25 };
26
27 /**
28 * @brief Usage statistics in 4 KiB unit
29 *
30 * An example of presenting statistics:
31 * <pre>
32 * ╔══════════════════╤══════════╤═══════╤═════════════╗
33 * ║ Usage statistics │ Count │ % │ Units ║
34 * ╠══════════════════╪══════════╪═══════╪═════════════╣
35 * ║ Occupancy │ 20 │ 50.0 │ 4KiB blocks ║
36 * ║ Free │ 20 │ 50.0 │ 4KiB blocks ║
37 * ║ Clean │ 15 │ 75.0 │ 4KiB blocks ║
38 * ║ Dirty │ 5 │ 25.0 │ 4KiB blocks ║
39 * ╚══════════════════╧══════════╧═══════╧═════════════╝
40 * </pre>
41 */
42 struct ocf_stats_usage {
43 struct ocf_stat occupancy;
44 struct ocf_stat free;
45 struct ocf_stat clean;
46 struct ocf_stat dirty;
47 };
48
49 /**
50 * @brief Requests statistcs
51 *
52 * An example of presenting statistics:
53 * <pre>
54 * ╔══════════════════════╤═══════╤═══════╤══════════╗
55 * ║ Request statistics │ Count │ % │ Units ║
56 * ╠══════════════════════╪═══════╪═══════╪══════════╣
57 * ║ Read hits │ 10 │ 4.5 │ Requests ║
58 * ║ Read partial misses │ 1 │ 0.5 │ Requests ║
59 * ║ Read full misses │ 211 │ 95.0 │ Requests ║
60 * ║ Read total │ 222 │ 100.0 │ Requests ║
61 * ╟──────────────────────┼───────┼───────┼──────────╢
62 * ║ Write hits │ 0 │ 0.0 │ Requests ║
63 * ║ Write partial misses │ 0 │ 0.0 │ Requests ║
64 * ║ Write full misses │ 0 │ 0.0 │ Requests ║
65 * ║ Write total │ 0 │ 0.0 │ Requests ║
66 * ╟──────────────────────┼───────┼───────┼──────────╢
67 * ║ Pass-Through reads │ 0 │ 0.0 │ Requests ║
68 * ║ Pass-Through writes │ 0 │ 0.0 │ Requests ║
69 * ║ Serviced requests │ 222 │ 100.0 │ Requests ║
70 * ╟──────────────────────┼───────┼───────┼──────────╢
71 * ║ Total requests │ 222 │ 100.0 │ Requests ║
72 * ╚══════════════════════╧═══════╧═══════╧══════════╝
73 * </pre>
74 */
75 struct ocf_stats_requests {
76 struct ocf_stat rd_hits;
77 struct ocf_stat rd_partial_misses;
78 struct ocf_stat rd_full_misses;
79 struct ocf_stat rd_total;
80 struct ocf_stat wr_hits;
81 struct ocf_stat wr_partial_misses;
82 struct ocf_stat wr_full_misses;
83 struct ocf_stat wr_total;
84 struct ocf_stat rd_pt;
85 struct ocf_stat wr_pt;
86 struct ocf_stat serviced;
87 struct ocf_stat total;
88 };
89
90 /**
91 * @brief Block statistics
92 *
93 * An example of presenting statistics:
94 * <pre>
95 * ╔════════════════════════════════════╤═══════╤═══════╤═════════════╗
96 * ║ Block statistics │ Count │ % │ Units ║
97 * ╠════════════════════════════════════╪═══════╪═══════╪═════════════╣
98 * ║ Reads from core volume(s) │ 426 │ 100.0 │ 4KiB blocks ║
99 * ║ Writes to core volume(s) │ 0 │ 0.0 │ 4KiB blocks ║
100 * ║ Total to/from core volume (s) │ 426 │ 100.0 │ 4KiB blocks ║
101 * ╟────────────────────────────────────┼───────┼───────┼─────────────╢
102 * ║ Reads from cache volume │ 13 │ 3.0 │ 4KiB blocks ║
103 * ║ Writes to cache volume │ 426 │ 97.0 │ 4KiB blocks ║
104 * ║ Total to/from cache volume │ 439 │ 100.0 │ 4KiB blocks ║
105 * ╟────────────────────────────────────┼───────┼───────┼─────────────╢
106 * ║ Reads from core(s) │ 439 │ 100.0 │ 4KiB blocks ║
107 * ║ Writes to core(s) │ 0 │ 0.0 │ 4KiB blocks ║
108 * ║ Total to/from core(s) │ 439 │ 100.0 │ 4KiB blocks ║
109 * ╚════════════════════════════════════╧═══════╧═══════╧═════════════╝
110 * </pre>
111 */
112 struct ocf_stats_blocks {
113 struct ocf_stat core_volume_rd;
114 struct ocf_stat core_volume_wr;
115 struct ocf_stat core_volume_total;
116 struct ocf_stat cache_volume_rd;
117 struct ocf_stat cache_volume_wr;
118 struct ocf_stat cache_volume_total;
119 struct ocf_stat volume_rd;
120 struct ocf_stat volume_wr;
121 struct ocf_stat volume_total;
122 };
123
124 /**
125 * @brief Errors statistics
126 *
127 * An example of presenting statistics:
128 * <pre>
129 * ╔════════════════════╤═══════╤═════╤══════════╗
130 * ║ Error statistics │ Count │ % │ Units ║
131 * ╠════════════════════╪═══════╪═════╪══════════╣
132 * ║ Cache read errors │ 0 │ 0.0 │ Requests ║
133 * ║ Cache write errors │ 0 │ 0.0 │ Requests ║
134 * ║ Cache total errors │ 0 │ 0.0 │ Requests ║
135 * ╟────────────────────┼───────┼─────┼──────────╢
136 * ║ Core read errors │ 0 │ 0.0 │ Requests ║
137 * ║ Core write errors │ 0 │ 0.0 │ Requests ║
138 * ║ Core total errors │ 0 │ 0.0 │ Requests ║
139 * ╟────────────────────┼───────┼─────┼──────────╢
140 * ║ Total errors │ 0 │ 0.0 │ Requests ║
141 * ╚════════════════════╧═══════╧═════╧══════════╝
142 * </pre>
143 */
144 struct ocf_stats_errors {
145 struct ocf_stat core_volume_rd;
146 struct ocf_stat core_volume_wr;
147 struct ocf_stat core_volume_total;
148 struct ocf_stat cache_volume_rd;
149 struct ocf_stat cache_volume_wr;
150 struct ocf_stat cache_volume_total;
151 struct ocf_stat total;
152 };
153
154 /**
155 * @param Collect statistics for given cache
156 *
157 * @param cache Cache instance for each statistics will be collected
158 * @param usage Usage statistics
159 * @param req Request statistics
160 * @param blocks Blocks statistics
161 * @param errors Errors statistics
162 *
163 * @retval 0 Success
164 * @retval Non-zero Error
165 */
166 int ocf_stats_collect_cache(ocf_cache_t cache,
167 struct ocf_stats_usage *usage,
168 struct ocf_stats_requests *req,
169 struct ocf_stats_blocks *blocks,
170 struct ocf_stats_errors *errors);
171
172 /**
173 * @param Collect statistics for given core
174 *
175 * @param cache Core for each statistics will be collected
176 * @param usage Usage statistics
177 * @param req Request statistics
178 * @param blocks Blocks statistics
179 * @param errors Errors statistics
180 *
181 * @retval 0 Success
182 * @retval Non-zero Error
183 */
184 int ocf_stats_collect_core(ocf_core_t core,
185 struct ocf_stats_usage *usage,
186 struct ocf_stats_requests *req,
187 struct ocf_stats_blocks *blocks,
188 struct ocf_stats_errors *errors);
189
190 #endif /* __OCF_STATS_BUILDER_H__ */