Skip to content

Conversation

@olabetskyi
Copy link
Collaborator

No description provided.

@firewave
Copy link
Collaborator

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

@danmar
Copy link
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?

#include <algorithm>
#include <array>
#include <cassert>
#include <chrono>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we include it in the timer now

@sonarqubecloud
Copy link


int CppCheckExecutor::check(int argc, const char* const argv[])
{
Timer realTimeClock("", SHOWTIME_MODES::SHOWTIME_SUMMARY);
Copy link
Owner

Choose a reason for hiding this comment

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

I like that you made it a RAII. If the timer is moved down below the CmdLineParser then we don't need to cancel the timer. That could maybe loose a millisecond.. but this is acceptable imho. I don't care if the total time says 1.978s or 1.979s ..

if (Settings::terminated())
return mLogger->exitcode();

const Timer fileTotalTimer(mSettings.showtime == SHOWTIME_MODES::SHOWTIME_FILE_TOTAL, file.spath());
Copy link
Owner

Choose a reason for hiding this comment

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

I like the old interface so we don't have to cancel it..

, mStart(std::clock())
, mShowTimeMode(showtimeMode)
, mStopped(showtimeMode == SHOWTIME_MODES::SHOWTIME_NONE || showtimeMode == SHOWTIME_MODES::SHOWTIME_FILE_TOTAL)
, mStartTimePoint(Clock::now())
Copy link
Owner

Choose a reason for hiding this comment

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

I don't understand why we need to have both mStart and mStartTimePoint. Why not remove the std::clock() handling and always use Clock::now() instead?

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.

3 participants