Revision: 7757
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7757&view=rev
Author:   hsujohnhsu
Date:     2009-06-02 19:38:13 +0000 (Tue, 02 Jun 2009)

Log Message:
-----------
report back instantaneous speedups.

Modified Paths:
--------------
    code/gazebo/branches/threads/server/gui/StatusBar.cc
    code/gazebo/branches/threads/server/gui/StatusBar.hh

Modified: code/gazebo/branches/threads/server/gui/StatusBar.cc
===================================================================
--- code/gazebo/branches/threads/server/gui/StatusBar.cc        2009-06-02 
17:58:31 UTC (rev 7756)
+++ code/gazebo/branches/threads/server/gui/StatusBar.cc        2009-06-02 
19:38:13 UTC (rev 7757)
@@ -110,24 +110,42 @@
 void StatusBar::Update()
 {
   float avgFPS = 0;
-  float percent = 0;
+  //float percent = 0;
   float sim = 0;
   float real = 0;
 
-  if (Simulator::Instance()->GetRealTime() - this->lastUpdateTime > 0.05)
+  if (Simulator::Instance()->GetRealTime() - this->lastUpdateTime > 
this->statusUpdatePeriod)
   {
     avgFPS = this->gui->GetAvgFPS();
-    percent = (Simulator::Instance()->GetSimTime() / 
Simulator::Instance()->GetRealTime());
 
+    if (Simulator::Instance()->GetRealTime() < this->statusUpdatePeriod )
+    {
+      this->percent = (Simulator::Instance()->GetSimTime() / 
Simulator::Instance()->GetRealTime());
+      this->percentLastRealTime =0;
+      this->percentLastSimTime = 0;
+    }
+    else
+    {
+      this->percent = 
((Simulator::Instance()->GetSimTime()-this->percentLastSimTime)
+               / 
(Simulator::Instance()->GetRealTime()-this->percentLastRealTime)  );
+      this->percentLastRealTime =Simulator::Instance()->GetRealTime();
+      this->percentLastSimTime = Simulator::Instance()->GetSimTime();
+    }
+
     sim = Simulator::Instance()->GetSimTime();
-    if (sim > 99999)
+    if (sim > 31536000)
     {
-      sim /= (120*24);
+      sim /= (31536000);
       this->simTime->label("(dys) Sim Time");
     }
-    else if (sim > 9999)
+    else if (sim > 86400)
     {
-      sim /= 120;
+      sim /= (86400);
+      this->simTime->label("(dys) Sim Time");
+    }
+    else if (sim > 3600)
+    {
+      sim /= 3600;
       this->simTime->label("(hrs) Sim Time");
     }
     else if (sim > 999)
@@ -137,14 +155,19 @@
     }
 
     real = Simulator::Instance()->GetRealTime();
-    if (sim > 99999)
+    if (sim > 31536000)
     {
-      real /= (120*24);
+      real /= (31536000);
       this->realTime->label("(dys) Real Time");
     }
-    else if (real > 9999)
+    else if (sim > 86400)
     {
-      real /= 120;
+      real /= (86400);
+      this->realTime->label("(dys) Real Time");
+    }
+    else if (real > 3600)
+    {
+      real /= 3600;
       this->realTime->label("(hrs) Real Time");
     }
     else if (real > 999)
@@ -155,7 +178,7 @@
 
     //this->iterations->value(Simulator::Instance()->GetIterations());
     this->fps->value(avgFPS);
-    this->percentOutput->value(percent);
+    this->percentOutput->value(this->percent);
 
     //if (Simulator::Instance()->GetRealTime() - this->realTime->value() > 0.1)
 

Modified: code/gazebo/branches/threads/server/gui/StatusBar.hh
===================================================================
--- code/gazebo/branches/threads/server/gui/StatusBar.hh        2009-06-02 
17:58:31 UTC (rev 7756)
+++ code/gazebo/branches/threads/server/gui/StatusBar.hh        2009-06-02 
19:38:13 UTC (rev 7757)
@@ -66,6 +66,10 @@
     public: Gui *gui;
 
     private: double lastUpdateTime;
+
+    // calculated percent speedup in last percentWindowDuration seconds real 
time.
+    private: double percent, percentLastRealTime, percentLastSimTime;
+    private: static const double statusUpdatePeriod = 0.05;
   };
   
 }


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

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to