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

Log Message:
-----------
added diagnostics timers, msg level 6

Modified Paths:
--------------
    code/gazebo/branches/wg/server/Simulator.cc
    code/gazebo/branches/wg/server/World.cc
    code/gazebo/branches/wg/server/physics/ode/ODEPhysics.cc
    code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc

Modified: code/gazebo/branches/wg/server/Simulator.cc
===================================================================
--- code/gazebo/branches/wg/server/Simulator.cc 2010-09-02 02:56:29 UTC (rev 
8878)
+++ code/gazebo/branches/wg/server/Simulator.cc 2010-09-02 05:19:19 UTC (rev 
8879)
@@ -405,7 +405,7 @@
 {
   this->state = RUN;
 
-  //DiagnosticTimer timer("--------------------------- START 
Simulator::MainLoop() --------------------------");
+  //DIAGNOSTICTIMER(timer("--------------------------- START 
Simulator::MainLoop() --------------------------",6));
   Time currTime = 0;
   Time lastTime = 0;
   struct timespec timeSpec;
@@ -417,24 +417,41 @@
   // Update the gui
   while (!this->userQuit)
   {
+    DIAGNOSTICTIMER(timer("GUI LOOP",6));
+
     currTime = this->GetWallTime();
     if ( currTime - lastTime > 1.0/freq)
     {
       lastTime = this->GetWallTime();
 
       if (this->gui)
+      {
+        DIAGNOSTICTIMER(timer("GUI update",6));
         this->gui->Update();
+      }
 
       if (this->renderEngineEnabled)
       {
-        OgreAdaptor::Instance()->UpdateCameras();
-        World::Instance()->GraphicsUpdate();
+        {
+          DIAGNOSTICTIMER(timer("Camera update",6));
+          OgreAdaptor::Instance()->UpdateCameras();
+        }
+        {
+          DIAGNOSTICTIMER(timer("Graphics update",6));
+          World::Instance()->GraphicsUpdate();
+        }
       }
 
       currTime = this->GetWallTime();
 
-      World::Instance()->ProcessEntitiesToLoad();
-      World::Instance()->ProcessEntitiesToDelete();
+      {
+        DIAGNOSTICTIMER(timer("Process Entities to Load",6));
+        World::Instance()->ProcessEntitiesToLoad();
+      }
+      {
+        DIAGNOSTICTIMER(timer("Process Entities to Delete",6));
+        World::Instance()->ProcessEntitiesToDelete();
+      }
 
       if (currTime - lastTime < 1/freq)
       {
@@ -667,7 +684,9 @@
 
   while (!this->userQuit)
   {
-    //DiagnosticTimer timer("PhysicsLoop Timer ");
+    DIAGNOSTICTIMER(timer("PHYSICS LOOP ",6));
+
+    //DIAGNOSTICTIMER(timer("PhysicsLoop Timer ",6));
     currTime = this->GetRealTime();
 
     // performance wise, this is not ideal, move this outside of while loop 
and use signals and slots.
@@ -684,9 +703,18 @@
     lastTime = this->GetRealTime();
 
     {
-      boost::recursive_mutex::scoped_lock lock(*this->GetMRMutex());
-      boost::recursive_mutex::scoped_lock 
model_delete_lock(*this->GetMDMutex());
-      world->Update();
+      {
+        DIAGNOSTICTIMER(timer("PhysicsLoop Get Rendering Mutex ",6));
+        boost::recursive_mutex::scoped_lock lock(*this->GetMRMutex());
+      }
+      {
+        DIAGNOSTICTIMER(timer("PhysicsLoop Get Model Mutex ",6));
+        boost::recursive_mutex::scoped_lock 
model_delete_lock(*this->GetMDMutex());
+      }
+      {
+        DIAGNOSTICTIMER(timer("PhysicsLoop world->Update() ",6));
+        world->Update();
+      }
     }
 
     currTime = this->GetRealTime();
@@ -722,7 +750,7 @@
     nanosleep(&req, &rem);
 
     {
-      //DiagnosticTimer timer("PhysicsLoop UpdateSimIfaces ");
+      DIAGNOSTICTIMER(timer("PhysicsLoop UpdateSimIfaces ",6));
 
       // Process all incoming messages from simiface
       world->UpdateSimulationIface();

Modified: code/gazebo/branches/wg/server/World.cc
===================================================================
--- code/gazebo/branches/wg/server/World.cc     2010-09-02 02:56:29 UTC (rev 
8878)
+++ code/gazebo/branches/wg/server/World.cc     2010-09-02 05:19:19 UTC (rev 
8879)
@@ -336,7 +336,7 @@
   }
 
   {
-    //DiagnosticTimer timer("World::Update Models");
+    DIAGNOSTICTIMER(timer("World::Update Models",6));
 
     // Update all the models
     std::vector< Model* >::iterator miter;
@@ -359,7 +359,7 @@
        Simulator::Instance()->GetPhysicsEnabled())
   {
     {
-      //DiagnosticTimer timer("World::Update Physics");
+      DIAGNOSTICTIMER(timer("World::Update Physics",6));
       this->physicsEngine->UpdatePhysics();
     }
 

Modified: code/gazebo/branches/wg/server/physics/ode/ODEPhysics.cc
===================================================================
--- code/gazebo/branches/wg/server/physics/ode/ODEPhysics.cc    2010-09-02 
02:56:29 UTC (rev 8878)
+++ code/gazebo/branches/wg/server/physics/ode/ODEPhysics.cc    2010-09-02 
05:19:19 UTC (rev 8879)
@@ -378,7 +378,7 @@
   // Do collision detection; this will add contacts to the contact group
   this->LockMutex(); 
   {
-    DIAGNOSTICTIMER(timer("ODEPhysics Collision dSpaceCollide",1));
+    DIAGNOSTICTIMER(timer("ODEPhysics Collision dSpaceCollide",6));
     dSpaceCollide( this->spaceId, this, CollisionCallback );
   }
   this->UnlockMutex(); 
@@ -426,12 +426,12 @@
   PhysicsEngine::UpdatePhysics();
 
   {
-    DIAGNOSTICTIMER(timer("ODEPhysics: UpdateCollision",1));
+    DIAGNOSTICTIMER(timer("ODEPhysics: UpdateCollision",6));
     this->UpdateCollision();
   }
 
   {
-    DIAGNOSTICTIMER(timer("ODEPhysics: LockMutex",1));
+    DIAGNOSTICTIMER(timer("ODEPhysics: LockMutex",6));
     this->LockMutex(); 
   }
 
@@ -439,7 +439,7 @@
   /// \brief @todo: quickStepP used here for backwards compatibility,
   ///        should tick tock deprecation as we switch to nested tags
   {
-    DIAGNOSTICTIMER(timer("ODEPhysics: Constraint Solver",1));
+    DIAGNOSTICTIMER(timer("ODEPhysics: Constraint Solver",6));
 
     if (**this->stepTypeP == "quick" || **this->quickStepP == true)
       dWorldQuickStep(this->worldId, (**this->stepTimeP).Double());

Modified: code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc
===================================================================
--- code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc     2010-09-02 
02:56:29 UTC (rev 8878)
+++ code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc     2010-09-02 
05:19:19 UTC (rev 8879)
@@ -53,6 +53,8 @@
 #include "RTShaderSystem.hh"
 #include "OgreAdaptor.hh"
 
+#include "Timer.hh"
+
 using namespace gazebo;
 
 enum SceneTypes{SCENE_BSP, SCENE_EXT};
@@ -468,23 +470,35 @@
   this->root->_fireFrameStarted();
 
   // Draw all the non-user cameras
-  for (iter = this->cameras.begin(); iter != this->cameras.end(); iter++)
   {
-    if (dynamic_cast<UserCamera*>((*iter)) == NULL)
-      (*iter)->Render();
+    DIAGNOSTICTIMER(timer("UpdateCameras: Non-UserCamera update",6));
+    for (iter = this->cameras.begin(); iter != this->cameras.end(); iter++)
+    {
+      if (dynamic_cast<UserCamera*>((*iter)) == NULL)
+        (*iter)->Render();
+    }
   }
 
-  this->root->renderOneFrame();
+  {
+    DIAGNOSTICTIMER(timer("UpdateCameras: render one frame",6));
+    this->root->renderOneFrame();
+  }
 
   // Must update the user camera's last.
-  for (iter = this->cameras.begin(); iter != this->cameras.end(); iter++)
   {
-    userCam = dynamic_cast<UserCamera*>((*iter));
-    if (userCam)
-      userCam->Update();
+    DIAGNOSTICTIMER(timer("UpdateCameras: UserCamera update",6));
+    for (iter = this->cameras.begin(); iter != this->cameras.end(); iter++)
+    {
+      userCam = dynamic_cast<UserCamera*>((*iter));
+      if (userCam)
+        userCam->Update();
+    }
   }
 
-  this->root->_fireFrameEnded();
+  {
+    DIAGNOSTICTIMER(timer("UpdateCameras: _fireFrameEnded",6));
+    this->root->_fireFrameEnded();
+  }
 }
 
 
////////////////////////////////////////////////////////////////////////////////


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