[openrtm-commit:00101] r2130 - branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm

openrtm @ openrtm.org openrtm @ openrtm.org
2011年 5月 24日 (火) 12:52:22 JST


Author: n-ando
Date: 2011-05-24 12:52:22 +0900 (Tue, 24 May 2011)
New Revision: 2130

Modified:
   branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.cpp
Log:
The number of debug print has been reduced.


Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.cpp
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.cpp	2011-05-24 03:50:26 UTC (rev 2129)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.cpp	2011-05-24 03:52:22 UTC (rev 2130)
@@ -141,6 +141,7 @@
   int PeriodicExecutionContext::svc(void)
   {
     RTC_TRACE(("svc()"));
+    int count(0);
     do 
       {
         m_worker.mutex_.lock();
@@ -155,17 +156,25 @@
 	  }
 	m_worker.mutex_.unlock();
         coil::TimeValue t1(coil::gettimeofday());
-        RTC_PARANOID(("Period:    %f [s]", (double)m_period));
-        RTC_PARANOID(("Execution: %f [s]", (double)(t1 - t0)));
-        RTC_PARANOID(("Sleep:     %f [s]", (double)(m_period - (t1 - t0))));
+        if (count > 1000)
+          {
+            RTC_PARANOID(("Period:    %f [s]", (double)m_period));
+            RTC_PARANOID(("Execution: %f [s]", (double)(t1 - t0)));
+            RTC_PARANOID(("Sleep:     %f [s]", (double)(m_period - (t1 - t0))));
+          }
         coil::TimeValue t2(coil::gettimeofday());
         if (!m_nowait && m_period > (t1 - t0))
           {
-            RTC_PARANOID(("sleeping..."));
+            if (count > 1000) { RTC_PARANOID(("sleeping...")); }
             coil::sleep((coil::TimeValue)(m_period - (t1 - t0)));
           }
-        coil::TimeValue t3(coil::gettimeofday());
-        RTC_PARANOID(("Slept:     %f [s]", (double)(t3 - t2)));
+        if (count > 1000)
+          {
+            coil::TimeValue t3(coil::gettimeofday());
+            RTC_PARANOID(("Slept:     %f [s]", (double)(t3 - t2)));
+            count = 0;
+          }
+        ++count;
       } while (m_svc);
 
     return 0;



openrtm-commit メーリングリストの案内