Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
d9325ac6
R
redis
项目概览
xindoo
/
redis
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d9325ac6
编写于
9月 16, 2016
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Provide percentage of memory peak used info.
上级
309c2bcd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
1 deletion
+13
-1
src/object.c
src/object.c
+9
-1
src/server.c
src/server.c
+2
-0
src/server.h
src/server.h
+2
-0
未找到文件。
src/object.c
浏览文件 @
d9325ac6
...
...
@@ -810,6 +810,7 @@ struct redisMemOverhead *getMemoryOverheadData(void) {
mh
->
total_allocated
=
zmalloc_used
;
mh
->
startup_allocated
=
server
.
initial_memory_usage
;
mh
->
peak_allocated
=
server
.
stat_peak_memory
;
mem_total
+=
server
.
initial_memory_usage
;
mem
=
0
;
...
...
@@ -889,6 +890,7 @@ struct redisMemOverhead *getMemoryOverheadData(void) {
if
(
zmalloc_used
>
mh
->
startup_allocated
)
net_usage
=
zmalloc_used
-
mh
->
startup_allocated
;
mh
->
dataset_perc
=
(
float
)
mh
->
dataset
*
100
/
net_usage
;
mh
->
peak_perc
=
(
float
)
zmalloc_used
*
100
/
mh
->
peak_allocated
;
return
mh
;
}
...
...
@@ -988,7 +990,10 @@ void memoryCommand(client *c) {
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"overhead"
)
&&
c
->
argc
==
2
)
{
struct
redisMemOverhead
*
mh
=
getMemoryOverheadData
();
addReplyMultiBulkLen
(
c
,(
9
+
mh
->
num_dbs
)
*
2
);
addReplyMultiBulkLen
(
c
,(
11
+
mh
->
num_dbs
)
*
2
);
addReplyBulkCString
(
c
,
"peak.allocated"
);
addReplyLongLong
(
c
,
mh
->
peak_allocated
);
addReplyBulkCString
(
c
,
"total.allocated"
);
addReplyLongLong
(
c
,
mh
->
total_allocated
);
...
...
@@ -1030,6 +1035,9 @@ void memoryCommand(client *c) {
addReplyBulkCString
(
c
,
"dataset.percentage"
);
addReplyDouble
(
c
,
mh
->
dataset_perc
);
addReplyBulkCString
(
c
,
"peak.percentage"
);
addReplyDouble
(
c
,
mh
->
peak_perc
);
freeMemoryOverheadData
(
mh
);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"allocator-stats"
)
&&
c
->
argc
==
2
)
{
#if defined(USE_JEMALLOC)
...
...
src/server.c
浏览文件 @
d9325ac6
...
...
@@ -2837,6 +2837,7 @@ sds genRedisInfoString(char *section) {
"used_memory_rss_human:%s
\r\n
"
"used_memory_peak:%zu
\r\n
"
"used_memory_peak_human:%s
\r\n
"
"used_memory_peak_perc:%.2f%%
\r\n
"
"used_memory_overhead:%zu
\r\n
"
"used_memory_startup:%zu
\r\n
"
"used_memory_dataset:%zu
\r\n
"
...
...
@@ -2857,6 +2858,7 @@ sds genRedisInfoString(char *section) {
used_memory_rss_hmem
,
server
.
stat_peak_memory
,
peak_hmem
,
mh
->
peak_perc
,
mh
->
overhead_total
,
mh
->
startup_allocated
,
mh
->
dataset
,
...
...
src/server.h
浏览文件 @
d9325ac6
...
...
@@ -772,6 +772,7 @@ typedef struct redisOpArray {
/* This structure is returned by the getMemoryOverheadData() function in
* order to return memory overhead information. */
struct
redisMemOverhead
{
size_t
peak_allocated
;
size_t
total_allocated
;
size_t
startup_allocated
;
size_t
repl_backlog
;
...
...
@@ -781,6 +782,7 @@ struct redisMemOverhead {
size_t
overhead_total
;
size_t
dataset
;
float
dataset_perc
;
float
peak_perc
;
size_t
num_dbs
;
struct
{
size_t
dbid
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录