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
f8909a25
Commit
f8909a25
authored
Apr 25, 2016
by
Oran Agra
Browse files
add DEBUG JEMALLC PURGE and JEMALLOC INFO cleanup
parent
7ba90225
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/debug.c
View file @
f8909a25
...
...
@@ -250,11 +250,13 @@ void computeDatasetDigest(unsigned char *final) {
}
}
#if defined(USE_JEMALLOC)
void
inputCatSds
(
void
*
result
,
const
char
*
str
)
{
/* result is actually a (sds *), so re-cast it here */
sds
*
info
=
(
sds
*
)
result
;
*
info
=
sdscat
(
*
info
,
str
);
}
#endif
void
debugCommand
(
client
*
c
)
{
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"segfault"
))
{
...
...
@@ -397,6 +399,7 @@ void debugCommand(client *c) {
snprintf
(
buf
,
sizeof
(
buf
),
"value:%lu"
,
j
);
val
=
createStringObject
(
buf
,
strlen
(
buf
));
dbAdd
(
c
->
db
,
key
,
val
);
signalModifiedKey
(
c
->
db
,
key
);
decrRefCount
(
key
);
}
addReply
(
c
,
shared
.
ok
);
...
...
@@ -474,8 +477,20 @@ void debugCommand(client *c) {
sds
info
=
sdsempty
();
je_malloc_stats_print
(
inputCatSds
,
&
info
,
NULL
);
addReplyBulkSds
(
c
,
info
);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"purge"
))
{
char
tmp
[
32
];
unsigned
narenas
=
0
;
size_t
sz
=
sizeof
(
unsigned
);
if
(
!
je_mallctl
(
"arenas.narenas"
,
&
narenas
,
&
sz
,
NULL
,
0
))
{
sprintf
(
tmp
,
"arena.%d.purge"
,
narenas
);
if
(
!
je_mallctl
(
tmp
,
NULL
,
0
,
NULL
,
0
))
{
addReply
(
c
,
shared
.
ok
);
return
;
}
}
addReplyError
(
c
,
"Error purging dirty pages"
);
}
else
{
addReplyErrorFormat
(
c
,
"Valid jemalloc debug fields: info"
);
addReplyErrorFormat
(
c
,
"Valid jemalloc debug fields: info
, purge
"
);
}
#else
addReplyErrorFormat
(
c
,
"jemalloc support not available"
);
...
...
src/redis-cli.c
View file @
f8909a25
...
...
@@ -787,7 +787,7 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
output_raw
=
0
;
if
(
!
strcasecmp
(
command
,
"info"
)
||
(
argc
>=
2
&&
!
strcasecmp
(
command
,
"debug"
)
&&
(
!
strcasecmp
(
argv
[
1
],
"jemalloc"
)
||
(
(
!
strcasecmp
(
argv
[
1
],
"jemalloc"
)
&&
!
strcasecmp
(
argv
[
2
],
"info"
))
||
!
strcasecmp
(
argv
[
1
],
"htstats"
)))
||
(
argc
==
2
&&
!
strcasecmp
(
command
,
"cluster"
)
&&
(
!
strcasecmp
(
argv
[
1
],
"nodes"
)
||
...
...
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