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
6dcc6898
Unverified
Commit
6dcc6898
authored
Aug 09, 2020
by
WuYunlong
Committed by
GitHub
Aug 08, 2020
Browse files
Optimize calls to mstime in trackInstantaneousMetric() (#6472)
parent
ea7eeb2f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/server.c
View file @
6dcc6898
...
...
@@ -1493,7 +1493,8 @@ int allPersistenceDisabled(void) {
/* Add a sample to the operations per second array of samples. */
void
trackInstantaneousMetric
(
int
metric
,
long
long
current_reading
)
{
long
long
t
=
mstime
()
-
server
.
inst_metric
[
metric
].
last_sample_time
;
long
long
now
=
mstime
();
long
long
t
=
now
-
server
.
inst_metric
[
metric
].
last_sample_time
;
long
long
ops
=
current_reading
-
server
.
inst_metric
[
metric
].
last_sample_count
;
long
long
ops_sec
;
...
...
@@ -1504,7 +1505,7 @@ void trackInstantaneousMetric(int metric, long long current_reading) {
ops_sec
;
server
.
inst_metric
[
metric
].
idx
++
;
server
.
inst_metric
[
metric
].
idx
%=
STATS_METRIC_SAMPLES
;
server
.
inst_metric
[
metric
].
last_sample_time
=
mstime
()
;
server
.
inst_metric
[
metric
].
last_sample_time
=
now
;
server
.
inst_metric
[
metric
].
last_sample_count
=
current_reading
;
}
...
...
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