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
4f2d279d
Unverified
Commit
4f2d279d
authored
Feb 13, 2018
by
Salvatore Sanfilippo
Committed by
GitHub
Feb 13, 2018
Browse files
Merge pull request #4685 from charsyam/refactoring/set_max_latency
Removing duplicated code to set max latency
parents
ae29bcd8
9d414361
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/latency.c
View file @
4f2d279d
...
@@ -109,19 +109,19 @@ void latencyAddSample(char *event, mstime_t latency) {
...
@@ -109,19 +109,19 @@ void latencyAddSample(char *event, mstime_t latency) {
dictAdd
(
server
.
latency_events
,
zstrdup
(
event
),
ts
);
dictAdd
(
server
.
latency_events
,
zstrdup
(
event
),
ts
);
}
}
if
(
latency
>
ts
->
max
)
ts
->
max
=
latency
;
/* If the previous sample is in the same second, we update our old sample
/* If the previous sample is in the same second, we update our old sample
* if this latency is > of the old one, or just return. */
* if this latency is > of the old one, or just return. */
prev
=
(
ts
->
idx
+
LATENCY_TS_LEN
-
1
)
%
LATENCY_TS_LEN
;
prev
=
(
ts
->
idx
+
LATENCY_TS_LEN
-
1
)
%
LATENCY_TS_LEN
;
if
(
ts
->
samples
[
prev
].
time
==
now
)
{
if
(
ts
->
samples
[
prev
].
time
==
now
)
{
if
(
latency
>
ts
->
samples
[
prev
].
latency
)
if
(
latency
>
ts
->
samples
[
prev
].
latency
)
ts
->
samples
[
prev
].
latency
=
latency
;
ts
->
samples
[
prev
].
latency
=
latency
;
if
(
latency
>
ts
->
max
)
ts
->
max
=
latency
;
return
;
return
;
}
}
ts
->
samples
[
ts
->
idx
].
time
=
time
(
NULL
);
ts
->
samples
[
ts
->
idx
].
time
=
time
(
NULL
);
ts
->
samples
[
ts
->
idx
].
latency
=
latency
;
ts
->
samples
[
ts
->
idx
].
latency
=
latency
;
if
(
latency
>
ts
->
max
)
ts
->
max
=
latency
;
ts
->
idx
++
;
ts
->
idx
++
;
if
(
ts
->
idx
==
LATENCY_TS_LEN
)
ts
->
idx
=
0
;
if
(
ts
->
idx
==
LATENCY_TS_LEN
)
ts
->
idx
=
0
;
...
...
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