Skip to content
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

[SofaBaseTopology] Clean Topology logs and add AdvanceTimer logs #874

Merged
merged 8 commits into from
Jan 11, 2019

Conversation

epernod
Copy link
Contributor

@epernod epernod commented Dec 21, 2018

  • change old sout/serr logs into msg_
  • replace some #ifndef NDEBUG by if (CHECK_TOPOLOGY)
  • Add AdvanceTimer logs during topology changes.

This PR:

  • builds with SUCCESS for all platforms on the CI.
  • does not generate new warnings.
  • does not generate new unit test failures.
  • does not generate new scene test failures.
  • does not break API compatibility.
  • is more than 1 week old (or has fast-merge label).

Reviewers will merge only if all these checks are true.

@epernod epernod added the pr: status to review To notify reviewers to review this pull-request label Dec 21, 2018
@epernod epernod self-assigned this Dec 21, 2018
@epernod
Copy link
Contributor Author

epernod commented Dec 21, 2018

[ci-build][with-all-tests]

@epernod epernod added the enhancement About a possible enhancement label Dec 21, 2018
@epernod epernod changed the title [SofaKernel] Clean Topology logs and add AdvanceTimer logs [SofaBaseTopology] Clean Topology logs and add AdvanceTimer logs Jan 2, 2019
@hugtalbot hugtalbot added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Jan 9, 2019
@@ -48,6 +48,8 @@ void TopologyHandler::ApplyTopologyChanges(const std::list<const core::topology:
for (changeIt=_changeList.begin(); changeIt!=_changeList.end(); ++changeIt)
{
core::topology::TopologyChangeType changeType = (*changeIt)->getChangeType();
std::string topoChangeType = "DefaultTopologyHandler: " + parseTopologyChangeTypeToString(changeType);
Copy link
Contributor

@damienmarchal damienmarchal Jan 10, 2019

Choose a reason for hiding this comment

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

I would not put string allocation + reallocation in a loop.
Wouldn't it be possible to have a static std::vector to map (with constant time access) the changeType to the timer string ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is already what is doing parseTopologyChangeTypeToString. But the first part is to know in which class we are.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not precomputing "DefaultTyopologyHandler+xxx" instead of re-computing it a loop ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im not sure to understand, you mean having inside the class DefaultTopologyHandler a new map:

map<core::topology::TopologyChangeType, std::string> handlerMap;
handlerMap[changeType] = " DefaultTopologyHandler: " + parseTopologyChangeTypeToString(changeType);

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it may even be a static map in the function.

@@ -48,6 +48,8 @@ void TopologyHandler::ApplyTopologyChanges(const std::list<const core::topology:
for (changeIt=_changeList.begin(); changeIt!=_changeList.end(); ++changeIt)
{
core::topology::TopologyChangeType changeType = (*changeIt)->getChangeType();
std::string topoChangeType = "DefaultTopologyHandler: " + parseTopologyChangeTypeToString(changeType);
sofa::helper::AdvancedTimer::stepBegin(topoChangeType);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is RAII based timers version to avoid the begin/end .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes we spoke about it wed. But I prefer the begin/end version to visually see the blocks

Copy link
Contributor

Choose a reason for hiding this comment

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

What about using {} ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer the RAII version than incrementing the code :D

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand what you mean :)

@guparan guparan merged commit d93877a into sofa-framework:master Jan 11, 2019
@epernod epernod deleted the topology_logs branch May 4, 2019 16:09
@guparan guparan added this to the v19.06 milestone Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement About a possible enhancement pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants