Unverified Commit 6dcc6898 authored by WuYunlong's avatar WuYunlong Committed by GitHub
Browse files

Optimize calls to mstime in trackInstantaneousMetric() (#6472)

parent ea7eeb2f
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment