@@ -924,8 +924,8 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
924924 return mLogger ->exitcode ();
925925
926926 std::unique_ptr<OneShotTimer> checkTimeTimer;
927- if (mSettings .showtime == ShowTime::FILE || mSettings .showtime == ShowTime::FILE_TOTAL || mSettings .showtime == ShowTime::TOP5_FILE)
928- checkTimeTimer.reset (new OneShotTimer (" Check time: " + file.spath (), mSettings . showtime ));
927+ if (mSettings .showtime == Settings:: ShowTime::FILE || mSettings .showtime == Settings:: ShowTime::FILE_TOTAL || mSettings .showtime == Settings:: ShowTime::TOP5_FILE)
928+ checkTimeTimer.reset (new OneShotTimer (" Check time: " + file.spath ()));
929929
930930 if (!mSettings .quiet ) {
931931 std::string fixedpath = Path::toNativeSeparators (file.spath ());
@@ -1045,7 +1045,7 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
10451045 // Get configurations..
10461046 std::set<std::string> configurations;
10471047 if (maxConfigs > 1 ) {
1048- Timer::run (" Preprocessor::getConfigs" , mSettings . showtime , mTimerResults , [&]() {
1048+ Timer::run (" Preprocessor::getConfigs" , mTimerResults , [&]() {
10491049 configurations = preprocessor.getConfigs ();
10501050 });
10511051 } else {
@@ -1130,7 +1130,7 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
11301130
11311131 if (mSettings .preprocessOnly ) {
11321132 std::string codeWithoutCfg;
1133- Timer::run (" Preprocessor::getcode" , mSettings . showtime , mTimerResults , [&]() {
1133+ Timer::run (" Preprocessor::getcode" , mTimerResults , [&]() {
11341134 codeWithoutCfg = preprocessor.getcode (currentConfig, files, true );
11351135 });
11361136
@@ -1154,7 +1154,7 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
11541154 {
11551155 bool skipCfg = false ;
11561156 // Create tokens, skip rest of iteration if failed
1157- Timer::run (" Tokenizer::createTokens" , mSettings . showtime , mTimerResults , [&]() {
1157+ Timer::run (" Tokenizer::createTokens" , mTimerResults , [&]() {
11581158 simplecpp::OutputList outputList_cfg;
11591159 simplecpp::TokenList tokensP = preprocessor.preprocess (currentConfig, files, outputList_cfg);
11601160 const simplecpp::Output* o = preprocessor.handleErrors (outputList_cfg);
@@ -1180,8 +1180,7 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
11801180
11811181 Tokenizer tokenizer (std::move (tokenlist), mErrorLogger );
11821182 try {
1183- if (mSettings .showtime != ShowTime::NONE)
1184- tokenizer.setTimerResults (mTimerResults );
1183+ tokenizer.setTimerResults (mTimerResults );
11851184 tokenizer.setDirectives (directives); // TODO: how to avoid repeated copies?
11861185
11871186 // locations macros
@@ -1294,8 +1293,12 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
12941293 // TODO: clear earlier?
12951294 mLogger ->clear ();
12961295
1297- if (mTimerResults && (mSettings .showtime == ShowTime::FILE || mSettings .showtime == ShowTime::TOP5_FILE))
1298- mTimerResults ->showResults (mSettings .showtime );
1296+ if (mTimerResults ) {
1297+ if (mSettings .showtime == Settings::ShowTime::FILE)
1298+ mTimerResults ->showResults ();
1299+ else if (mSettings .showtime == Settings::ShowTime::TOP5_FILE)
1300+ mTimerResults ->showResults (5 );
1301+ }
12991302
13001303 return mLogger ->exitcode ();
13011304}
@@ -1354,7 +1357,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer, AnalyzerInformation
13541357 return ;
13551358 }
13561359
1357- Timer::run (check->name () + " ::runChecks" , mSettings . showtime , mTimerResults , [&]() {
1360+ Timer::run (check->name () + " ::runChecks" , mTimerResults , [&]() {
13581361 check->runChecks (tokenizer, &mErrorLogger );
13591362 });
13601363 }
@@ -1489,7 +1492,7 @@ void CppCheck::executeAddons(const std::string& dumpFile, const FileWithDetails&
14891492{
14901493 if (!dumpFile.empty ()) {
14911494 std::vector<std::string> f{dumpFile};
1492- Timer::run (" CppCheck::executeAddons" , mSettings . showtime , mTimerResults , [&]() {
1495+ Timer::run (" CppCheck::executeAddons" , mTimerResults , [&]() {
14931496 executeAddons (f, file.spath ());
14941497 });
14951498 }
0 commit comments