- trying to tweak threaded logger performance when log entries are in the hundreds of thousands

This commit is contained in:
Mark Vejvoda
2010-12-26 02:15:56 +00:00
parent 40796f2d90
commit 8688ea955e

View File

@@ -207,15 +207,15 @@ void LogFileThread::addLogEntry(SystemFlags::DebugType type, string logEntry) {
entry.entryDateTime = time(NULL); entry.entryDateTime = time(NULL);
logList.push_back(entry); logList.push_back(entry);
if(logList.size() >= 100000) { if(logList.size() >= 750000) {
saveToDisk(false,true); saveToDisk(false,true);
} }
} }
bool LogFileThread::checkSaveCurrentLogBufferToDisk() { bool LogFileThread::checkSaveCurrentLogBufferToDisk() {
bool ret = false; bool ret = false;
if(difftime(time(NULL),lastSaveToDisk) >= 5 || if(difftime(time(NULL),lastSaveToDisk) >= 10 ||
LogFileThread::getLogEntryBufferCount() >= 100000) { LogFileThread::getLogEntryBufferCount() >= 500000) {
lastSaveToDisk = time(NULL); lastSaveToDisk = time(NULL);
ret = true; ret = true;
} }
@@ -280,7 +280,7 @@ void LogFileThread::saveToDisk(bool forceSaveAll,bool logListAlreadyLocked) {
//logCount = tempLogList.size(); //logCount = tempLogList.size();
if(forceSaveAll == false) { if(forceSaveAll == false) {
logCount = min(logCount,(std::size_t)250000); logCount = min(logCount,(std::size_t)1000000);
} }
for(int i = 0; i < logCount; ++i) { for(int i = 0; i < logCount; ++i) {