summaryrefslogtreecommitdiff
path: root/src/debug.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-01-23 18:10:14 +0100
committerantirez <antirez@gmail.com>2015-01-23 18:10:14 +0100
commit7885e1264e561afcc0182dd4763903def5138aa8 (patch)
tree52bbc427b1273b0dd222e72971657f86d22c8e05 /src/debug.c
parente22d75734e7bb2293cf8fb38c285cdc56378c60f (diff)
downloadredis-7885e1264e561afcc0182dd4763903def5138aa8.tar.gz
DEBUG structsize
Show sizes of a few important data structures in Redis. More missing.
Diffstat (limited to 'src/debug.c')
-rw-r--r--src/debug.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/debug.c b/src/debug.c
index 7783196a0..162274cce 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -418,6 +418,13 @@ void debugCommand(redisClient *c) {
errstr = sdsmapchars(errstr,"\n\r"," ",2); /* no newlines in errors. */
errstr = sdscatlen(errstr,"\r\n",2);
addReplySds(c,errstr);
+ } else if (!strcasecmp(c->argv[1]->ptr,"structsize") && c->argc == 2) {
+ sds sizes = sdsempty();
+ sizes = sdscatprintf(sizes,"bits:%d ", (sizeof(void*) == 8)?64:32);
+ sizes = sdscatprintf(sizes,"robj:%d ", (int)sizeof(robj));
+ 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,"jemalloc") && c->argc == 3) {
#if defined(USE_JEMALLOC)
if (!strcasecmp(c->argv[2]->ptr, "info")) {