Revision: 8878
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8878&view=rev
Author:   hsujohnhsu
Date:     2010-09-02 02:56:29 +0000 (Thu, 02 Sep 2010)

Log Message:
-----------
add timer macro test, update experimental ode stuff

Modified Paths:
--------------
    code/gazebo/branches/wg/server/Timer.hh
    code/gazebo/branches/wg/server/physics/ode/ODEPhysics.cc
    code/gazebo/branches/wg/server/physics/ode/ODEPhysics.hh

Modified: code/gazebo/branches/wg/server/Timer.hh
===================================================================
--- code/gazebo/branches/wg/server/Timer.hh     2010-09-02 02:55:54 UTC (rev 
8877)
+++ code/gazebo/branches/wg/server/Timer.hh     2010-09-02 02:56:29 UTC (rev 
8878)
@@ -26,11 +26,18 @@
 #ifndef TIMER_HH
 #define TIMER_HH
 
+#include "gazebo_config.h"
 #include "GazeboMessage.hh"
 #include "Time.hh"
 #include <iostream>
 #include <iomanip>
 
+#ifdef ENABLE_TIMERS
+#define DIAGNOSTICTIMER(x) DiagnosticTimer x
+#else
+#define DIAGNOSTICTIMER(x) ((void)0)
+#endif
+
 namespace gazebo
 {
   /// \brief A timer class

Modified: code/gazebo/branches/wg/server/physics/ode/ODEPhysics.cc
===================================================================
--- code/gazebo/branches/wg/server/physics/ode/ODEPhysics.cc    2010-09-02 
02:55:54 UTC (rev 8877)
+++ code/gazebo/branches/wg/server/physics/ode/ODEPhysics.cc    2010-09-02 
02:56:29 UTC (rev 8878)
@@ -88,6 +88,16 @@
   dWorldSetAutoDisableSteps(this->worldId, 50);
 
   Param::Begin(&this->parameters);
+
+#ifdef QUICKSTEP_EXPERIMENTAL
+  /// experimental ode stuff
+  this->islandThreadsP = new ParamT<int>("islandThreads",0,0); // number of 
thread pool threads for islands
+  this->quickStepThreadsP = new ParamT<int>("quickStepThreads",0,0); // number 
of thread pool threads for quickstep
+  this->quickStepChunksP = new ParamT<int>("quickStepChunks",1,0); // number 
of thread pool threads for islands
+  this->quickStepOverlapP = new ParamT<int>("quickStepOverlap",0,0); // number 
of thread pool threads for islands
+  this->quickStepToleranceP = new ParamT<double>("quickStepTolerance",0,0); // 
number of thread pool threads for islands
+#endif
+
   this->globalCFMP = new ParamT<double>("cfm", 10e-5, 0);
   this->globalERPP = new ParamT<double>("erp", 0.2, 0);
   this->stepTypeP = new ParamT<std::string>("stepType", "quick", 0);
@@ -110,7 +120,6 @@
 }
 
 
-
 
////////////////////////////////////////////////////////////////////////////////
 // Destructor
 ODEPhysics::~ODEPhysics()
@@ -126,6 +135,15 @@
   this->spaceId = NULL;
   this->worldId = NULL;
 
+#ifdef QUICKSTEP_EXPERIMENTAL
+  /// experimental ode stuff
+  delete this->islandThreadsP;
+  delete this->quickStepThreadsP;
+  delete this->quickStepChunksP;
+  delete this->quickStepOverlapP;
+  delete this->quickStepToleranceP;
+#endif
+
   delete this->globalCFMP;
   delete this->globalERPP;
   delete this->stepTypeP;
@@ -153,6 +171,20 @@
   if (node)
     cnode = node->GetChild("ode", "physics");
 
+#ifdef QUICKSTEP_EXPERIMENTAL
+  /// experimental ode stuff
+  this->islandThreadsP->Load(cnode);
+  this->quickStepThreadsP->Load(cnode);
+  this->quickStepChunksP->Load(cnode);
+  this->quickStepOverlapP->Load(cnode);
+  this->quickStepToleranceP->Load(cnode);
+  dWorldSetIslandThreads(this->worldId, this->islandThreadsP->GetValue() );
+  dWorldSetQuickStepThreads(this->worldId, this->quickStepThreadsP->GetValue() 
);
+  dWorldSetQuickStepNumChunks(this->worldId, 
this->quickStepChunksP->GetValue() );
+  dWorldSetQuickStepNumOverlap(this->worldId, 
this->quickStepOverlapP->GetValue() );
+  dWorldSetQuickStepTolerance(this->worldId, 
this->quickStepToleranceP->GetValue() );
+#endif
+ 
   this->gravityP->Load(cnode);
   this->stepTimeP->Load(cnode);
   this->updateRateP->Load(cnode);
@@ -218,6 +250,14 @@
 void ODEPhysics::Save(std::string &prefix, std::ostream &stream)
 {
   stream << prefix << "<physics:ode>\n";
+  // experimental ode stuff
+#ifdef QUICKSTEP_EXPERIMENTAL
+  stream << prefix << "  " << *(this->islandThreadsP) << "\n";
+  stream << prefix << "  " << *(this->quickStepThreadsP) << "\n";
+  stream << prefix << "  " << *(this->quickStepChunksP) << "\n";
+  stream << prefix << "  " << *(this->quickStepOverlapP) << "\n";
+  stream << prefix << "  " << *(this->quickStepToleranceP) << "\n";
+#endif
   stream << prefix << "  " << *(this->stepTimeP) << "\n";
   stream << prefix << "  " << *(this->gravityP) << "\n";
   stream << prefix << "  " << *(this->updateRateP) << "\n";
@@ -338,7 +378,7 @@
   // Do collision detection; this will add contacts to the contact group
   this->LockMutex(); 
   {
-    //DiagnosticTimer timer("ODEPhysics Collision Update");
+    DIAGNOSTICTIMER(timer("ODEPhysics Collision dSpaceCollide",1));
     dSpaceCollide( this->spaceId, this, CollisionCallback );
   }
   this->UnlockMutex(); 
@@ -385,25 +425,33 @@
 {
   PhysicsEngine::UpdatePhysics();
 
-  this->UpdateCollision();
+  {
+    DIAGNOSTICTIMER(timer("ODEPhysics: UpdateCollision",1));
+    this->UpdateCollision();
+  }
 
-  this->LockMutex(); 
+  {
+    DIAGNOSTICTIMER(timer("ODEPhysics: LockMutex",1));
+    this->LockMutex(); 
+  }
 
-  //DiagnosticTimer timer("ODEPhysics Step Update");
-
   // Update the dynamical model
   /// \brief @todo: quickStepP used here for backwards compatibility,
   ///        should tick tock deprecation as we switch to nested tags
-  if (**this->stepTypeP == "quick" || **this->quickStepP == true)
-    dWorldQuickStep(this->worldId, (**this->stepTimeP).Double());
-  else if (**this->stepTypeP == "world")
-    dWorldStep( this->worldId, (**this->stepTimeP).Double() );
-  else
-    gzthrow(std::string("Invalid step type[") + **this->stepTypeP);
+  {
+    DIAGNOSTICTIMER(timer("ODEPhysics: Constraint Solver",1));
 
-  // Very important to clear out the contact group
-  dJointGroupEmpty( this->contactGroup );
+    if (**this->stepTypeP == "quick" || **this->quickStepP == true)
+      dWorldQuickStep(this->worldId, (**this->stepTimeP).Double());
+    else if (**this->stepTypeP == "world")
+      dWorldStep( this->worldId, (**this->stepTimeP).Double() );
+    else
+      gzthrow(std::string("Invalid step type[") + **this->stepTypeP);
 
+    // Very important to clear out the contact group
+    dJointGroupEmpty( this->contactGroup );
+  }
+
   this->UnlockMutex(); 
 }
 

Modified: code/gazebo/branches/wg/server/physics/ode/ODEPhysics.hh
===================================================================
--- code/gazebo/branches/wg/server/physics/ode/ODEPhysics.hh    2010-09-02 
02:55:54 UTC (rev 8877)
+++ code/gazebo/branches/wg/server/physics/ode/ODEPhysics.hh    2010-09-02 
02:56:29 UTC (rev 8878)
@@ -29,6 +29,8 @@
 
 #include <ode/ode.h>
 
+#include "gazebo_config.h"
+
 #include "Param.hh"
 #include "PhysicsEngine.hh"
 #include "Shape.hh"
@@ -218,6 +220,16 @@
   private: std::map<std::string, dSpaceID> spaces;
 
   private: std::vector<dContactGeom> contactGeoms;
+
+#ifdef QUICKSTEP_EXPERIMENTAL
+  /// experimental ode stuff
+  private: ParamT<int>    *islandThreadsP; // number of thread pool threads 
for islands
+  private: ParamT<int>    *quickStepThreadsP; // number of thread pool threads 
for quickstep
+  private: ParamT<int>    *quickStepChunksP; // number of thread pool threads 
for islands
+  private: ParamT<int>    *quickStepOverlapP; // number of thread pool threads 
for islands
+  private: ParamT<double> *quickStepToleranceP; // number of thread pool 
threads for islands
+#endif
+
 };
 
 /** \}*/


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to