| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #include "zfs_common.h" |
| 4 | |
| 5 | struct arcstats arcstats = { 0 }; |
| 6 | |
| 7 | void generate_charts_arcstats(const char *plugin, const char *module, int update_every) { |
| 8 | static int do_arc_size = -1, do_l2_size = -1, do_reads = -1, do_l2bytes = -1, do_ahits = -1, do_dhits = -1, \ |
| 9 | do_phits = -1, do_mhits = -1, do_l2hits = -1, do_list_hits = -1; |
| 10 | |
| 11 | if (unlikely(do_arc_size == -1)) |
| 12 | do_arc_size = do_l2_size = do_reads = do_l2bytes = do_ahits = do_dhits = do_phits = do_mhits = do_l2hits = |
| 13 | do_list_hits = 1; |
| 14 | |
| 15 | // ARC reads |
| 16 | unsigned long long aread = arcstats.hits + arcstats.misses; |
| 17 | |
| 18 | // Demand reads |
| 19 | unsigned long long dhit = arcstats.demand_data_hits + arcstats.demand_metadata_hits; |
| 20 | unsigned long long dmiss = arcstats.demand_data_misses + arcstats.demand_metadata_misses; |
| 21 | unsigned long long dread = dhit + dmiss; |
| 22 | |
| 23 | // Prefetch reads |
| 24 | unsigned long long phit = arcstats.prefetch_data_hits + arcstats.prefetch_metadata_hits; |
| 25 | unsigned long long pmiss = arcstats.prefetch_data_misses + arcstats.prefetch_metadata_misses; |
| 26 | unsigned long long pread = phit + pmiss; |
| 27 | |
| 28 | // Metadata reads |
| 29 | unsigned long long mhit = arcstats.prefetch_metadata_hits + arcstats.demand_metadata_hits; |
| 30 | unsigned long long mmiss = arcstats.prefetch_metadata_misses + arcstats.demand_metadata_misses; |
| 31 | unsigned long long mread = mhit + mmiss; |
| 32 | |
| 33 | // l2 reads |
| 34 | unsigned long long l2hit = arcstats.l2_hits; |
| 35 | unsigned long long l2miss = arcstats.l2_misses; |
| 36 | unsigned long long l2read = l2hit + l2miss; |
| 37 | |
| 38 | // -------------------------------------------------------------------- |
| 39 | |
| 40 | if(do_arc_size == CONFIG_BOOLEAN_YES || arcstats.size || arcstats.c || arcstats.c_min || arcstats.c_max) { |
| 41 | do_arc_size = CONFIG_BOOLEAN_YES; |
| 42 | |
| 43 | static RRDSET *st_arc_size = NULL; |
| 44 | static RRDDIM *rd_arc_size = NULL; |
| 45 | static RRDDIM *rd_arc_target_size = NULL; |
| 46 | static RRDDIM *rd_arc_target_min_size = NULL; |
| 47 | static RRDDIM *rd_arc_target_max_size = NULL; |
| 48 | |
| 49 | if (unlikely(!st_arc_size)) { |
| 50 | st_arc_size = rrdset_create_localhost( |
| 51 | "zfs" |
| 52 | , "arc_size" |
| 53 | , NULL |
| 54 | , ZFS_FAMILY_SIZE |
| 55 | , NULL |
| 56 | , "ZFS ARC Size" |
| 57 | , "MiB" |
| 58 | , plugin |
| 59 | , module |
| 60 | , NETDATA_CHART_PRIO_ZFS_ARC_SIZE |
| 61 | , update_every |
| 62 | , RRDSET_TYPE_AREA |
| 63 | ); |
| 64 | |
| 65 | rd_arc_size = rrddim_add(st_arc_size, "size", "arcsz", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); |
| 66 | rd_arc_target_size = rrddim_add(st_arc_size, "target", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); |
| 67 | rd_arc_target_min_size = rrddim_add(st_arc_size, "min", "min (hard limit)", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); |
| 68 | rd_arc_target_max_size = rrddim_add(st_arc_size, "max", "max (high water)", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); |
| 69 | } |
| 70 | |
| 71 | rrddim_set_by_pointer(st_arc_size, rd_arc_size, arcstats.size); |
| 72 | rrddim_set_by_pointer(st_arc_size, rd_arc_target_size, arcstats.c); |
| 73 | rrddim_set_by_pointer(st_arc_size, rd_arc_target_min_size, arcstats.c_min); |
| 74 | rrddim_set_by_pointer(st_arc_size, rd_arc_target_max_size, arcstats.c_max); |
| 75 | rrdset_done(st_arc_size); |
| 76 | } |
| 77 | |
| 78 | // -------------------------------------------------------------------- |
| 79 | |
| 80 | if(likely(arcstats.l2exist) && (do_l2_size == CONFIG_BOOLEAN_YES || arcstats.l2_size || arcstats.l2_asize)) { |
| 81 | do_l2_size = CONFIG_BOOLEAN_YES; |
| 82 | |
| 83 | static RRDSET *st_l2_size = NULL; |
| 84 | static RRDDIM *rd_l2_size = NULL; |
| 85 | static RRDDIM *rd_l2_asize = NULL; |
| 86 | |
| 87 | if (unlikely(!st_l2_size)) { |
| 88 | st_l2_size = rrdset_create_localhost( |
| 89 | "zfs" |
| 90 | , "l2_size" |
| 91 | , NULL |
| 92 | , ZFS_FAMILY_SIZE |
| 93 | , NULL |
| 94 | , "ZFS L2 ARC Size" |
| 95 | , "MiB" |
| 96 | , plugin |
| 97 | , module |
| 98 | , NETDATA_CHART_PRIO_ZFS_L2_SIZE |
| 99 | , update_every |
| 100 | , RRDSET_TYPE_AREA |
| 101 | ); |
| 102 | |
| 103 | rd_l2_asize = rrddim_add(st_l2_size, "actual", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); |
| 104 | rd_l2_size = rrddim_add(st_l2_size, "size", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); |
| 105 | } |
| 106 | |
| 107 | rrddim_set_by_pointer(st_l2_size, rd_l2_size, arcstats.l2_size); |
| 108 | rrddim_set_by_pointer(st_l2_size, rd_l2_asize, arcstats.l2_asize); |
| 109 | rrdset_done(st_l2_size); |
| 110 | } |
| 111 | |
| 112 | // -------------------------------------------------------------------- |
| 113 | |
| 114 | if(likely(do_reads == CONFIG_BOOLEAN_YES || aread || dread || pread || mread || l2read)) { |
| 115 | do_reads = CONFIG_BOOLEAN_YES; |
| 116 | |
| 117 | static RRDSET *st_reads = NULL; |
| 118 | static RRDDIM *rd_aread = NULL; |
| 119 | static RRDDIM *rd_dread = NULL; |
| 120 | static RRDDIM *rd_pread = NULL; |
| 121 | static RRDDIM *rd_mread = NULL; |
| 122 | static RRDDIM *rd_l2read = NULL; |
| 123 | |
| 124 | if (unlikely(!st_reads)) { |
| 125 | st_reads = rrdset_create_localhost( |
| 126 | "zfs" |
| 127 | , "reads" |
| 128 | , NULL |
| 129 | , ZFS_FAMILY_ACCESSES |
| 130 | , NULL |
| 131 | , "ZFS Reads" |
| 132 | , "reads/s" |
| 133 | , plugin |
| 134 | , module |
| 135 | , NETDATA_CHART_PRIO_ZFS_READS |
| 136 | , update_every |
| 137 | , RRDSET_TYPE_AREA |
| 138 | ); |
| 139 | |
| 140 | rd_aread = rrddim_add(st_reads, "areads", "arc", 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 141 | rd_dread = rrddim_add(st_reads, "dreads", "demand", 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 142 | rd_pread = rrddim_add(st_reads, "preads", "prefetch", 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 143 | rd_mread = rrddim_add(st_reads, "mreads", "metadata", 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 144 | |
| 145 | if(arcstats.l2exist) |
| 146 | rd_l2read = rrddim_add(st_reads, "l2reads", "l2", 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 147 | } |
| 148 | |
| 149 | rrddim_set_by_pointer(st_reads, rd_aread, aread); |
| 150 | rrddim_set_by_pointer(st_reads, rd_dread, dread); |
| 151 | rrddim_set_by_pointer(st_reads, rd_pread, pread); |
| 152 | rrddim_set_by_pointer(st_reads, rd_mread, mread); |
| 153 | |
| 154 | if(arcstats.l2exist) |
| 155 | rrddim_set_by_pointer(st_reads, rd_l2read, l2read); |
| 156 | |
| 157 | rrdset_done(st_reads); |
| 158 | } |
| 159 | |
| 160 | // -------------------------------------------------------------------- |
| 161 | |
| 162 | if(likely(arcstats.l2exist && (do_l2bytes == CONFIG_BOOLEAN_YES || arcstats.l2_read_bytes || arcstats.l2_write_bytes))) { |
| 163 | do_l2bytes = CONFIG_BOOLEAN_YES; |
| 164 | |
| 165 | static RRDSET *st_l2bytes = NULL; |
| 166 | static RRDDIM *rd_l2_read_bytes = NULL; |
| 167 | static RRDDIM *rd_l2_write_bytes = NULL; |
| 168 | |
| 169 | if (unlikely(!st_l2bytes)) { |
| 170 | st_l2bytes = rrdset_create_localhost( |
| 171 | "zfs" |
| 172 | , "bytes" |
| 173 | , NULL |
| 174 | , ZFS_FAMILY_ACCESSES |
| 175 | , NULL |
| 176 | , "ZFS ARC L2 Read/Write Rate" |
| 177 | , "KiB/s" |
| 178 | , plugin |
| 179 | , module |
| 180 | , NETDATA_CHART_PRIO_ZFS_IO |
| 181 | , update_every |
| 182 | , RRDSET_TYPE_AREA |
| 183 | ); |
| 184 | |
| 185 | rd_l2_read_bytes = rrddim_add(st_l2bytes, "read", NULL, 1, 1024, RRD_ALGORITHM_INCREMENTAL); |
| 186 | rd_l2_write_bytes = rrddim_add(st_l2bytes, "write", NULL, -1, 1024, RRD_ALGORITHM_INCREMENTAL); |
| 187 | } |
| 188 | |
| 189 | rrddim_set_by_pointer(st_l2bytes, rd_l2_read_bytes, arcstats.l2_read_bytes); |
| 190 | rrddim_set_by_pointer(st_l2bytes, rd_l2_write_bytes, arcstats.l2_write_bytes); |
| 191 | rrdset_done(st_l2bytes); |
| 192 | } |
| 193 | |
| 194 | // -------------------------------------------------------------------- |
| 195 | |
| 196 | if(likely(do_ahits == CONFIG_BOOLEAN_YES || arcstats.hits || arcstats.misses)) { |
| 197 | do_ahits = CONFIG_BOOLEAN_YES; |
| 198 | |
| 199 | static RRDSET *st_ahits = NULL; |
| 200 | static RRDDIM *rd_ahits = NULL; |
| 201 | static RRDDIM *rd_amisses = NULL; |
| 202 | |
| 203 | if (unlikely(!st_ahits)) { |
| 204 | st_ahits = rrdset_create_localhost( |
| 205 | "zfs" |
| 206 | , "hits" |
| 207 | , NULL |
| 208 | , ZFS_FAMILY_EFFICIENCY |
| 209 | , NULL |
| 210 | , "ZFS ARC Hits" |
| 211 | , "percentage" |
| 212 | , plugin |
| 213 | , module |
| 214 | , NETDATA_CHART_PRIO_ZFS_HITS |
| 215 | , update_every |
| 216 | , RRDSET_TYPE_STACKED |
| 217 | ); |
| 218 | |
| 219 | rd_ahits = rrddim_add(st_ahits, "hits", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 220 | rd_amisses = rrddim_add(st_ahits, "misses", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 221 | } |
| 222 | |
| 223 | rrddim_set_by_pointer(st_ahits, rd_ahits, arcstats.hits); |
| 224 | rrddim_set_by_pointer(st_ahits, rd_amisses, arcstats.misses); |
| 225 | rrdset_done(st_ahits); |
| 226 | |
| 227 | static RRDSET *st_ahits_rate = NULL; |
| 228 | static RRDDIM *rd_ahits_rate = NULL; |
| 229 | static RRDDIM *rd_amisses_rate = NULL; |
| 230 | |
| 231 | if (unlikely(!st_ahits_rate)) { |
| 232 | st_ahits_rate = rrdset_create_localhost( |
| 233 | "zfs" |
| 234 | , "hits_rate" |
| 235 | , NULL |
| 236 | , ZFS_FAMILY_EFFICIENCY |
| 237 | , NULL |
| 238 | , "ZFS ARC Hits Rate" |
| 239 | , "events/s" |
| 240 | , plugin |
| 241 | , module |
| 242 | , NETDATA_CHART_PRIO_ZFS_HITS + 1 |
| 243 | , update_every |
| 244 | , RRDSET_TYPE_STACKED |
| 245 | ); |
| 246 | |
| 247 | rd_ahits_rate = rrddim_add(st_ahits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 248 | rd_amisses_rate = rrddim_add(st_ahits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 249 | } |
| 250 | |
| 251 | rrddim_set_by_pointer(st_ahits_rate, rd_ahits_rate, arcstats.hits); |
| 252 | rrddim_set_by_pointer(st_ahits_rate, rd_amisses_rate, arcstats.misses); |
| 253 | rrdset_done(st_ahits_rate); |
| 254 | } |
| 255 | |
| 256 | // -------------------------------------------------------------------- |
| 257 | |
| 258 | if(likely(do_dhits == CONFIG_BOOLEAN_YES || dhit || dmiss)) { |
| 259 | do_dhits = CONFIG_BOOLEAN_YES; |
| 260 | |
| 261 | static RRDSET *st_dhits = NULL; |
| 262 | static RRDDIM *rd_dhits = NULL; |
| 263 | static RRDDIM *rd_dmisses = NULL; |
| 264 | |
| 265 | if (unlikely(!st_dhits)) { |
| 266 | st_dhits = rrdset_create_localhost( |
| 267 | "zfs" |
| 268 | , "dhits" |
| 269 | , NULL |
| 270 | , ZFS_FAMILY_EFFICIENCY |
| 271 | , NULL |
| 272 | , "ZFS Demand Hits" |
| 273 | , "percentage" |
| 274 | , plugin |
| 275 | , module |
| 276 | , NETDATA_CHART_PRIO_ZFS_DHITS |
| 277 | , update_every |
| 278 | , RRDSET_TYPE_STACKED |
| 279 | ); |
| 280 | |
| 281 | rd_dhits = rrddim_add(st_dhits, "hits", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 282 | rd_dmisses = rrddim_add(st_dhits, "misses", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 283 | } |
| 284 | |
| 285 | rrddim_set_by_pointer(st_dhits, rd_dhits, dhit); |
| 286 | rrddim_set_by_pointer(st_dhits, rd_dmisses, dmiss); |
| 287 | rrdset_done(st_dhits); |
| 288 | |
| 289 | static RRDSET *st_dhits_rate = NULL; |
| 290 | static RRDDIM *rd_dhits_rate = NULL; |
| 291 | static RRDDIM *rd_dmisses_rate = NULL; |
| 292 | |
| 293 | if (unlikely(!st_dhits_rate)) { |
| 294 | st_dhits_rate = rrdset_create_localhost( |
| 295 | "zfs" |
| 296 | , "dhits_rate" |
| 297 | , NULL |
| 298 | , ZFS_FAMILY_EFFICIENCY |
| 299 | , NULL |
| 300 | , "ZFS Demand Hits Rate" |
| 301 | , "events/s" |
| 302 | , plugin |
| 303 | , module |
| 304 | , NETDATA_CHART_PRIO_ZFS_DHITS + 1 |
| 305 | , update_every |
| 306 | , RRDSET_TYPE_STACKED |
| 307 | ); |
| 308 | |
| 309 | rd_dhits_rate = rrddim_add(st_dhits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 310 | rd_dmisses_rate = rrddim_add(st_dhits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 311 | } |
| 312 | |
| 313 | rrddim_set_by_pointer(st_dhits_rate, rd_dhits_rate, dhit); |
| 314 | rrddim_set_by_pointer(st_dhits_rate, rd_dmisses_rate, dmiss); |
| 315 | rrdset_done(st_dhits_rate); |
| 316 | } |
| 317 | |
| 318 | // -------------------------------------------------------------------- |
| 319 | |
| 320 | if(likely(do_phits == CONFIG_BOOLEAN_YES || phit || pmiss)) { |
| 321 | do_phits = CONFIG_BOOLEAN_YES; |
| 322 | |
| 323 | static RRDSET *st_phits = NULL; |
| 324 | static RRDDIM *rd_phits = NULL; |
| 325 | static RRDDIM *rd_pmisses = NULL; |
| 326 | |
| 327 | if (unlikely(!st_phits)) { |
| 328 | st_phits = rrdset_create_localhost( |
| 329 | "zfs" |
| 330 | , "phits" |
| 331 | , NULL |
| 332 | , ZFS_FAMILY_EFFICIENCY |
| 333 | , NULL |
| 334 | , "ZFS Prefetch Hits" |
| 335 | , "percentage" |
| 336 | , plugin |
| 337 | , module |
| 338 | , NETDATA_CHART_PRIO_ZFS_PHITS |
| 339 | , update_every |
| 340 | , RRDSET_TYPE_STACKED |
| 341 | ); |
| 342 | |
| 343 | rd_phits = rrddim_add(st_phits, "hits", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 344 | rd_pmisses = rrddim_add(st_phits, "misses", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 345 | } |
| 346 | |
| 347 | rrddim_set_by_pointer(st_phits, rd_phits, phit); |
| 348 | rrddim_set_by_pointer(st_phits, rd_pmisses, pmiss); |
| 349 | rrdset_done(st_phits); |
| 350 | |
| 351 | static RRDSET *st_phits_rate = NULL; |
| 352 | static RRDDIM *rd_phits_rate = NULL; |
| 353 | static RRDDIM *rd_pmisses_rate = NULL; |
| 354 | |
| 355 | if (unlikely(!st_phits_rate)) { |
| 356 | st_phits_rate = rrdset_create_localhost( |
| 357 | "zfs" |
| 358 | , "phits_rate" |
| 359 | , NULL |
| 360 | , ZFS_FAMILY_EFFICIENCY |
| 361 | , NULL |
| 362 | , "ZFS Prefetch Hits Rate" |
| 363 | , "events/s" |
| 364 | , plugin |
| 365 | , module |
| 366 | , NETDATA_CHART_PRIO_ZFS_PHITS + 1 |
| 367 | , update_every |
| 368 | , RRDSET_TYPE_STACKED |
| 369 | ); |
| 370 | |
| 371 | rd_phits_rate = rrddim_add(st_phits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 372 | rd_pmisses_rate = rrddim_add(st_phits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 373 | } |
| 374 | |
| 375 | rrddim_set_by_pointer(st_phits_rate, rd_phits_rate, phit); |
| 376 | rrddim_set_by_pointer(st_phits_rate, rd_pmisses_rate, pmiss); |
| 377 | rrdset_done(st_phits_rate); |
| 378 | } |
| 379 | |
| 380 | // -------------------------------------------------------------------- |
| 381 | |
| 382 | if(likely(do_mhits == CONFIG_BOOLEAN_YES || mhit || mmiss)) { |
| 383 | do_mhits = CONFIG_BOOLEAN_YES; |
| 384 | |
| 385 | static RRDSET *st_mhits = NULL; |
| 386 | static RRDDIM *rd_mhits = NULL; |
| 387 | static RRDDIM *rd_mmisses = NULL; |
| 388 | |
| 389 | if (unlikely(!st_mhits)) { |
| 390 | st_mhits = rrdset_create_localhost( |
| 391 | "zfs" |
| 392 | , "mhits" |
| 393 | , NULL |
| 394 | , ZFS_FAMILY_EFFICIENCY |
| 395 | , NULL |
| 396 | , "ZFS Metadata Hits" |
| 397 | , "percentage" |
| 398 | , plugin |
| 399 | , module |
| 400 | , NETDATA_CHART_PRIO_ZFS_MHITS |
| 401 | , update_every |
| 402 | , RRDSET_TYPE_STACKED |
| 403 | ); |
| 404 | |
| 405 | rd_mhits = rrddim_add(st_mhits, "hits", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 406 | rd_mmisses = rrddim_add(st_mhits, "misses", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 407 | } |
| 408 | |
| 409 | rrddim_set_by_pointer(st_mhits, rd_mhits, mhit); |
| 410 | rrddim_set_by_pointer(st_mhits, rd_mmisses, mmiss); |
| 411 | rrdset_done(st_mhits); |
| 412 | |
| 413 | static RRDSET *st_mhits_rate = NULL; |
| 414 | static RRDDIM *rd_mhits_rate = NULL; |
| 415 | static RRDDIM *rd_mmisses_rate = NULL; |
| 416 | |
| 417 | if (unlikely(!st_mhits_rate)) { |
| 418 | st_mhits_rate = rrdset_create_localhost( |
| 419 | "zfs" |
| 420 | , "mhits_rate" |
| 421 | , NULL |
| 422 | , ZFS_FAMILY_EFFICIENCY |
| 423 | , NULL |
| 424 | , "ZFS Metadata Hits Rate" |
| 425 | , "events/s" |
| 426 | , plugin |
| 427 | , module |
| 428 | , NETDATA_CHART_PRIO_ZFS_MHITS + 1 |
| 429 | , update_every |
| 430 | , RRDSET_TYPE_STACKED |
| 431 | ); |
| 432 | |
| 433 | rd_mhits_rate = rrddim_add(st_mhits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 434 | rd_mmisses_rate = rrddim_add(st_mhits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 435 | } |
| 436 | |
| 437 | rrddim_set_by_pointer(st_mhits_rate, rd_mhits_rate, mhit); |
| 438 | rrddim_set_by_pointer(st_mhits_rate, rd_mmisses_rate, mmiss); |
| 439 | rrdset_done(st_mhits_rate); |
| 440 | } |
| 441 | |
| 442 | // -------------------------------------------------------------------- |
| 443 | |
| 444 | if(likely(arcstats.l2exist && (do_l2hits == CONFIG_BOOLEAN_YES || l2hit || l2miss))) { |
| 445 | do_l2hits = CONFIG_BOOLEAN_YES; |
| 446 | |
| 447 | static RRDSET *st_l2hits = NULL; |
| 448 | static RRDDIM *rd_l2hits = NULL; |
| 449 | static RRDDIM *rd_l2misses = NULL; |
| 450 | |
| 451 | if (unlikely(!st_l2hits)) { |
| 452 | st_l2hits = rrdset_create_localhost( |
| 453 | "zfs" |
| 454 | , "l2hits" |
| 455 | , NULL |
| 456 | , ZFS_FAMILY_EFFICIENCY |
| 457 | , NULL |
| 458 | , "ZFS L2 Hits" |
| 459 | , "percentage" |
| 460 | , plugin |
| 461 | , module |
| 462 | , NETDATA_CHART_PRIO_ZFS_L2HITS |
| 463 | , update_every |
| 464 | , RRDSET_TYPE_STACKED |
| 465 | ); |
| 466 | |
| 467 | rd_l2hits = rrddim_add(st_l2hits, "hits", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 468 | rd_l2misses = rrddim_add(st_l2hits, "misses", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 469 | } |
| 470 | |
| 471 | rrddim_set_by_pointer(st_l2hits, rd_l2hits, l2hit); |
| 472 | rrddim_set_by_pointer(st_l2hits, rd_l2misses, l2miss); |
| 473 | rrdset_done(st_l2hits); |
| 474 | |
| 475 | static RRDSET *st_l2hits_rate = NULL; |
| 476 | static RRDDIM *rd_l2hits_rate = NULL; |
| 477 | static RRDDIM *rd_l2misses_rate = NULL; |
| 478 | |
| 479 | if (unlikely(!st_l2hits_rate)) { |
| 480 | st_l2hits_rate = rrdset_create_localhost( |
| 481 | "zfs" |
| 482 | , "l2hits_rate" |
| 483 | , NULL |
| 484 | , ZFS_FAMILY_EFFICIENCY |
| 485 | , NULL |
| 486 | , "ZFS L2 Hits Rate" |
| 487 | , "events/s" |
| 488 | , plugin |
| 489 | , module |
| 490 | , NETDATA_CHART_PRIO_ZFS_L2HITS + 1 |
| 491 | , update_every |
| 492 | , RRDSET_TYPE_STACKED |
| 493 | ); |
| 494 | |
| 495 | rd_l2hits_rate = rrddim_add(st_l2hits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 496 | rd_l2misses_rate = rrddim_add(st_l2hits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 497 | } |
| 498 | |
| 499 | rrddim_set_by_pointer(st_l2hits_rate, rd_l2hits_rate, l2hit); |
| 500 | rrddim_set_by_pointer(st_l2hits_rate, rd_l2misses_rate, l2miss); |
| 501 | rrdset_done(st_l2hits_rate); |
| 502 | } |
| 503 | |
| 504 | // -------------------------------------------------------------------- |
| 505 | |
| 506 | if(likely(do_list_hits == CONFIG_BOOLEAN_YES || arcstats.mfu_hits \ |
| 507 | || arcstats.mru_hits \ |
| 508 | || arcstats.mfu_ghost_hits \ |
| 509 | || arcstats.mru_ghost_hits)) { |
| 510 | do_list_hits = CONFIG_BOOLEAN_YES; |
| 511 | |
| 512 | static RRDSET *st_list_hits = NULL; |
| 513 | static RRDDIM *rd_mfu = NULL; |
| 514 | static RRDDIM *rd_mru = NULL; |
| 515 | static RRDDIM *rd_mfug = NULL; |
| 516 | static RRDDIM *rd_mrug = NULL; |
| 517 | |
| 518 | if (unlikely(!st_list_hits)) { |
| 519 | st_list_hits = rrdset_create_localhost( |
| 520 | "zfs" |
| 521 | , "list_hits" |
| 522 | , NULL |
| 523 | , ZFS_FAMILY_EFFICIENCY |
| 524 | , NULL |
| 525 | , "ZFS List Hits" |
| 526 | , "hits/s" |
| 527 | , plugin |
| 528 | , module |
| 529 | , NETDATA_CHART_PRIO_ZFS_LIST_HITS |
| 530 | , update_every |
| 531 | , RRDSET_TYPE_AREA |
| 532 | ); |
| 533 | |
| 534 | rd_mfu = rrddim_add(st_list_hits, "mfu", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 535 | rd_mfug = rrddim_add(st_list_hits, "mfug", "mfu ghost", 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 536 | rd_mru = rrddim_add(st_list_hits, "mru", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 537 | rd_mrug = rrddim_add(st_list_hits, "mrug", "mru ghost", 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 538 | } |
| 539 | |
| 540 | rrddim_set_by_pointer(st_list_hits, rd_mfu, arcstats.mfu_hits); |
| 541 | rrddim_set_by_pointer(st_list_hits, rd_mru, arcstats.mru_hits); |
| 542 | rrddim_set_by_pointer(st_list_hits, rd_mfug, arcstats.mfu_ghost_hits); |
| 543 | rrddim_set_by_pointer(st_list_hits, rd_mrug, arcstats.mru_ghost_hits); |
| 544 | rrdset_done(st_list_hits); |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | void generate_charts_arc_summary(const char *plugin, const char *module, int update_every) { |
| 549 | static int do_arc_size_breakdown = -1, do_memory = -1, do_important_ops = -1, do_actual_hits = -1, \ |
| 550 | do_demand_data_hits = -1, do_prefetch_data_hits = -1, do_hash_elements = -1, do_hash_chains = -1; |
| 551 | |
| 552 | if (unlikely(do_arc_size_breakdown == -1)) |
| 553 | do_arc_size_breakdown = do_memory = do_important_ops = do_actual_hits = do_demand_data_hits = |
| 554 | do_prefetch_data_hits = do_hash_elements = do_hash_chains = 1; |
| 555 | |
| 556 | unsigned long long arc_accesses_total = arcstats.hits + arcstats.misses; |
| 557 | unsigned long long real_hits = arcstats.mfu_hits + arcstats.mru_hits; |
| 558 | unsigned long long real_misses = arc_accesses_total - real_hits; |
| 559 | |
| 560 | //unsigned long long anon_hits = arcstats.hits - (arcstats.mfu_hits + arcstats.mru_hits + arcstats.mfu_ghost_hits + arcstats.mru_ghost_hits); |
| 561 | |
| 562 | unsigned long long arc_size = arcstats.size; |
| 563 | unsigned long long mru_size = arcstats.p > 0 ? arcstats.p : arcstats.pd + arcstats.pm; |
| 564 | //unsigned long long target_min_size = arcstats.c_min; |
| 565 | //unsigned long long target_max_size = arcstats.c_max; |
| 566 | unsigned long long target_size = arcstats.c; |
| 567 | //unsigned long long target_size_ratio = (target_max_size / target_min_size); |
| 568 | |
| 569 | unsigned long long mfu_size; |
| 570 | if(arc_size > target_size) |
| 571 | mfu_size = arc_size - mru_size; |
| 572 | else |
| 573 | mfu_size = target_size - mru_size; |
| 574 | |
| 575 | // -------------------------------------------------------------------- |
| 576 | |
| 577 | if(likely(do_arc_size_breakdown == CONFIG_BOOLEAN_YES || mru_size || mfu_size)) { |
| 578 | do_arc_size_breakdown = CONFIG_BOOLEAN_YES; |
| 579 | |
| 580 | static RRDSET *st_arc_size_breakdown = NULL; |
| 581 | static RRDDIM *rd_most_recent = NULL; |
| 582 | static RRDDIM *rd_most_frequent = NULL; |
| 583 | |
| 584 | if (unlikely(!st_arc_size_breakdown)) { |
| 585 | st_arc_size_breakdown = rrdset_create_localhost( |
| 586 | "zfs" |
| 587 | , "arc_size_breakdown" |
| 588 | , NULL |
| 589 | , ZFS_FAMILY_EFFICIENCY |
| 590 | , NULL |
| 591 | , "ZFS ARC Size Breakdown" |
| 592 | , "percentage" |
| 593 | , plugin |
| 594 | , module |
| 595 | , NETDATA_CHART_PRIO_ZFS_ARC_SIZE_BREAKDOWN |
| 596 | , update_every |
| 597 | , RRDSET_TYPE_STACKED |
| 598 | ); |
| 599 | |
| 600 | rd_most_recent = rrddim_add(st_arc_size_breakdown, "recent", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_ROW_TOTAL); |
| 601 | rd_most_frequent = rrddim_add(st_arc_size_breakdown, "frequent", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_ROW_TOTAL); |
| 602 | } |
| 603 | |
| 604 | rrddim_set_by_pointer(st_arc_size_breakdown, rd_most_recent, mru_size); |
| 605 | rrddim_set_by_pointer(st_arc_size_breakdown, rd_most_frequent, mfu_size); |
| 606 | rrdset_done(st_arc_size_breakdown); |
| 607 | } |
| 608 | |
| 609 | // -------------------------------------------------------------------- |
| 610 | |
| 611 | if(likely(do_memory == CONFIG_BOOLEAN_YES || arcstats.memory_direct_count \ |
| 612 | || arcstats.memory_throttle_count \ |
| 613 | || arcstats.memory_indirect_count)) { |
| 614 | do_memory = CONFIG_BOOLEAN_YES; |
| 615 | |
| 616 | static RRDSET *st_memory = NULL; |
| 617 | #ifndef __FreeBSD__ |
| 618 | static RRDDIM *rd_direct = NULL; |
| 619 | #endif |
| 620 | static RRDDIM *rd_throttled = NULL; |
| 621 | #ifndef __FreeBSD__ |
| 622 | static RRDDIM *rd_indirect = NULL; |
| 623 | #endif |
| 624 | |
| 625 | if (unlikely(!st_memory)) { |
| 626 | st_memory = rrdset_create_localhost( |
| 627 | "zfs" |
| 628 | , "memory_ops" |
| 629 | , NULL |
| 630 | , ZFS_FAMILY_OPERATIONS |
| 631 | , NULL |
| 632 | , "ZFS Memory Operations" |
| 633 | , "operations/s" |
| 634 | , plugin |
| 635 | , module |
| 636 | , NETDATA_CHART_PRIO_ZFS_MEMORY_OPS |
| 637 | , update_every |
| 638 | , RRDSET_TYPE_LINE |
| 639 | ); |
| 640 | |
| 641 | #ifndef __FreeBSD__ |
| 642 | rd_direct = rrddim_add(st_memory, "direct", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 643 | #endif |
| 644 | rd_throttled = rrddim_add(st_memory, "throttled", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 645 | #ifndef __FreeBSD__ |
| 646 | rd_indirect = rrddim_add(st_memory, "indirect", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 647 | #endif |
| 648 | } |
| 649 | |
| 650 | #ifndef __FreeBSD__ |
| 651 | rrddim_set_by_pointer(st_memory, rd_direct, arcstats.memory_direct_count); |
| 652 | #endif |
| 653 | rrddim_set_by_pointer(st_memory, rd_throttled, arcstats.memory_throttle_count); |
| 654 | #ifndef __FreeBSD__ |
| 655 | rrddim_set_by_pointer(st_memory, rd_indirect, arcstats.memory_indirect_count); |
| 656 | #endif |
| 657 | rrdset_done(st_memory); |
| 658 | } |
| 659 | |
| 660 | // -------------------------------------------------------------------- |
| 661 | |
| 662 | if(likely(do_important_ops == CONFIG_BOOLEAN_YES || arcstats.deleted \ |
| 663 | || arcstats.evict_skip \ |
| 664 | || arcstats.mutex_miss \ |
| 665 | || arcstats.hash_collisions)) { |
| 666 | do_important_ops = CONFIG_BOOLEAN_YES; |
| 667 | |
| 668 | static RRDSET *st_important_ops = NULL; |
| 669 | static RRDDIM *rd_deleted = NULL; |
| 670 | static RRDDIM *rd_mutex_misses = NULL; |
| 671 | static RRDDIM *rd_evict_skips = NULL; |
| 672 | static RRDDIM *rd_hash_collisions = NULL; |
| 673 | |
| 674 | if (unlikely(!st_important_ops)) { |
| 675 | st_important_ops = rrdset_create_localhost( |
| 676 | "zfs" |
| 677 | , "important_ops" |
| 678 | , NULL |
| 679 | , ZFS_FAMILY_OPERATIONS |
| 680 | , NULL |
| 681 | , "ZFS Important Operations" |
| 682 | , "operations/s" |
| 683 | , plugin |
| 684 | , module |
| 685 | , NETDATA_CHART_PRIO_ZFS_IMPORTANT_OPS |
| 686 | , update_every |
| 687 | , RRDSET_TYPE_LINE |
| 688 | ); |
| 689 | |
| 690 | rd_evict_skips = rrddim_add(st_important_ops, "eskip", "evict skip", 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 691 | rd_deleted = rrddim_add(st_important_ops, "deleted", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 692 | rd_mutex_misses = rrddim_add(st_important_ops, "mtxmis", "mutex miss", 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 693 | rd_hash_collisions = rrddim_add(st_important_ops, "hash_collisions", "hash collisions", 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 694 | } |
| 695 | |
| 696 | rrddim_set_by_pointer(st_important_ops, rd_deleted, arcstats.deleted); |
| 697 | rrddim_set_by_pointer(st_important_ops, rd_evict_skips, arcstats.evict_skip); |
| 698 | rrddim_set_by_pointer(st_important_ops, rd_mutex_misses, arcstats.mutex_miss); |
| 699 | rrddim_set_by_pointer(st_important_ops, rd_hash_collisions, arcstats.hash_collisions); |
| 700 | rrdset_done(st_important_ops); |
| 701 | } |
| 702 | |
| 703 | // -------------------------------------------------------------------- |
| 704 | |
| 705 | if(likely(do_actual_hits == CONFIG_BOOLEAN_YES || real_hits || real_misses)) { |
| 706 | do_actual_hits = CONFIG_BOOLEAN_YES; |
| 707 | |
| 708 | static RRDSET *st_actual_hits = NULL; |
| 709 | static RRDDIM *rd_actual_hits = NULL; |
| 710 | static RRDDIM *rd_actual_misses = NULL; |
| 711 | |
| 712 | if (unlikely(!st_actual_hits)) { |
| 713 | st_actual_hits = rrdset_create_localhost( |
| 714 | "zfs" |
| 715 | , "actual_hits" |
| 716 | , NULL |
| 717 | , ZFS_FAMILY_EFFICIENCY |
| 718 | , NULL |
| 719 | , "ZFS Actual Cache Hits" |
| 720 | , "percentage" |
| 721 | , plugin |
| 722 | , module |
| 723 | , NETDATA_CHART_PRIO_ZFS_ACTUAL_HITS |
| 724 | , update_every |
| 725 | , RRDSET_TYPE_STACKED |
| 726 | ); |
| 727 | |
| 728 | rd_actual_hits = rrddim_add(st_actual_hits, "hits", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 729 | rd_actual_misses = rrddim_add(st_actual_hits, "misses", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 730 | } |
| 731 | |
| 732 | rrddim_set_by_pointer(st_actual_hits, rd_actual_hits, real_hits); |
| 733 | rrddim_set_by_pointer(st_actual_hits, rd_actual_misses, real_misses); |
| 734 | rrdset_done(st_actual_hits); |
| 735 | |
| 736 | static RRDSET *st_actual_hits_rate = NULL; |
| 737 | static RRDDIM *rd_actual_hits_rate = NULL; |
| 738 | static RRDDIM *rd_actual_misses_rate = NULL; |
| 739 | |
| 740 | if (unlikely(!st_actual_hits_rate)) { |
| 741 | st_actual_hits_rate = rrdset_create_localhost( |
| 742 | "zfs" |
| 743 | , "actual_hits_rate" |
| 744 | , NULL |
| 745 | , ZFS_FAMILY_EFFICIENCY |
| 746 | , NULL |
| 747 | , "ZFS Actual Cache Hits Rate" |
| 748 | , "events/s" |
| 749 | , plugin |
| 750 | , module |
| 751 | , NETDATA_CHART_PRIO_ZFS_ACTUAL_HITS + 1 |
| 752 | , update_every |
| 753 | , RRDSET_TYPE_STACKED |
| 754 | ); |
| 755 | |
| 756 | rd_actual_hits_rate = rrddim_add(st_actual_hits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 757 | rd_actual_misses_rate = rrddim_add(st_actual_hits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 758 | } |
| 759 | |
| 760 | rrddim_set_by_pointer(st_actual_hits_rate, rd_actual_hits_rate, real_hits); |
| 761 | rrddim_set_by_pointer(st_actual_hits_rate, rd_actual_misses_rate, real_misses); |
| 762 | rrdset_done(st_actual_hits_rate); |
| 763 | } |
| 764 | |
| 765 | // -------------------------------------------------------------------- |
| 766 | |
| 767 | if(likely(do_demand_data_hits == CONFIG_BOOLEAN_YES || arcstats.demand_data_hits || arcstats.demand_data_misses)) { |
| 768 | do_demand_data_hits = CONFIG_BOOLEAN_YES; |
| 769 | |
| 770 | static RRDSET *st_demand_data_hits = NULL; |
| 771 | static RRDDIM *rd_demand_data_hits = NULL; |
| 772 | static RRDDIM *rd_demand_data_misses = NULL; |
| 773 | |
| 774 | if (unlikely(!st_demand_data_hits)) { |
| 775 | st_demand_data_hits = rrdset_create_localhost( |
| 776 | "zfs" |
| 777 | , "demand_data_hits" |
| 778 | , NULL |
| 779 | , ZFS_FAMILY_EFFICIENCY |
| 780 | , NULL |
| 781 | , "ZFS Data Demand Efficiency" |
| 782 | , "percentage" |
| 783 | , plugin |
| 784 | , module |
| 785 | , NETDATA_CHART_PRIO_ZFS_DEMAND_DATA_HITS |
| 786 | , update_every |
| 787 | , RRDSET_TYPE_STACKED |
| 788 | ); |
| 789 | |
| 790 | rd_demand_data_hits = rrddim_add(st_demand_data_hits, "hits", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 791 | rd_demand_data_misses = rrddim_add(st_demand_data_hits, "misses", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 792 | } |
| 793 | |
| 794 | rrddim_set_by_pointer(st_demand_data_hits, rd_demand_data_hits, arcstats.demand_data_hits); |
| 795 | rrddim_set_by_pointer(st_demand_data_hits, rd_demand_data_misses, arcstats.demand_data_misses); |
| 796 | rrdset_done(st_demand_data_hits); |
| 797 | |
| 798 | static RRDSET *st_demand_data_hits_rate = NULL; |
| 799 | static RRDDIM *rd_demand_data_hits_rate = NULL; |
| 800 | static RRDDIM *rd_demand_data_misses_rate = NULL; |
| 801 | |
| 802 | if (unlikely(!st_demand_data_hits_rate)) { |
| 803 | st_demand_data_hits_rate = rrdset_create_localhost( |
| 804 | "zfs" |
| 805 | , "demand_data_hits_rate" |
| 806 | , NULL |
| 807 | , ZFS_FAMILY_EFFICIENCY |
| 808 | , NULL |
| 809 | , "ZFS Data Demand Efficiency Rate" |
| 810 | , "events/s" |
| 811 | , plugin |
| 812 | , module |
| 813 | , NETDATA_CHART_PRIO_ZFS_DEMAND_DATA_HITS + 1 |
| 814 | , update_every |
| 815 | , RRDSET_TYPE_STACKED |
| 816 | ); |
| 817 | |
| 818 | rd_demand_data_hits_rate = rrddim_add(st_demand_data_hits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 819 | rd_demand_data_misses_rate = rrddim_add(st_demand_data_hits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 820 | } |
| 821 | |
| 822 | rrddim_set_by_pointer(st_demand_data_hits_rate, rd_demand_data_hits_rate, arcstats.demand_data_hits); |
| 823 | rrddim_set_by_pointer(st_demand_data_hits_rate, rd_demand_data_misses_rate, arcstats.demand_data_misses); |
| 824 | rrdset_done(st_demand_data_hits_rate); |
| 825 | } |
| 826 | |
| 827 | // -------------------------------------------------------------------- |
| 828 | |
| 829 | if(likely(do_prefetch_data_hits == CONFIG_BOOLEAN_YES || arcstats.prefetch_data_hits \ |
| 830 | || arcstats.prefetch_data_misses)) { |
| 831 | do_prefetch_data_hits = CONFIG_BOOLEAN_YES; |
| 832 | |
| 833 | static RRDSET *st_prefetch_data_hits = NULL; |
| 834 | static RRDDIM *rd_prefetch_data_hits = NULL; |
| 835 | static RRDDIM *rd_prefetch_data_misses = NULL; |
| 836 | |
| 837 | if (unlikely(!st_prefetch_data_hits)) { |
| 838 | st_prefetch_data_hits = rrdset_create_localhost( |
| 839 | "zfs" |
| 840 | , "prefetch_data_hits" |
| 841 | , NULL |
| 842 | , ZFS_FAMILY_EFFICIENCY |
| 843 | , NULL |
| 844 | , "ZFS Data Prefetch Efficiency" |
| 845 | , "percentage" |
| 846 | , plugin |
| 847 | , module |
| 848 | , NETDATA_CHART_PRIO_ZFS_PREFETCH_DATA_HITS |
| 849 | , update_every |
| 850 | , RRDSET_TYPE_STACKED |
| 851 | ); |
| 852 | |
| 853 | rd_prefetch_data_hits = rrddim_add(st_prefetch_data_hits, "hits", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 854 | rd_prefetch_data_misses = rrddim_add(st_prefetch_data_hits, "misses", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); |
| 855 | } |
| 856 | |
| 857 | rrddim_set_by_pointer(st_prefetch_data_hits, rd_prefetch_data_hits, arcstats.prefetch_data_hits); |
| 858 | rrddim_set_by_pointer(st_prefetch_data_hits, rd_prefetch_data_misses, arcstats.prefetch_data_misses); |
| 859 | rrdset_done(st_prefetch_data_hits); |
| 860 | |
| 861 | static RRDSET *st_prefetch_data_hits_rate = NULL; |
| 862 | static RRDDIM *rd_prefetch_data_hits_rate = NULL; |
| 863 | static RRDDIM *rd_prefetch_data_misses_rate = NULL; |
| 864 | |
| 865 | if (unlikely(!st_prefetch_data_hits_rate)) { |
| 866 | st_prefetch_data_hits_rate = rrdset_create_localhost( |
| 867 | "zfs" |
| 868 | , "prefetch_data_hits_rate" |
| 869 | , NULL |
| 870 | , ZFS_FAMILY_EFFICIENCY |
| 871 | , NULL |
| 872 | , "ZFS Data Prefetch Efficiency Rate" |
| 873 | , "events/s" |
| 874 | , plugin |
| 875 | , module |
| 876 | , NETDATA_CHART_PRIO_ZFS_PREFETCH_DATA_HITS + 1 |
| 877 | , update_every |
| 878 | , RRDSET_TYPE_STACKED |
| 879 | ); |
| 880 | |
| 881 | rd_prefetch_data_hits_rate = rrddim_add(st_prefetch_data_hits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 882 | rd_prefetch_data_misses_rate = rrddim_add(st_prefetch_data_hits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 883 | } |
| 884 | |
| 885 | rrddim_set_by_pointer(st_prefetch_data_hits_rate, rd_prefetch_data_hits_rate, arcstats.prefetch_data_hits); |
| 886 | rrddim_set_by_pointer(st_prefetch_data_hits_rate, rd_prefetch_data_misses_rate, arcstats.prefetch_data_misses); |
| 887 | rrdset_done(st_prefetch_data_hits_rate); |
| 888 | } |
| 889 | |
| 890 | // -------------------------------------------------------------------- |
| 891 | |
| 892 | if(likely(do_hash_elements == CONFIG_BOOLEAN_YES || arcstats.hash_elements || arcstats.hash_elements_max)) { |
| 893 | do_hash_elements = CONFIG_BOOLEAN_YES; |
| 894 | |
| 895 | static RRDSET *st_hash_elements = NULL; |
| 896 | static RRDDIM *rd_hash_elements_current = NULL; |
| 897 | static RRDDIM *rd_hash_elements_max = NULL; |
| 898 | |
| 899 | if (unlikely(!st_hash_elements)) { |
| 900 | st_hash_elements = rrdset_create_localhost( |
| 901 | "zfs" |
| 902 | , "hash_elements" |
| 903 | , NULL |
| 904 | , ZFS_FAMILY_HASH |
| 905 | , NULL |
| 906 | , "ZFS ARC Hash Elements" |
| 907 | , "elements" |
| 908 | , plugin |
| 909 | , module |
| 910 | , NETDATA_CHART_PRIO_ZFS_HASH_ELEMENTS |
| 911 | , update_every |
| 912 | , RRDSET_TYPE_LINE |
| 913 | ); |
| 914 | |
| 915 | rd_hash_elements_current = rrddim_add(st_hash_elements, "current", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); |
| 916 | rd_hash_elements_max = rrddim_add(st_hash_elements, "max", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); |
| 917 | } |
| 918 | |
| 919 | rrddim_set_by_pointer(st_hash_elements, rd_hash_elements_current, arcstats.hash_elements); |
| 920 | rrddim_set_by_pointer(st_hash_elements, rd_hash_elements_max, arcstats.hash_elements_max); |
| 921 | rrdset_done(st_hash_elements); |
| 922 | } |
| 923 | |
| 924 | // -------------------------------------------------------------------- |
| 925 | |
| 926 | if(likely(do_hash_chains == CONFIG_BOOLEAN_YES || arcstats.hash_chains || arcstats.hash_chain_max)) { |
| 927 | do_hash_chains = CONFIG_BOOLEAN_YES; |
| 928 | |
| 929 | static RRDSET *st_hash_chains = NULL; |
| 930 | static RRDDIM *rd_hash_chains_current = NULL; |
| 931 | static RRDDIM *rd_hash_chains_max = NULL; |
| 932 | |
| 933 | if (unlikely(!st_hash_chains)) { |
| 934 | st_hash_chains = rrdset_create_localhost( |
| 935 | "zfs" |
| 936 | , "hash_chains" |
| 937 | , NULL |
| 938 | , ZFS_FAMILY_HASH |
| 939 | , NULL |
| 940 | , "ZFS ARC Hash Chains" |
| 941 | , "chains" |
| 942 | , plugin |
| 943 | , module |
| 944 | , NETDATA_CHART_PRIO_ZFS_HASH_CHAINS |
| 945 | , update_every |
| 946 | , RRDSET_TYPE_LINE |
| 947 | ); |
| 948 | |
| 949 | rd_hash_chains_current = rrddim_add(st_hash_chains, "current", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); |
| 950 | rd_hash_chains_max = rrddim_add(st_hash_chains, "max", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); |
| 951 | } |
| 952 | |
| 953 | rrddim_set_by_pointer(st_hash_chains, rd_hash_chains_current, arcstats.hash_chains); |
| 954 | rrddim_set_by_pointer(st_hash_chains, rd_hash_chains_max, arcstats.hash_chain_max); |
| 955 | rrdset_done(st_hash_chains); |
| 956 | } |
| 957 | |
| 958 | // -------------------------------------------------------------------- |
| 959 | |
| 960 | } |