Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
3689a058
Commit
3689a058
authored
Feb 24, 2015
by
Salvatore Sanfilippo
Browse files
Merge pull request #2273 from mattsta/improve/consistency/INFO/memory
Improve consistency of INFO MEMORY
parents
5ff00ac8
5a685f35
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis.c
View file @
3689a058
...
@@ -2736,9 +2736,13 @@ sds genRedisInfoString(char *section) {
...
@@ -2736,9 +2736,13 @@ sds genRedisInfoString(char *section) {
char hmem[64];
char hmem[64];
char peak_hmem[64];
char peak_hmem[64];
char total_system_hmem[64];
char total_system_hmem[64];
char used_memory_lua_hmem[64];
char used_memory_rss_hmem[64];
char maxmemory_hmem[64];
size_t zmalloc_used = zmalloc_used_memory();
size_t zmalloc_used = zmalloc_used_memory();
size_t total_system_mem = server.system_memory_size;
size_t total_system_mem = server.system_memory_size;
char *evict_policy = maxmemoryToString();
char *evict_policy = maxmemoryToString();
long long memory_lua = (long long)lua_gc(server.lua,LUA_GCCOUNT,0)*1024;
/* Peak memory is updated from time to time by serverCron() so it
/* Peak memory is updated from time to time by serverCron() so it
* may happen that the instantaneous value is slightly bigger than
* may happen that the instantaneous value is slightly bigger than
...
@@ -2750,6 +2754,9 @@ sds genRedisInfoString(char *section) {
...
@@ -2750,6 +2754,9 @@ sds genRedisInfoString(char *section) {
bytesToHuman(hmem,zmalloc_used);
bytesToHuman(hmem,zmalloc_used);
bytesToHuman(peak_hmem,server.stat_peak_memory);
bytesToHuman(peak_hmem,server.stat_peak_memory);
bytesToHuman(total_system_hmem,total_system_mem);
bytesToHuman(total_system_hmem,total_system_mem);
bytesToHuman(used_memory_lua_hmem,memory_lua);
bytesToHuman(used_memory_rss_hmem,server.resident_set_size);
bytesToHuman(maxmemory_hmem,server.maxmemory);
if (sections++) info = sdscat(info,"\r\n");
if (sections++) info = sdscat(info,"\r\n");
info = sdscatprintf(info,
info = sdscatprintf(info,
...
@@ -2757,25 +2764,33 @@ sds genRedisInfoString(char *section) {
...
@@ -2757,25 +2764,33 @@ sds genRedisInfoString(char *section) {
"used_memory:%zu\r\n"
"used_memory:%zu\r\n"
"used_memory_human:%s\r\n"
"used_memory_human:%s\r\n"
"used_memory_rss:%zu\r\n"
"used_memory_rss:%zu\r\n"
"used_memory_rss_human:%s\r\n"
"used_memory_peak:%zu\r\n"
"used_memory_peak:%zu\r\n"
"used_memory_peak_human:%s\r\n"
"used_memory_peak_human:%s\r\n"
"total_system_memory:%lu\r\n"
"total_system_memory:%lu\r\n"
"total_system_memory_human:%s\r\n"
"total_system_memory_human:%s\r\n"
"used_memory_lua:%lld\r\n"
"used_memory_lua:%lld\r\n"
"used_memory_lua_human:%s\r\n"
"maxmemory:%lld\r\n"
"maxmemory_human:%s\r\n"
"maxmemory_policy:%s\r\n"
"mem_fragmentation_ratio:%.2f\r\n"
"mem_fragmentation_ratio:%.2f\r\n"
"mem_allocator:%s
\r\n
"
"mem_allocator:%s\r\n",
"maxmemory_policy:%s
\r\n
"
,
zmalloc_used,
zmalloc_used,
hmem,
hmem,
server.resident_set_size,
server.resident_set_size,
used_memory_rss_hmem,
server.stat_peak_memory,
server.stat_peak_memory,
peak_hmem,
peak_hmem,
(unsigned long)total_system_mem,
(unsigned long)total_system_mem,
total_system_hmem,
total_system_hmem,
((
long
long
)
lua_gc
(
server
.
lua
,
LUA_GCCOUNT
,
0
))
*
1024LL
,
memory_lua,
used_memory_lua_hmem,
server.maxmemory,
maxmemory_hmem,
evict_policy,
zmalloc_get_fragmentation_ratio(server.resident_set_size),
zmalloc_get_fragmentation_ratio(server.resident_set_size),
ZMALLOC_LIB
,
ZMALLOC_LIB
evict_policy
);
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment