mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Add quicklist info to DEBUG OBJECT
Added field 'ql_nodes' and 'ql_avg_per_node'. ql_nodes is the number of quicklist nodes in the quicklist. ql_avg_node is the average fill level in each quicklist node. (LLEN / QL_NODES) Sample output: 127.0.0.1:6379> DEBUG object b Value at:0x7fa42bf2fed0 refcount:1 encoding:quicklist serializedlength:18489 lru:8983768 lru_seconds_idle:3 ql_nodes:430 ql_avg_per_node:511.73 127.0.0.1:6379> llen b (integer) 220044
This commit is contained in:
parent
8d7021892e
commit
5127e39980
16
src/debug.c
16
src/debug.c
@ -301,13 +301,25 @@ void debugCommand(redisClient *c) {
|
|||||||
val = dictGetVal(de);
|
val = dictGetVal(de);
|
||||||
strenc = strEncoding(val->encoding);
|
strenc = strEncoding(val->encoding);
|
||||||
|
|
||||||
|
char extra[128] = {0};
|
||||||
|
if (val->encoding == REDIS_ENCODING_QUICKLIST) {
|
||||||
|
char *nextra = extra;
|
||||||
|
int remaining = sizeof(extra);
|
||||||
|
quicklist *ql = val->ptr;
|
||||||
|
double avg = (double)ql->count/ql->len;
|
||||||
|
int used = snprintf(nextra, remaining, " ql_nodes:%lu", ql->len);
|
||||||
|
nextra += used;
|
||||||
|
remaining -= used;
|
||||||
|
snprintf(nextra, remaining, " ql_avg_node:%.2f", avg);
|
||||||
|
}
|
||||||
|
|
||||||
addReplyStatusFormat(c,
|
addReplyStatusFormat(c,
|
||||||
"Value at:%p refcount:%d "
|
"Value at:%p refcount:%d "
|
||||||
"encoding:%s serializedlength:%lld "
|
"encoding:%s serializedlength:%lld "
|
||||||
"lru:%d lru_seconds_idle:%llu",
|
"lru:%d lru_seconds_idle:%llu%s",
|
||||||
(void*)val, val->refcount,
|
(void*)val, val->refcount,
|
||||||
strenc, (long long) rdbSavedObjectLen(val),
|
strenc, (long long) rdbSavedObjectLen(val),
|
||||||
val->lru, estimateObjectIdleTime(val)/1000);
|
val->lru, estimateObjectIdleTime(val)/1000, extra);
|
||||||
} else if (!strcasecmp(c->argv[1]->ptr,"sdslen") && c->argc == 3) {
|
} else if (!strcasecmp(c->argv[1]->ptr,"sdslen") && c->argc == 3) {
|
||||||
dictEntry *de;
|
dictEntry *de;
|
||||||
robj *val;
|
robj *val;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user