summaryrefslogtreecommitdiff
path: root/thread.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 /thread.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 'thread.c')
-rw-r--r--thread.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index 0656cb5..646b235 100644
--- a/thread.c
+++ b/thread.c
@@ -641,6 +641,8 @@ void threadlocal_stats_reset(void) {
memset(&threads[ii].stats.slab_stats, 0,
sizeof(threads[ii].stats.slab_stats));
+ memset(&threads[ii].stats.lru_hits, 0,
+ sizeof(uint64_t) * POWER_LARGEST);
pthread_mutex_unlock(&threads[ii].stats.mutex);
}
@@ -666,6 +668,13 @@ void threadlocal_stats_aggregate(struct thread_stats *stats) {
#undef X
}
+ for (sid = 0; sid < POWER_LARGEST; sid++) {
+ stats->lru_hits[sid] +=
+ threads[ii].stats.lru_hits[sid];
+ stats->slab_stats[CLEAR_LRU(sid)].get_hits +=
+ threads[ii].stats.lru_hits[sid];
+ }
+
pthread_mutex_unlock(&threads[ii].stats.mutex);
}
}