summaryrefslogtreecommitdiff
path: root/items.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2017-05-08 15:17:23 -0700
committerdormando <dormando@rydia.net>2017-06-04 13:26:36 -0700
commit1a8373c9b2eb3fc23cdd160c0a57728dd1c25497 (patch)
tree4d8a310cff3743834d9cdd6564cb30f2e924f2f7 /items.c
parent7de9c6cf9991ae8885646fa6b7abb5c692a1efab (diff)
downloadmemcached-1a8373c9b2eb3fc23cdd160c0a57728dd1c25497.tar.gz
per-LRU hits breakdown
no actual speed loss. emulate the slab_stats "get_hits" by totalling up the per-LRU get_hits. could sub-LRU many stats but should use a different command/interface for that.
Diffstat (limited to 'items.c')
-rw-r--r--items.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/items.c b/items.c
index 556ba5a..f3db9e8 100644
--- a/items.c
+++ b/items.c
@@ -39,6 +39,10 @@ typedef struct {
uint64_t moves_to_warm;
uint64_t moves_within_lru;
uint64_t direct_reclaims;
+ uint64_t hits_to_hot;
+ uint64_t hits_to_warm;
+ uint64_t hits_to_cold;
+ uint64_t hits_to_temp;
rel_time_t evicted_time;
} itemstats_t;
@@ -663,6 +667,8 @@ void item_stats_totals(ADD_STAT add_stats, void *c) {
}
void item_stats(ADD_STAT add_stats, void *c) {
+ struct thread_stats thread_stats;
+ threadlocal_stats_aggregate(&thread_stats);
itemstats_t totals;
int n;
for (n = 0; n < MAX_NUMBER_OF_SLAB_CLASSES; n++) {
@@ -707,6 +713,20 @@ void item_stats(ADD_STAT add_stats, void *c) {
}
if (lru_type_map[x] == COLD_LRU)
totals.evicted_time = itemstats[i].evicted_time;
+ switch (lru_type_map[x]) {
+ case HOT_LRU:
+ totals.hits_to_hot = thread_stats.lru_hits[i];
+ break;
+ case WARM_LRU:
+ totals.hits_to_warm = thread_stats.lru_hits[i];
+ break;
+ case COLD_LRU:
+ totals.hits_to_cold = thread_stats.lru_hits[i];
+ break;
+ case TEMP_LRU:
+ totals.hits_to_temp = thread_stats.lru_hits[i];
+ break;
+ }
pthread_mutex_unlock(&lru_locks[i]);
}
if (size == 0)
@@ -758,6 +778,18 @@ void item_stats(ADD_STAT add_stats, void *c) {
"%llu", (unsigned long long)totals.moves_within_lru);
APPEND_NUM_FMT_STAT(fmt, n, "direct_reclaims",
"%llu", (unsigned long long)totals.direct_reclaims);
+ APPEND_NUM_FMT_STAT(fmt, n, "hits_to_hot",
+ "%llu", (unsigned long long)totals.hits_to_hot);
+
+ APPEND_NUM_FMT_STAT(fmt, n, "hits_to_warm",
+ "%llu", (unsigned long long)totals.hits_to_warm);
+
+ APPEND_NUM_FMT_STAT(fmt, n, "hits_to_cold",
+ "%llu", (unsigned long long)totals.hits_to_cold);
+
+ APPEND_NUM_FMT_STAT(fmt, n, "hits_to_temp",
+ "%llu", (unsigned long long)totals.hits_to_temp);
+
}
}