Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Turbo码先生
redis
提交
920611a4
R
redis
项目概览
Turbo码先生
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
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,发现更多精彩内容 >>
提交
920611a4
编写于
11月 30, 2018
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RESP3: latency.c updated.
上级
ddb98ad5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
6 addition
and
6 deletion
+6
-6
src/latency.c
src/latency.c
+6
-6
未找到文件。
src/latency.c
浏览文件 @
920611a4
...
@@ -476,19 +476,19 @@ sds createLatencyReport(void) {
...
@@ -476,19 +476,19 @@ sds createLatencyReport(void) {
/* latencyCommand() helper to produce a time-delay reply for all the samples
/* latencyCommand() helper to produce a time-delay reply for all the samples
* in memory for the specified time series. */
* in memory for the specified time series. */
void
latencyCommandReplyWithSamples
(
client
*
c
,
struct
latencyTimeSeries
*
ts
)
{
void
latencyCommandReplyWithSamples
(
client
*
c
,
struct
latencyTimeSeries
*
ts
)
{
void
*
replylen
=
add
DeferredMultiBulkLength
(
c
);
void
*
replylen
=
add
ReplyDeferredLen
(
c
);
int
samples
=
0
,
j
;
int
samples
=
0
,
j
;
for
(
j
=
0
;
j
<
LATENCY_TS_LEN
;
j
++
)
{
for
(
j
=
0
;
j
<
LATENCY_TS_LEN
;
j
++
)
{
int
i
=
(
ts
->
idx
+
j
)
%
LATENCY_TS_LEN
;
int
i
=
(
ts
->
idx
+
j
)
%
LATENCY_TS_LEN
;
if
(
ts
->
samples
[
i
].
time
==
0
)
continue
;
if
(
ts
->
samples
[
i
].
time
==
0
)
continue
;
addReply
MultiBulk
Len
(
c
,
2
);
addReply
Array
Len
(
c
,
2
);
addReplyLongLong
(
c
,
ts
->
samples
[
i
].
time
);
addReplyLongLong
(
c
,
ts
->
samples
[
i
].
time
);
addReplyLongLong
(
c
,
ts
->
samples
[
i
].
latency
);
addReplyLongLong
(
c
,
ts
->
samples
[
i
].
latency
);
samples
++
;
samples
++
;
}
}
setDeferred
MultiBulkLength
(
c
,
replylen
,
samples
);
setDeferred
ArrayLen
(
c
,
replylen
,
samples
);
}
}
/* latencyCommand() helper to produce the reply for the LATEST subcommand,
/* latencyCommand() helper to produce the reply for the LATEST subcommand,
...
@@ -497,14 +497,14 @@ void latencyCommandReplyWithLatestEvents(client *c) {
...
@@ -497,14 +497,14 @@ void latencyCommandReplyWithLatestEvents(client *c) {
dictIterator
*
di
;
dictIterator
*
di
;
dictEntry
*
de
;
dictEntry
*
de
;
addReply
MultiBulk
Len
(
c
,
dictSize
(
server
.
latency_events
));
addReply
Array
Len
(
c
,
dictSize
(
server
.
latency_events
));
di
=
dictGetIterator
(
server
.
latency_events
);
di
=
dictGetIterator
(
server
.
latency_events
);
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
char
*
event
=
dictGetKey
(
de
);
char
*
event
=
dictGetKey
(
de
);
struct
latencyTimeSeries
*
ts
=
dictGetVal
(
de
);
struct
latencyTimeSeries
*
ts
=
dictGetVal
(
de
);
int
last
=
(
ts
->
idx
+
LATENCY_TS_LEN
-
1
)
%
LATENCY_TS_LEN
;
int
last
=
(
ts
->
idx
+
LATENCY_TS_LEN
-
1
)
%
LATENCY_TS_LEN
;
addReply
MultiBulk
Len
(
c
,
4
);
addReply
Array
Len
(
c
,
4
);
addReplyBulkCString
(
c
,
event
);
addReplyBulkCString
(
c
,
event
);
addReplyLongLong
(
c
,
ts
->
samples
[
last
].
time
);
addReplyLongLong
(
c
,
ts
->
samples
[
last
].
time
);
addReplyLongLong
(
c
,
ts
->
samples
[
last
].
latency
);
addReplyLongLong
(
c
,
ts
->
samples
[
last
].
latency
);
...
@@ -583,7 +583,7 @@ NULL
...
@@ -583,7 +583,7 @@ NULL
/* LATENCY HISTORY <event> */
/* LATENCY HISTORY <event> */
ts
=
dictFetchValue
(
server
.
latency_events
,
c
->
argv
[
2
]
->
ptr
);
ts
=
dictFetchValue
(
server
.
latency_events
,
c
->
argv
[
2
]
->
ptr
);
if
(
ts
==
NULL
)
{
if
(
ts
==
NULL
)
{
addReply
MultiBulk
Len
(
c
,
0
);
addReply
Array
Len
(
c
,
0
);
}
else
{
}
else
{
latencyCommandReplyWithSamples
(
c
,
ts
);
latencyCommandReplyWithSamples
(
c
,
ts
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录