-
Notifications
You must be signed in to change notification settings - Fork 311
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
Changes from all commits
7e028fa
921a49f
2f6a3fa
65151aa
5c80f27
7339c7d
82ce024
b6fce1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
* Contact information: contact@sofa-framework.org * | ||
******************************************************************************/ | ||
#include <sofa/core/topology/TopologyHandler.h> | ||
|
||
#include <sofa/helper/AdvancedTimer.h> | ||
|
||
namespace sofa | ||
{ | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 . There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about using {} ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer the RAII version than incrementing the code :D There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand what you mean :) |
||
|
||
switch( changeType ) | ||
{ | ||
|
@@ -103,6 +105,7 @@ void TopologyHandler::ApplyTopologyChanges(const std::list<const core::topology: | |
break; | ||
}; // switch( changeType ) | ||
|
||
sofa::helper::AdvancedTimer::stepEnd(topoChangeType); | ||
//++changeIt; | ||
} | ||
} | ||
|
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 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 ?
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.
It is already what is doing parseTopologyChangeTypeToString. But the first part is to know in which class we are.
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.
Why not precomputing "DefaultTyopologyHandler+xxx" instead of re-computing it a loop ?
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.
Im not sure to understand, you mean having inside the class DefaultTopologyHandler a new map:
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.
Yes, it may even be a static map in the function.