add profiling info
This commit is contained in:
@@ -284,26 +284,29 @@ struct UpdaterUnconstrainedMotion : public btIParallelForBody
|
|||||||
void btDiscreteDynamicsWorldMt::predictUnconstraintMotion( btScalar timeStep )
|
void btDiscreteDynamicsWorldMt::predictUnconstraintMotion( btScalar timeStep )
|
||||||
{
|
{
|
||||||
BT_PROFILE( "predictUnconstraintMotion" );
|
BT_PROFILE( "predictUnconstraintMotion" );
|
||||||
int grainSize = 50; // num of iterations per task for TBB
|
if ( m_nonStaticRigidBodies.size() > 0 )
|
||||||
int bodyCount = m_nonStaticRigidBodies.size();
|
{
|
||||||
UpdaterUnconstrainedMotion update;
|
UpdaterUnconstrainedMotion update;
|
||||||
update.timeStep = timeStep;
|
update.timeStep = timeStep;
|
||||||
update.rigidBodies = bodyCount ? &m_nonStaticRigidBodies[ 0 ] : NULL;
|
update.rigidBodies = &m_nonStaticRigidBodies[ 0 ];
|
||||||
btParallelFor( 0, bodyCount, grainSize, update );
|
int grainSize = 50; // num of iterations per task for task scheduler
|
||||||
|
btParallelFor( 0, m_nonStaticRigidBodies.size(), grainSize, update );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void btDiscreteDynamicsWorldMt::createPredictiveContacts( btScalar timeStep )
|
void btDiscreteDynamicsWorldMt::createPredictiveContacts( btScalar timeStep )
|
||||||
{
|
{
|
||||||
|
BT_PROFILE( "createPredictiveContacts" );
|
||||||
releasePredictiveContacts();
|
releasePredictiveContacts();
|
||||||
int grainSize = 50; // num of iterations per task for TBB or OPENMP
|
if ( m_nonStaticRigidBodies.size() > 0 )
|
||||||
if ( int bodyCount = m_nonStaticRigidBodies.size() )
|
|
||||||
{
|
{
|
||||||
UpdaterCreatePredictiveContacts update;
|
UpdaterCreatePredictiveContacts update;
|
||||||
update.world = this;
|
update.world = this;
|
||||||
update.timeStep = timeStep;
|
update.timeStep = timeStep;
|
||||||
update.rigidBodies = &m_nonStaticRigidBodies[ 0 ];
|
update.rigidBodies = &m_nonStaticRigidBodies[ 0 ];
|
||||||
btParallelFor( 0, bodyCount, grainSize, update );
|
int grainSize = 50; // num of iterations per task for task scheduler
|
||||||
|
btParallelFor( 0, m_nonStaticRigidBodies.size(), grainSize, update );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,14 +314,14 @@ void btDiscreteDynamicsWorldMt::createPredictiveContacts( btScalar timeStep )
|
|||||||
void btDiscreteDynamicsWorldMt::integrateTransforms( btScalar timeStep )
|
void btDiscreteDynamicsWorldMt::integrateTransforms( btScalar timeStep )
|
||||||
{
|
{
|
||||||
BT_PROFILE( "integrateTransforms" );
|
BT_PROFILE( "integrateTransforms" );
|
||||||
int grainSize = 50; // num of iterations per task for TBB or OPENMP
|
if ( m_nonStaticRigidBodies.size() > 0 )
|
||||||
if ( int bodyCount = m_nonStaticRigidBodies.size() )
|
|
||||||
{
|
{
|
||||||
UpdaterIntegrateTransforms update;
|
UpdaterIntegrateTransforms update;
|
||||||
update.world = this;
|
update.world = this;
|
||||||
update.timeStep = timeStep;
|
update.timeStep = timeStep;
|
||||||
update.rigidBodies = &m_nonStaticRigidBodies[ 0 ];
|
update.rigidBodies = &m_nonStaticRigidBodies[ 0 ];
|
||||||
btParallelFor( 0, bodyCount, grainSize, update );
|
int grainSize = 50; // num of iterations per task for task scheduler
|
||||||
|
btParallelFor( 0, m_nonStaticRigidBodies.size(), grainSize, update );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -548,6 +548,7 @@ void btSimulationIslandManagerMt::mergeIslands()
|
|||||||
|
|
||||||
void btSimulationIslandManagerMt::serialIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, IslandCallback* callback )
|
void btSimulationIslandManagerMt::serialIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, IslandCallback* callback )
|
||||||
{
|
{
|
||||||
|
BT_PROFILE( "serialIslandDispatch" );
|
||||||
// serial dispatch
|
// serial dispatch
|
||||||
btAlignedObjectArray<Island*>& islands = *islandsPtr;
|
btAlignedObjectArray<Island*>& islands = *islandsPtr;
|
||||||
for ( int i = 0; i < islands.size(); ++i )
|
for ( int i = 0; i < islands.size(); ++i )
|
||||||
@@ -592,6 +593,7 @@ struct UpdateIslandDispatcher : public btIParallelForBody
|
|||||||
|
|
||||||
void btSimulationIslandManagerMt::parallelIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, IslandCallback* callback )
|
void btSimulationIslandManagerMt::parallelIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, IslandCallback* callback )
|
||||||
{
|
{
|
||||||
|
BT_PROFILE( "parallelIslandDispatch" );
|
||||||
int grainSize = 1; // iterations per task
|
int grainSize = 1; // iterations per task
|
||||||
UpdateIslandDispatcher dispatcher;
|
UpdateIslandDispatcher dispatcher;
|
||||||
dispatcher.islandsPtr = islandsPtr;
|
dispatcher.islandsPtr = islandsPtr;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
|
|
||||||
#include "btThreads.h"
|
#include "btThreads.h"
|
||||||
|
#include "btQuickprof.h"
|
||||||
#include <algorithm> // for min and max
|
#include <algorithm> // for min and max
|
||||||
|
|
||||||
#if BT_THREADSAFE
|
#if BT_THREADSAFE
|
||||||
@@ -114,10 +115,12 @@ public:
|
|||||||
}
|
}
|
||||||
virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE
|
virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE
|
||||||
{
|
{
|
||||||
|
BT_PROFILE( "parallelFor_OpenMP" );
|
||||||
btPushThreadsAreRunning();
|
btPushThreadsAreRunning();
|
||||||
#pragma omp parallel for schedule( static, 1 )
|
#pragma omp parallel for schedule( static, 1 )
|
||||||
for ( int i = iBegin; i < iEnd; i += grainSize )
|
for ( int i = iBegin; i < iEnd; i += grainSize )
|
||||||
{
|
{
|
||||||
|
BT_PROFILE( "OpenMP_job" );
|
||||||
body.forLoop( i, ( std::min )( i + grainSize, iEnd ) );
|
body.forLoop( i, ( std::min )( i + grainSize, iEnd ) );
|
||||||
}
|
}
|
||||||
btPopThreadsAreRunning();
|
btPopThreadsAreRunning();
|
||||||
@@ -174,11 +177,13 @@ public:
|
|||||||
|
|
||||||
void operator()( const tbb::blocked_range<int>& range ) const
|
void operator()( const tbb::blocked_range<int>& range ) const
|
||||||
{
|
{
|
||||||
|
BT_PROFILE( "TBB_job" );
|
||||||
mBody->forLoop( range.begin(), range.end() );
|
mBody->forLoop( range.begin(), range.end() );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE
|
virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE
|
||||||
{
|
{
|
||||||
|
BT_PROFILE( "parallelFor_TBB" );
|
||||||
// TBB dispatch
|
// TBB dispatch
|
||||||
BodyAdapter tbbBody;
|
BodyAdapter tbbBody;
|
||||||
tbbBody.mBody = &body;
|
tbbBody.mBody = &body;
|
||||||
@@ -232,11 +237,13 @@ public:
|
|||||||
|
|
||||||
void operator()( int i ) const
|
void operator()( int i ) const
|
||||||
{
|
{
|
||||||
|
BT_PROFILE( "PPL_job" );
|
||||||
mBody->forLoop( i, ( std::min )( i + mGrainSize, mIndexEnd ) );
|
mBody->forLoop( i, ( std::min )( i + mGrainSize, mIndexEnd ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE
|
virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE
|
||||||
{
|
{
|
||||||
|
BT_PROFILE( "parallelFor_PPL" );
|
||||||
// PPL dispatch
|
// PPL dispatch
|
||||||
BodyAdapter pplBody;
|
BodyAdapter pplBody;
|
||||||
pplBody.mBody = &body;
|
pplBody.mBody = &body;
|
||||||
@@ -488,6 +495,7 @@ public:
|
|||||||
virtual void setNumThreads( int numThreads ) BT_OVERRIDE {}
|
virtual void setNumThreads( int numThreads ) BT_OVERRIDE {}
|
||||||
virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE
|
virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE
|
||||||
{
|
{
|
||||||
|
BT_PROFILE( "parallelFor_sequential" );
|
||||||
body.forLoop( iBegin, iEnd );
|
body.forLoop( iBegin, iEnd );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user