Optimize calls to mstime in trackInstantaneousMetric() (#6472)
This commit is contained in:
parent
ea7eeb2fd2
commit
6dcc6898be
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user