Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sampling period for computing the rolling average real time factor #758
Sampling period for computing the rolling average real time factor #758
Changes from 5 commits
dfdbea3
c86b331
8edbea8
540f0b2
9bb9d45
8519ba2
2ff7de3
55ce42e
af7bf1f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elapsedSimTime
andelapsedRealTime
are two differentstd::chrono::duration
types associated with different clocks. The former is associated withTime
, which is an alias forstd::chrono::steady_clock
and represents real time, while the latter is associated withcosim::detail::clock
, which is a clock defined to represent simulation time. Therefore, it might be fragile to use theircount()
values like this, because it assumes that their tick period is the same.Two options:
std::duration_cast
calls and cast them to a common type with the same tick period.static_assert(decltype(elapsedSimTime)::period == decltype(elapsedRealTime)::period);
I think I prefer the first one if it works, but there may be arguments in favour of the latter too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now that this is old code moved from elsewhere in the file. But then this is a good opportunity to fix it. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
duration_cast
as well as inupdate_rolling_average_real_time_factor
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After adding duration_cast (or some other updates), I see noticeable performance drops. Investigating on it..The issue was due to my laptop, updated as suggested.