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
1c30cad1
Commit
1c30cad1
authored
Apr 21, 2011
by
antirez
Browse files
peak mem in INFO backported from unstable branch
parent
bd50301f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/redis.c
View file @
1c30cad1
...
...
@@ -541,6 +541,10 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
*/
updateLRUClock
();
/* Record the max memory used since the server was started. */
if
(
zmalloc_used_memory
()
>
server
.
stat_peak_memory
)
server
.
stat_peak_memory
=
zmalloc_used_memory
();
/* We received a SIGTERM, shutting down here in a safe way, as it is
* not ok doing so inside the signal handler. */
if
(
server
.
shutdown_asap
)
{
...
...
@@ -902,6 +906,7 @@ void initServer() {
server
.
stat_starttime
=
time
(
NULL
);
server
.
stat_keyspace_misses
=
0
;
server
.
stat_keyspace_hits
=
0
;
server
.
stat_peak_memory
=
0
;
server
.
unixtime
=
time
(
NULL
);
aeCreateTimeEvent
(
server
.
el
,
1
,
serverCron
,
NULL
,
NULL
);
if
(
server
.
ipfd
>
0
&&
aeCreateFileEvent
(
server
.
el
,
server
.
ipfd
,
AE_READABLE
,
...
...
@@ -1148,7 +1153,7 @@ sds genRedisInfoString(void) {
sds
info
;
time_t
uptime
=
time
(
NULL
)
-
server
.
stat_starttime
;
int
j
;
char
hmem
[
64
];
char
hmem
[
64
],
peak_
hmem
[
64
];
struct
rusage
self_ru
,
c_ru
;
unsigned
long
lol
,
bib
;
...
...
@@ -1157,6 +1162,7 @@ sds genRedisInfoString(void) {
getClientsMaxBuffers
(
&
lol
,
&
bib
);
bytesToHuman
(
hmem
,
zmalloc_used_memory
());
bytesToHuman
(
peak_hmem
,
server
.
stat_peak_memory
);
info
=
sdscatprintf
(
sdsempty
(),
"redis_version:%s
\r\n
"
"redis_git_sha1:%s
\r\n
"
...
...
@@ -1179,6 +1185,8 @@ sds genRedisInfoString(void) {
"used_memory:%zu
\r\n
"
"used_memory_human:%s
\r\n
"
"used_memory_rss:%zu
\r\n
"
"used_memory_peak:%zu
\r\n
"
"used_memory_peak_human:%s
\r\n
"
"mem_fragmentation_ratio:%.2f
\r\n
"
"use_tcmalloc:%d
\r\n
"
"loading:%d
\r\n
"
...
...
@@ -1219,6 +1227,8 @@ sds genRedisInfoString(void) {
zmalloc_used_memory
(),
hmem
,
zmalloc_get_rss
(),
server
.
stat_peak_memory
,
peak_hmem
,
zmalloc_get_fragmentation_ratio
(),
#ifdef USE_TCMALLOC
1
,
...
...
src/redis.h
View file @
1c30cad1
...
...
@@ -396,6 +396,7 @@ struct redisServer {
long
long
stat_evictedkeys
;
/* number of evicted keys (maxmemory) */
long
long
stat_keyspace_hits
;
/* number of successful lookups of keys */
long
long
stat_keyspace_misses
;
/* number of failed lookups of keys */
size_t
stat_peak_memory
;
/* max used memory record */
/* Configuration */
int
verbosity
;
int
maxidletime
;
...
...
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