mirror of
https://github.com/redis/redis.git
synced 2026-02-03 20:39:54 -05:00
Merge 2fb5c4c6a0 into b5a37c0e42
This commit is contained in:
commit
2cb2f8b34c
3 changed files with 18 additions and 6 deletions
18
src/db.c
18
src/db.c
|
|
@ -318,15 +318,21 @@ kvobj *lookupKey(redisDb *db, robj *key, int flags, dictEntryLink *link) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!(flags & (LOOKUP_NOSTATS | LOOKUP_WRITE)))
|
||||
server.stat_keyspace_hits++;
|
||||
/* TODO: Use separate hits stats for WRITE */
|
||||
if (!(flags & LOOKUP_NOSTATS)) {
|
||||
if (flags & LOOKUP_WRITE)
|
||||
server.stat_keyspace_write_hits++;
|
||||
else
|
||||
server.stat_keyspace_hits++;
|
||||
}
|
||||
} else {
|
||||
if (!(flags & (LOOKUP_NONOTIFY | LOOKUP_WRITE)))
|
||||
notifyKeyspaceEvent(NOTIFY_KEY_MISS, "keymiss", key, db->id);
|
||||
if (!(flags & (LOOKUP_NOSTATS | LOOKUP_WRITE)))
|
||||
server.stat_keyspace_misses++;
|
||||
/* TODO: Use separate misses stats and notify event for WRITE */
|
||||
if (!(flags & LOOKUP_NOSTATS)) {
|
||||
if (flags & LOOKUP_WRITE)
|
||||
server.stat_keyspace_write_misses++;
|
||||
else
|
||||
server.stat_keyspace_misses++;
|
||||
}
|
||||
}
|
||||
|
||||
return val;
|
||||
|
|
|
|||
|
|
@ -2802,6 +2802,8 @@ void resetServerStats(void) {
|
|||
server.stat_last_eviction_exceeded_time = 0;
|
||||
server.stat_keyspace_misses = 0;
|
||||
server.stat_keyspace_hits = 0;
|
||||
server.stat_keyspace_write_hits = 0;
|
||||
server.stat_keyspace_write_misses = 0;
|
||||
server.stat_active_defrag_hits = 0;
|
||||
server.stat_active_defrag_misses = 0;
|
||||
server.stat_active_defrag_key_hits = 0;
|
||||
|
|
@ -6519,6 +6521,8 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) {
|
|||
"current_eviction_exceeded_time:%lld\r\n", current_eviction_exceeded_time / 1000,
|
||||
"keyspace_hits:%lld\r\n", server.stat_keyspace_hits,
|
||||
"keyspace_misses:%lld\r\n", server.stat_keyspace_misses,
|
||||
"keyspace_write_hits:%lld\r\n", server.stat_keyspace_write_hits,
|
||||
"keyspace_write_misses:%lld\r\n", server.stat_keyspace_write_misses,
|
||||
"pubsub_channels:%llu\r\n", kvstoreSize(server.pubsub_channels),
|
||||
"pubsub_patterns:%lu\r\n", dictSize(server.pubsub_patterns),
|
||||
"pubsubshard_channels:%llu\r\n", kvstoreSize(server.pubsubshard_channels),
|
||||
|
|
|
|||
|
|
@ -2046,6 +2046,8 @@ struct redisServer {
|
|||
monotime stat_last_eviction_exceeded_time; /* Timestamp of current eviction start, unit us */
|
||||
long long stat_keyspace_hits; /* Number of successful lookups of keys */
|
||||
long long stat_keyspace_misses; /* Number of failed lookups of keys */
|
||||
long long stat_keyspace_write_hits; /* Number of successful write lookups */
|
||||
long long stat_keyspace_write_misses; /* Number of failed write lookups */
|
||||
long long stat_active_defrag_hits; /* number of allocations moved */
|
||||
long long stat_active_defrag_misses; /* number of allocations scanned but not moved */
|
||||
long long stat_active_defrag_key_hits; /* number of keys with moved allocations */
|
||||
|
|
|
|||
Loading…
Reference in a new issue