summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2018-12-02 15:29:20 +0200
committerOran Agra <oran@redislabs.com>2018-12-02 15:29:20 +0200
commitb587c54c24d0cfdc3cfb22303553ea5e780b87c1 (patch)
tree5046112ba4dbd564b4e014a8207cab24092ee10a
parent46a51cdcdc0bd92473163068c2ec3bef4dffe63c (diff)
downloadredis-b587c54c24d0cfdc3cfb22303553ea5e780b87c1.tar.gz
fix #5580, display fragmentation and rss overhead bytes as signed
these metrics become negative when RSS is smaller than the used_memory. This can easily happen when the program allocated a lot of memory and haven't written to it yet, in which case the kernel doesn't allocate any pages to the process
-rw-r--r--src/server.c6
-rw-r--r--src/server.h6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/server.c b/src/server.c
index cc335ebdc..bac5d400f 100644
--- a/src/server.c
+++ b/src/server.c
@@ -3247,11 +3247,11 @@ sds genRedisInfoString(char *section) {
"allocator_frag_ratio:%.2f\r\n"
"allocator_frag_bytes:%zu\r\n"
"allocator_rss_ratio:%.2f\r\n"
- "allocator_rss_bytes:%zu\r\n"
+ "allocator_rss_bytes:%zd\r\n"
"rss_overhead_ratio:%.2f\r\n"
- "rss_overhead_bytes:%zu\r\n"
+ "rss_overhead_bytes:%zd\r\n"
"mem_fragmentation_ratio:%.2f\r\n"
- "mem_fragmentation_bytes:%zu\r\n"
+ "mem_fragmentation_bytes:%zd\r\n"
"mem_not_counted_for_evict:%zu\r\n"
"mem_replication_backlog:%zu\r\n"
"mem_clients_slaves:%zu\r\n"
diff --git a/src/server.h b/src/server.h
index 86d6e2e4b..f7c348622 100644
--- a/src/server.h
+++ b/src/server.h
@@ -864,11 +864,11 @@ struct redisMemOverhead {
float dataset_perc;
float peak_perc;
float total_frag;
- size_t total_frag_bytes;
+ ssize_t total_frag_bytes;
float allocator_frag;
- size_t allocator_frag_bytes;
+ ssize_t allocator_frag_bytes;
float allocator_rss;
- size_t allocator_rss_bytes;
+ ssize_t allocator_rss_bytes;
float rss_extra;
size_t rss_extra_bytes;
size_t num_dbs;