CLI: write status messages
This commit is contained in:
parent
88c1e42bdb
commit
4bb62fc8b2
|
@ -317,6 +317,14 @@ unsigned int ThreadExecutor::check()
|
||||||
|
|
||||||
_itNextFile = _files.begin();
|
_itNextFile = _files.begin();
|
||||||
|
|
||||||
|
_processedFiles = 0;
|
||||||
|
_processedSize = 0;
|
||||||
|
_totalFiles = _files.size();
|
||||||
|
_totalFileSize = 0;
|
||||||
|
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
|
||||||
|
_totalFileSize += i->second;
|
||||||
|
}
|
||||||
|
|
||||||
InitializeCriticalSection(&_fileSync);
|
InitializeCriticalSection(&_fileSync);
|
||||||
InitializeCriticalSection(&_errorSync);
|
InitializeCriticalSection(&_errorSync);
|
||||||
InitializeCriticalSection(&_reportSync);
|
InitializeCriticalSection(&_reportSync);
|
||||||
|
@ -390,7 +398,9 @@ unsigned int __stdcall ThreadExecutor::threadProc(void *args)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
const std::string &file = (it++)->first;
|
const std::string &file = it->first;
|
||||||
|
const int fileSize = it->second;
|
||||||
|
it++;
|
||||||
|
|
||||||
LeaveCriticalSection(&threadExecutor->_fileSync);
|
LeaveCriticalSection(&threadExecutor->_fileSync);
|
||||||
|
|
||||||
|
@ -402,6 +412,17 @@ unsigned int __stdcall ThreadExecutor::threadProc(void *args)
|
||||||
result += fileChecker.check(file);
|
result += fileChecker.check(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnterCriticalSection(&threadExecutor->_fileSync);
|
||||||
|
|
||||||
|
threadExecutor->_processedSize += fileSize;
|
||||||
|
threadExecutor->_processedFiles++;
|
||||||
|
if (!threadExecutor->_settings._errorsOnly) {
|
||||||
|
EnterCriticalSection(&threadExecutor->_reportSync);
|
||||||
|
CppCheckExecutor::reportStatus(threadExecutor->_processedFiles, threadExecutor->_totalFiles, threadExecutor->_processedSize, threadExecutor->_totalFileSize);
|
||||||
|
LeaveCriticalSection(&threadExecutor->_reportSync);
|
||||||
|
}
|
||||||
|
|
||||||
|
LeaveCriticalSection(&threadExecutor->_fileSync);
|
||||||
};
|
};
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -102,6 +102,10 @@ private:
|
||||||
|
|
||||||
std::map<std::string, std::string> _fileContents;
|
std::map<std::string, std::string> _fileContents;
|
||||||
std::map<std::string, std::size_t>::const_iterator _itNextFile;
|
std::map<std::string, std::size_t>::const_iterator _itNextFile;
|
||||||
|
unsigned int _processedFiles;
|
||||||
|
unsigned int _totalFiles;
|
||||||
|
size_t _processedSize;
|
||||||
|
size_t _totalFileSize;
|
||||||
CRITICAL_SECTION _fileSync;
|
CRITICAL_SECTION _fileSync;
|
||||||
|
|
||||||
std::list<std::string> _errorList;
|
std::list<std::string> _errorList;
|
||||||
|
|
Loading…
Reference in New Issue