/Users/deen/code/yugabyte-db/src/yb/util/cache_metrics.cc
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | // |
18 | | // The following only applies to changes made to this file as part of YugaByte development. |
19 | | // |
20 | | // Portions Copyright (c) YugaByte, Inc. |
21 | | // |
22 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
23 | | // in compliance with the License. You may obtain a copy of the License at |
24 | | // |
25 | | // http://www.apache.org/licenses/LICENSE-2.0 |
26 | | // |
27 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
28 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
29 | | // or implied. See the License for the specific language governing permissions and limitations |
30 | | // under the License. |
31 | | // |
32 | | |
33 | | #include "yb/util/cache_metrics.h" |
34 | | |
35 | | #include "yb/util/metrics.h" |
36 | | |
37 | | METRIC_DEFINE_counter(server, block_cache_inserts, |
38 | | "Block Cache Inserts", yb::MetricUnit::kBlocks, |
39 | | "Number of blocks inserted in the cache"); |
40 | | METRIC_DEFINE_counter(server, block_cache_lookups, |
41 | | "Block Cache Lookups", yb::MetricUnit::kBlocks, |
42 | | "Number of blocks looked up from the cache"); |
43 | | METRIC_DEFINE_counter(server, block_cache_evictions, |
44 | | "Block Cache Evictions", yb::MetricUnit::kBlocks, |
45 | | "Number of blocks evicted from the cache"); |
46 | | METRIC_DEFINE_counter(server, block_cache_misses, |
47 | | "Block Cache Misses", yb::MetricUnit::kBlocks, |
48 | | "Number of lookups that didn't yield a block"); |
49 | | METRIC_DEFINE_counter(server, block_cache_misses_caching, |
50 | | "Block Cache Misses (Caching)", yb::MetricUnit::kBlocks, |
51 | | "Number of lookups that were expecting a block that didn't yield one." |
52 | | "Use this number instead of cache_misses when trying to determine how " |
53 | | "efficient the cache is"); |
54 | | METRIC_DEFINE_counter(server, block_cache_hits, |
55 | | "Block Cache Hits", yb::MetricUnit::kBlocks, |
56 | | "Number of lookups that found a block"); |
57 | | METRIC_DEFINE_counter(server, block_cache_hits_caching, |
58 | | "Block Cache Hits (Caching)", yb::MetricUnit::kBlocks, |
59 | | "Number of lookups that were expecting a block that found one." |
60 | | "Use this number instead of cache_hits when trying to determine how " |
61 | | "efficient the cache is"); |
62 | | |
63 | | METRIC_DEFINE_gauge_uint64(server, block_cache_usage, "Block Cache Memory Usage", |
64 | | yb::MetricUnit::kBytes, |
65 | | "Memory consumed by the block cache"); |
66 | | METRIC_DEFINE_gauge_uint64(server, block_cache_single_touch_usage, |
67 | | "Single Touch Block Cache Memory Usage", |
68 | | yb::MetricUnit::kBytes, |
69 | | "Memory consumed by the single touch block cache"); |
70 | | METRIC_DEFINE_gauge_uint64(server, block_cache_multi_touch_usage, |
71 | | "Multi Cache Block Cache Memory Usage", |
72 | | yb::MetricUnit::kBytes, |
73 | | "Memory consumed by the multi cache block cache"); |
74 | | namespace yb { |
75 | | |
76 | | #define MINIT(member, x) member(METRIC_##x.Instantiate(entity)) |
77 | | #define GINIT(member, x) member(METRIC_##x.Instantiate(entity, 0)) |
78 | | CacheMetrics::CacheMetrics(const scoped_refptr<MetricEntity>& entity) |
79 | | : MINIT(inserts, block_cache_inserts), |
80 | | MINIT(lookups, block_cache_lookups), |
81 | | MINIT(evictions, block_cache_evictions), |
82 | | MINIT(cache_hits, block_cache_hits), |
83 | | MINIT(cache_hits_caching, block_cache_hits_caching), |
84 | | MINIT(cache_misses, block_cache_misses), |
85 | | MINIT(cache_misses_caching, block_cache_misses_caching), |
86 | | GINIT(cache_usage, block_cache_usage), |
87 | | GINIT(single_touch_cache_usage, block_cache_single_touch_usage), |
88 | 11.4k | GINIT(multi_touch_cache_usage, block_cache_multi_touch_usage) { |
89 | 11.4k | } |
90 | | #undef MINIT |
91 | | #undef GINIT |
92 | | |
93 | | } // namespace yb |