Fix waste of CPU time about server log in serverCron.
When all the work is just adding logs, we could pull the condition out so as to use less CPU time when loglevel is bigger than LL_VERBOSE.
This commit is contained in:
parent
b71d06c269
commit
f977168085
@ -1968,6 +1968,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Show some info about non-empty databases */
|
/* Show some info about non-empty databases */
|
||||||
|
if (server.verbosity <= LL_VERBOSE) {
|
||||||
run_with_period(5000) {
|
run_with_period(5000) {
|
||||||
for (j = 0; j < server.dbnum; j++) {
|
for (j = 0; j < server.dbnum; j++) {
|
||||||
long long size, used, vkeys;
|
long long size, used, vkeys;
|
||||||
@ -1977,7 +1978,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
|||||||
vkeys = dictSize(server.db[j].expires);
|
vkeys = dictSize(server.db[j].expires);
|
||||||
if (used || vkeys) {
|
if (used || vkeys) {
|
||||||
serverLog(LL_VERBOSE,"DB %d: %lld keys (%lld volatile) in %lld slots HT.",j,used,vkeys,size);
|
serverLog(LL_VERBOSE,"DB %d: %lld keys (%lld volatile) in %lld slots HT.",j,used,vkeys,size);
|
||||||
/* dictPrintStats(server.dict); */
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user