Skip to content

Fix #14206 --showtime does not account for addons#7904

Merged
olabetskyi merged 25 commits intodanmar:mainfrom
olabetskyi:fix_14206
Nov 6, 2025
Merged

Fix #14206 --showtime does not account for addons#7904
olabetskyi merged 25 commits intodanmar:mainfrom
olabetskyi:fix_14206

Conversation

@olabetskyi
Copy link
Copy Markdown
Collaborator

No description provided.

@firewave
Copy link
Copy Markdown
Collaborator

LGTM. As an improvement the time could also be collected for the individual addons.

@danmar
Copy link
Copy Markdown
Owner

danmar commented Oct 23, 2025

as a start LGTM.. I have some small nits.. like "cancell" should be "cancel". I would like that we reuse this timer for the "--showtime=file-total" output also so a different class name would be better.
do we need to have 2 individual timer classes?

Comment thread lib/valueflow.cpp
Comment thread cli/cppcheckexecutor.cpp Outdated
Comment thread lib/cppcheck.cpp
Comment thread lib/timer.cpp Outdated
Comment thread lib/cppcheck.cpp Outdated
Comment thread lib/timer.cpp Outdated
@olabetskyi olabetskyi marked this pull request as ready for review October 30, 2025 09:35
Comment thread lib/timer.h Outdated
Comment thread lib/timer.h Outdated
Comment thread lib/timer.cpp Outdated
Comment thread lib/timer.cpp Outdated
Comment thread lib/timer.h
Comment thread lib/timer.h
Copy link
Copy Markdown
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I run this command:

./cppcheck --showtime=top5_file lib/ctu.cpp lib/analyzerinfo.cpp

then I would like that the "file-total" time is shown for each file.

Comment thread lib/timer.cpp Outdated
if (minutes.count() > 0)
ellapsedTime += std::to_string(minutes.count()) + "m ";
std::string secondsStr{std::to_string(seconds.count())};
return (ellapsedTime + secondsStr.substr(0, secondsStr.length() - 3) + "s");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not defined how many digits secondStr has right? So if there are 10 digits I assume the output will have 7 digits and that is way too much.

Comment thread lib/timer.cpp Fixed
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Nov 6, 2025

@olabetskyi olabetskyi merged commit 2c5b872 into danmar:main Nov 6, 2025
55 checks passed
@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Nov 6, 2025

This added new functionality but no new tests were added. Am I missing something?

@olabetskyi
Copy link
Copy Markdown
Collaborator Author

This added new functionality but no new tests were added. Am I missing something?

Well you are not wrong but we doesn't have anything entirly new here and in tests we mostly check for newlines for the timer output which was chaned only slightly: we don't have overall timer now for top5_file and tests modifications reflect that. As for the time measurment we can't compare it to anything as it is always different. So I agree, some small test wouldn't hurt but I suppose we already cover the changes more or less

@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Nov 6, 2025

Thanks for the explanation.

The problem is that it does way more than the title says. It should have probably been split into two and gotten an additional ticket for the new timer.

@firewave
Copy link
Copy Markdown
Collaborator

I also see that it changed the format of the time. That should be documented in case somebody is parsing the output.

I filed https://trac.cppcheck.net/ticket/14253 about including the data in the XML output so it is in a proper parsable format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants