Skip to content

Commit 36427c3

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 b1ff85e commit 36427c3

17 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
@@ -452,7 +452,7 @@ jobs:
452452
453453
- name: Self check
454454
run: |
455-
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"
455+
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"
456456
ec=0
457457
458458
# early exit

.github/workflows/asan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
- name: Self check
8282
if: false
8383
run: |
84-
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"
84+
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"
8585
ec=0
8686
./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json cli lib || ec=1
8787
./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
@@ -81,7 +81,7 @@ jobs:
8181
- name: Self check
8282
if: false
8383
run: |
84-
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"
84+
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"
8585
ec=0
8686
./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1
8787
./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
@@ -77,7 +77,7 @@ jobs:
7777
# 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
7878
- name: Self check
7979
run: |
80-
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"
80+
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"
8181
ec=0
8282
./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json cli lib || ec=1
8383
./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
@@ -832,12 +832,22 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
832832
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_FILE;
833833
else if (showtimeMode == "summary")
834834
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_SUMMARY;
835-
else if (showtimeMode == "top5")
836-
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5;
837-
else if (showtimeMode.empty())
835+
else if (showtimeMode == "top5") {
836+
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_FILE;
837+
printMessage("--showtime=top5 is deprecated and will be removed in Cppcheck 2.13. Please use --showtime=top5_file or --showtime=top5_summary instead.");
838+
}
839+
else if (showtimeMode == "top5_file")
840+
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_FILE;
841+
else if (showtimeMode == "top5_summary")
842+
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_SUMMARY;
843+
else if (showtimeMode == "none")
838844
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_NONE;
845+
else if (showtimeMode.empty()) {
846+
printError("no mode provided for --showtime");
847+
return false;
848+
}
839849
else {
840-
printError("unrecognized showtime mode: \"" + showtimeMode + "\". Supported modes: file, summary, top5.");
850+
printError("unrecognized --showtime mode: '" + showtimeMode + "'");
841851
return false;
842852
}
843853
}
@@ -1307,7 +1317,20 @@ void CmdLineParser::printHelp()
13071317
" --rule-file=<file> Use given rule file. For more information, see:\n"
13081318
" http://sourceforge.net/projects/cppcheck/files/Articles/\n"
13091319
#endif
1310-
// TODO: document --showtime
1320+
" --showtime=<mode> Show timing information.\n"
1321+
" The available modes are:\n"
1322+
" * none\n"
1323+
" Show nothing (default)\n"
1324+
" * file\n"
1325+
" Show for each processed file\n"
1326+
" * summary\n"
1327+
" Show a summary at the end\n"
1328+
" * top5_file\n"
1329+
" Show the top 5 for each processed file\n"
1330+
" * top5_summary\n"
1331+
" Show the top 5 summary at the end\n"
1332+
" * top5\n"
1333+
" Alias for top5_file (deprecated)\n"
13111334
" --std=<id> Set standard.\n"
13121335
" The available options are:\n"
13131336
" * 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();
@@ -1852,7 +1852,7 @@ void CppCheck::resetTimerResults()
18521852
s_timerResults.reset();
18531853
}
18541854

1855-
void CppCheck::printTimerResultsSummary()
1855+
void CppCheck::printTimerResults(SHOWTIME_MODES mode)
18561856
{
1857-
s_timerResults.showResults(SHOWTIME_MODES::SHOWTIME_SUMMARY);
1857+
s_timerResults.showResults(mode);
18581858
}

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
@@ -65,7 +65,7 @@ void TimerResults::showResults(SHOWTIME_MODES mode) const
6565
}
6666
if (!hasParent)
6767
overallData.mClocks += iter->second.mClocks;
68-
if ((mode != SHOWTIME_MODES::SHOWTIME_TOP5) || (ordinal<=5)) {
68+
if ((mode != SHOWTIME_MODES::SHOWTIME_TOP5_FILE && mode != SHOWTIME_MODES::SHOWTIME_TOP5_SUMMARY) || (ordinal<=5)) {
6969
std::cout << iter->first << ": " << sec << "s (avg. " << secAverage << "s - " << iter->second.mNumberOfResults << " result(s))" << std::endl;
7070
}
7171
++ordinal;

lib/timer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ enum class SHOWTIME_MODES {
3131
SHOWTIME_NONE = 0,
3232
SHOWTIME_FILE,
3333
SHOWTIME_SUMMARY,
34-
SHOWTIME_TOP5
34+
SHOWTIME_TOP5_SUMMARY,
35+
SHOWTIME_TOP5_FILE
3536
};
3637

3738
class CPPCHECKLIB TimerResultsIntf {

0 commit comments

Comments
 (0)