Skip to content

Commit e6ea41d

Browse files
committed
deprecated --showtime=top5 and introduced the modes top5_file and top5_summary / temporarily disabled collecting of timing information in daca
1 parent dd5d443 commit e6ea41d

16 files changed

Lines changed: 199 additions & 40 deletions

.github/workflows/CI-unixish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ jobs:
460460
461461
- name: Self check
462462
run: |
463-
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings --check-level=exhaustive"
463+
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5_summary -D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings --check-level=exhaustive"
464464
ec=0
465465
466466
# early exit

.github/workflows/asan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
- name: Self check
8383
if: false
8484
run: |
85-
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings"
85+
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5_summary -D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings"
8686
ec=0
8787
./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json cli lib || ec=1
8888
./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1

.github/workflows/tsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
- name: Self check
8383
if: false
8484
run: |
85-
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings"
85+
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5_summary -D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings"
8686
ec=0
8787
./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1
8888
./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1

.github/workflows/ubsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
# TODO: only fail the step on sanitizer issues - since we use processes it will only fail the underlying process which will result in an cppcheckError
7979
- name: Self check
8080
run: |
81-
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings"
81+
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5_summary -D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings"
8282
ec=0
8383
./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json cli lib || ec=1
8484
./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1

cli/cmdlineparser.cpp

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -821,12 +821,22 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
821821
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_FILE_TOTAL;
822822
else if (showtimeMode == "summary")
823823
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_SUMMARY;
824-
else if (showtimeMode == "top5")
825-
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5;
826-
else if (showtimeMode.empty())
824+
else if (showtimeMode == "top5") {
825+
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_FILE;
826+
printMessage("--showtime=top5 is deprecated and will be removed in Cppcheck 2.13. Please use --showtime=top5_file or --showtime=top5_summary instead.");
827+
}
828+
else if (showtimeMode == "top5_file")
829+
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_FILE;
830+
else if (showtimeMode == "top5_summary")
831+
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_SUMMARY;
832+
else if (showtimeMode == "none")
827833
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_NONE;
834+
else if (showtimeMode.empty()) {
835+
printError("no mode provided for --showtime");
836+
return false;
837+
}
828838
else {
829-
printError("unrecognized showtime mode: \"" + showtimeMode + "\". Supported modes: file, file-total, summary, top5.");
839+
printError("unrecognized --showtime mode: \"" + showtimeMode + "\". Supported modes: file, file-total, summary, top5.");
830840
return false;
831841
}
832842
}
@@ -1296,7 +1306,20 @@ void CmdLineParser::printHelp()
12961306
" --rule-file=<file> Use given rule file. For more information, see:\n"
12971307
" http://sourceforge.net/projects/cppcheck/files/Articles/\n"
12981308
#endif
1299-
// TODO: document --showtime
1309+
" --showtime=<mode> Show timing information.\n"
1310+
" The available modes are:\n"
1311+
" * none\n"
1312+
" Show nothing (default)\n"
1313+
" * file\n"
1314+
" Show for each processed file\n"
1315+
" * summary\n"
1316+
" Show a summary at the end\n"
1317+
" * top5_file\n"
1318+
" Show the top 5 for each processed file\n"
1319+
" * top5_summary\n"
1320+
" Show the top 5 summary at the end\n"
1321+
" * top5\n"
1322+
" Alias for top5_file (deprecated)\n"
13001323
" --std=<id> Set standard.\n"
13011324
" The available options are:\n"
13021325
" * c89\n"

cli/threadexecutor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ unsigned int ThreadExecutor::check()
198198
return v + f.get();
199199
});
200200

201-
if (mSettings.showtime == SHOWTIME_MODES::SHOWTIME_SUMMARY)
202-
CppCheck::printTimerResultsSummary();
201+
if (mSettings.showtime == SHOWTIME_MODES::SHOWTIME_SUMMARY || mSettings.showtime == SHOWTIME_MODES::SHOWTIME_TOP5_SUMMARY)
202+
CppCheck::printTimerResults(mSettings.showtime);
203203

204204
return result;
205205
}

lib/cppcheck.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ CppCheck::~CppCheck()
405405
mFileInfo.pop_back();
406406
}
407407

408-
if (mSettings.showtime != SHOWTIME_MODES::SHOWTIME_SUMMARY)
409-
s_timerResults.showResults(mSettings.showtime);
408+
if (mSettings.showtime == SHOWTIME_MODES::SHOWTIME_FILE || mSettings.showtime == SHOWTIME_MODES::SHOWTIME_TOP5_FILE)
409+
printTimerResults(mSettings.showtime);
410410

411411
if (mPlistFile.is_open()) {
412412
mPlistFile << ErrorLogger::plistFooter();
@@ -1841,7 +1841,7 @@ void CppCheck::resetTimerResults()
18411841
s_timerResults.reset();
18421842
}
18431843

1844-
void CppCheck::printTimerResultsSummary()
1844+
void CppCheck::printTimerResults(SHOWTIME_MODES mode)
18451845
{
1846-
s_timerResults.showResults(SHOWTIME_MODES::SHOWTIME_SUMMARY);
1846+
s_timerResults.showResults(mode);
18471847
}

lib/cppcheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class CPPCHECKLIB CppCheck : ErrorLogger {
142142
void removeCtuInfoFiles(const std::map<std::string, std::size_t>& files); // cppcheck-suppress functionConst // has side effects
143143

144144
static void resetTimerResults();
145-
static void printTimerResultsSummary();
145+
static void printTimerResults(SHOWTIME_MODES mode);
146146

147147
private:
148148
#ifdef HAVE_RULES

lib/timer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void TimerResults::showResults(SHOWTIME_MODES mode) const
6969
}
7070
if (!hasParent)
7171
overallData.mClocks += iter->second.mClocks;
72-
if ((mode != SHOWTIME_MODES::SHOWTIME_TOP5) || (ordinal<=5)) {
72+
if ((mode != SHOWTIME_MODES::SHOWTIME_TOP5_FILE && mode != SHOWTIME_MODES::SHOWTIME_TOP5_SUMMARY) || (ordinal<=5)) {
7373
std::cout << iter->first << ": " << sec << "s (avg. " << secAverage << "s - " << iter->second.mNumberOfResults << " result(s))" << std::endl;
7474
}
7575
++ordinal;

lib/timer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ enum class SHOWTIME_MODES {
3232
SHOWTIME_FILE,
3333
SHOWTIME_FILE_TOTAL,
3434
SHOWTIME_SUMMARY,
35-
SHOWTIME_TOP5
35+
SHOWTIME_TOP5_SUMMARY,
36+
SHOWTIME_TOP5_FILE
3637
};
3738

3839
class CPPCHECKLIB TimerResultsIntf {

0 commit comments

Comments
 (0)