summaryrefslogtreecommitdiff
path: root/src/debug.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-07-14 17:15:37 +0200
committerantirez <antirez@gmail.com>2015-07-14 17:15:37 +0200
commit0f64080dcb9f44c923379f909aae82f6c2b2ed19 (patch)
tree6980f140b6b835c71a2dcbbc3eaadbbcf31a392f /src/debug.c
parent4c7ee0d5848ab12b9d2b18bca62cffcbfac0e885 (diff)
downloadredis-0f64080dcb9f44c923379f909aae82f6c2b2ed19.tar.gz
DEBUG HTSTATS <dbid> added.
The command reports information about the hash table internal state representing the specified database ID. This can be used in order to investigate rehashings, memory usage issues and for other debugging purposes.
Diffstat (limited to 'src/debug.c')
-rw-r--r--src/debug.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/debug.c b/src/debug.c
index b8dcf648e..2acba1495 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -425,6 +425,27 @@ void debugCommand(redisClient *c) {
sizes = sdscatprintf(sizes,"dictentry:%d ", (int)sizeof(dictEntry));
sizes = sdscatprintf(sizes,"sdshdr:%d", (int)sizeof(struct sdshdr));
addReplyBulkSds(c,sizes);
+ } else if (!strcasecmp(c->argv[1]->ptr,"htstats") && c->argc == 3) {
+ long dbid;
+ sds stats = sdsempty();
+ char buf[4096];
+
+ if (getLongFromObjectOrReply(c, c->argv[2], &dbid, NULL) != REDIS_OK)
+ return;
+ if (dbid < 0 || dbid >= server.dbnum) {
+ addReplyError(c,"Out of range database");
+ return;
+ }
+
+ stats = sdscatprintf(stats,"[Dictionary HT]\n");
+ dictGetStats(buf,sizeof(buf),server.db[dbid].dict);
+ stats = sdscat(stats,buf);
+
+ stats = sdscatprintf(stats,"[Expires HT]\n");
+ dictGetStats(buf,sizeof(buf),server.db[dbid].expires);
+ stats = sdscat(stats,buf);
+
+ addReplyBulkSds(c,stats);
} else if (!strcasecmp(c->argv[1]->ptr,"jemalloc") && c->argc == 3) {
#if defined(USE_JEMALLOC)
if (!strcasecmp(c->argv[2]->ptr, "info")) {