RDB/AOF loading times logged with millisecond precision

This commit is contained in:
antirez 2011-02-28 15:31:54 +01:00
parent 1187b0a56e
commit 4d60dea853

View File

@ -1664,7 +1664,7 @@ void usage() {
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
time_t start; long long start;
initServerConfig(); initServerConfig();
if (argc == 2) { if (argc == 2) {
@ -1685,15 +1685,15 @@ int main(int argc, char **argv) {
#ifdef __linux__ #ifdef __linux__
linuxOvercommitMemoryWarning(); linuxOvercommitMemoryWarning();
#endif #endif
start = time(NULL); start = ustime();
if (server.ds_enabled) { if (server.ds_enabled) {
redisLog(REDIS_NOTICE,"DB not loaded (running with disk back end)"); redisLog(REDIS_NOTICE,"DB not loaded (running with disk back end)");
} else if (server.appendonly) { } else if (server.appendonly) {
if (loadAppendOnlyFile(server.appendfilename) == REDIS_OK) if (loadAppendOnlyFile(server.appendfilename) == REDIS_OK)
redisLog(REDIS_NOTICE,"DB loaded from append only file: %ld seconds",time(NULL)-start); redisLog(REDIS_NOTICE,"DB loaded from append only file: %.3f seconds",(float)(ustime()-start)/1000000);
} else { } else {
if (rdbLoad(server.dbfilename) == REDIS_OK) if (rdbLoad(server.dbfilename) == REDIS_OK)
redisLog(REDIS_NOTICE,"DB loaded from disk: %ld seconds",time(NULL)-start); redisLog(REDIS_NOTICE,"DB loaded from disk: %.3f seconds",(float)(ustime()-start)/1000000);
} }
if (server.ipfd > 0) if (server.ipfd > 0)
redisLog(REDIS_NOTICE,"The server is now ready to accept connections on port %d", server.port); redisLog(REDIS_NOTICE,"The server is now ready to accept connections on port %d", server.port);