Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ void SubCollisionPipeline::computeCollisionReset()
void SubCollisionPipeline::computeCollisionDetection()
{
const std::string timerPrefix = formatComponentName(this->getName()) + " ";
SCOPED_TIMER_VARNAME(docollisiontimer, timerPrefix + "doCollisionDetection");
const std::string globalTimerName = timerPrefix + "doCollisionDetection";
SCOPED_TIMER_VARNAME_DYN(docollisiontimer, globalTimerName.c_str());

if (!this->isComponentStateValid())
return;
Expand All @@ -182,7 +183,8 @@ void SubCollisionPipeline::computeCollisionDetection()
// These hierarchical structures enable efficient spatial queries
type::vector<CollisionModel*> vectBoundingVolume;
{
SCOPED_TIMER_VARNAME(bboxtimer, timerPrefix + "ComputeBoundingTree");
const std::string localTimerName = timerPrefix + "ComputeBoundingTree";
SCOPED_TIMER_VARNAME_DYN(bboxtimer, localTimerName.c_str());

// Check if continuous collision detection (CCD) is enabled
const bool continuous = l_intersectionMethod->useContinuous();
Expand All @@ -209,14 +211,14 @@ void SubCollisionPipeline::computeCollisionDetection()
{
// CCD: Compute swept bounding volumes that cover the motion trajectory
const std::string msg = timerPrefix + "Compute Continuous BoundingTree: " + (*it)->getName();
SCOPED_TIMER(msg.c_str());
SCOPED_TIMER_DYN(msg.c_str());
(*it)->computeContinuousBoundingTree(dt, continuousIntersectionType, used_depth);
}
else
{
// Discrete: Compute bounding volumes at current positions
std::string msg = timerPrefix + "Compute BoundingTree: " + (*it)->getName();
SCOPED_TIMER(msg.c_str());
SCOPED_TIMER_DYN(msg.c_str());
(*it)->computeBoundingTree(used_depth);
}

Expand All @@ -234,7 +236,8 @@ void SubCollisionPipeline::computeCollisionDetection()
msg_info() << "doCollisionDetection, BroadPhaseDetection "<<l_broadPhaseDetection->getName();

{
SCOPED_TIMER_VARNAME(broadphase, timerPrefix + "BroadPhase");
const std::string localTimerName = timerPrefix + "BroadPhase";
SCOPED_TIMER_VARNAME_DYN(broadphase, localTimerName.c_str());
l_intersectionMethod->beginBroadPhase();
l_broadPhaseDetection->beginBroadPhase();
l_broadPhaseDetection->addCollisionModels(vectBoundingVolume); // Actual detection happens here
Expand All @@ -247,7 +250,8 @@ void SubCollisionPipeline::computeCollisionDetection()
msg_info() << "doCollisionDetection, NarrowPhaseDetection "<< l_narrowPhaseDetection->getName();

{
SCOPED_TIMER_VARNAME(narrowphase, timerPrefix + "NarrowPhase");
const std::string localTimerName = timerPrefix + "NarrowPhase";
SCOPED_TIMER_VARNAME_DYN(narrowphase, localTimerName.c_str());
l_intersectionMethod->beginNarrowPhase();
l_narrowPhaseDetection->beginNarrowPhase();

Expand Down
8 changes: 7 additions & 1 deletion Sofa/framework/Helper/src/sofa/helper/ScopedAdvancedTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ ScopedAdvancedTimer::ScopedAdvancedTimer(const char* message, T* obj)
#ifdef TRACY_ENABLE
#include <tracy/Tracy.hpp>
#define SCOPED_TIMER_TR(name) ZoneScopedN(name)
#define SCOPED_TIMER_DYN_TR(name) ZoneTransientN( ___tracy_scoped_zone,name, true)
#define SCOPED_TIMER_VARNAME_TR(varname, name) ZoneNamedN(varname##_tr, name, true)
#define SCOPED_TIMER_VARNAME_DYN_TR(varname, name) ZoneTransientN(varname##_tr, name, true)
#else
#define SCOPED_TIMER_TR(name)
#define SCOPED_TIMER_DYN_TR(name)
#define SCOPED_TIMER_VARNAME_TR(varname, name)
#define SCOPED_TIMER_VARNAME_DYN_TR(varname, name)
#endif

#ifdef SOFA_ENABLE_SCOPED_ADVANCED_TIMER
Expand All @@ -81,4 +85,6 @@ ScopedAdvancedTimer::ScopedAdvancedTimer(const char* message, T* obj)
#endif

#define SCOPED_TIMER(name) SCOPED_TIMER_TR(name); SCOPED_TIMER_AD(name)
#define SCOPED_TIMER_VARNAME(varname, name) SCOPED_TIMER_VARNAME_TR(varname, name); SCOPED_TIMER_VARNAME_AD(varname, name)
#define SCOPED_TIMER_DYN(name) SCOPED_TIMER_DYN_TR(name); SCOPED_TIMER_AD(name)
#define SCOPED_TIMER_VARNAME(varname, name) SCOPED_TIMER_VARNAME_TR(varname, name); SCOPED_TIMER_VARNAME_AD(varname, name)
#define SCOPED_TIMER_VARNAME_DYN(varname, name) SCOPED_TIMER_VARNAME_DYN_TR(varname, name); SCOPED_TIMER_VARNAME_AD(varname, name)
Loading