Skip to content

Commit 1990b96

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 42a4a23 commit 1990b96

17 files changed

Lines changed: 200 additions & 41 deletions

.github/workflows/CI-unixish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ jobs:
446446
447447
- name: Self check
448448
run: |
449-
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --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"
449+
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5_summary -D__CPPCHECK__ --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"
450450
ec=0
451451
452452
# 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__ --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__ --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 -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/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__ --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__ --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
7878
- name: Self check
7979
run: |
80-
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --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__ --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 -DCHECK_INTERNAL 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
@@ -829,12 +829,22 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
829829
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_FILE;
830830
else if (showtimeMode == "summary")
831831
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_SUMMARY;
832-
else if (showtimeMode == "top5")
833-
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5;
834-
else if (showtimeMode.empty())
832+
else if (showtimeMode == "top5") {
833+
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_FILE;
834+
printMessage("--showtime=top5 is deprecated and will be removed in Cppcheck 2.13. Please use --showtime=top5_file or --showtime=top5_summary instead.");
835+
}
836+
else if (showtimeMode == "top5_file")
837+
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_FILE;
838+
else if (showtimeMode == "top5_summary")
839+
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_SUMMARY;
840+
else if (showtimeMode == "none")
835841
mSettings.showtime = SHOWTIME_MODES::SHOWTIME_NONE;
842+
else if (showtimeMode.empty()) {
843+
printError("no mode provided for --showtime");
844+
return false;
845+
}
836846
else {
837-
printError("unrecognized showtime mode: \"" + showtimeMode + "\". Supported modes: file, summary, top5.");
847+
printError("unrecognized --showtime mode: '" + showtimeMode + "'");
838848
return false;
839849
}
840850
}
@@ -1304,7 +1314,20 @@ void CmdLineParser::printHelp()
13041314
" --rule-file=<file> Use given rule file. For more information, see:\n"
13051315
" http://sourceforge.net/projects/cppcheck/files/Articles/\n"
13061316
#endif
1307-
// TODO: document --showtime
1317+
" --showtime=<mode> Show timing information.\n"
1318+
" The available modes are:\n"
1319+
" * none\n"
1320+
" Show nothing (default)\n"
1321+
" * file\n"
1322+
" Show for each processed file\n"
1323+
" * summary\n"
1324+
" Show a summary at the end\n"
1325+
" * top5_file\n"
1326+
" Show the top 5 for each processed file\n"
1327+
" * top5_summary\n"
1328+
" Show the top 5 summary at the end\n"
1329+
" * top5\n"
1330+
" Alias for top5_file (deprecated)\n"
13081331
" --std=<id> Set standard.\n"
13091332
" The available options are:\n"
13101333
" * c89\n"

cli/threadexecutor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ unsigned int ThreadExecutor::check()
195195
return v + f.get();
196196
});
197197

198-
if (mSettings.showtime == SHOWTIME_MODES::SHOWTIME_SUMMARY)
199-
CppCheck::printTimerResultsSummary();
198+
if (mSettings.showtime == SHOWTIME_MODES::SHOWTIME_SUMMARY || mSettings.showtime == SHOWTIME_MODES::SHOWTIME_TOP5_SUMMARY)
199+
CppCheck::printTimerResults(mSettings.showtime);
200200

201201
return result;
202202
}

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();
@@ -1858,7 +1858,7 @@ void CppCheck::resetTimerResults()
18581858
s_timerResults.reset();
18591859
}
18601860

1861-
void CppCheck::printTimerResultsSummary()
1861+
void CppCheck::printTimerResults(SHOWTIME_MODES mode)
18621862
{
1863-
s_timerResults.showResults(SHOWTIME_MODES::SHOWTIME_SUMMARY);
1863+
s_timerResults.showResults(mode);
18641864
}

lib/cppcheck.h

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

148148
static void resetTimerResults();
149-
static void printTimerResultsSummary();
149+
static void printTimerResults(SHOWTIME_MODES mode);
150150

151151
private:
152152
/** Are there "simple" 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)