PPI: Measure ActiveFeeder performance in unit test
g0dil [Fri, 15 May 2009 13:22:01 +0000 (13:22 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1205 270642c3-0616-0410-b53a-bc976706d245

PPI/ActiveFeeder.test.cc
PPI/Events.cc
PPI/Events.cci

index f54e426..8d9aa55 100644 (file)
@@ -50,14 +50,17 @@ BOOST_AUTO_UNIT_TEST(activeFeeder)
     ppi::connect(source,feeder);
     ppi::connect(feeder,sink);
 
-    source.submit(senf::DataPacket::create());
-    source.submit(senf::DataPacket::create());
-    source.submit(senf::DataPacket::create());
+    for (unsigned i (0); i < 500; ++i)
+        source.submit(senf::DataPacket::create());
 
+    senf::ClockService::clock_type start (senf::ClockService::now());
     ppi::run();
+    std::cerr << "ActiveFeeder: " 
+              << (500*1e9)/(senf::ClockService::now()-start)
+              << " packets/s" << std::endl;
 
     BOOST_CHECK_EQUAL( source.size(), 0u );
-    BOOST_CHECK_EQUAL( sink.size(), 3u );
+    BOOST_CHECK_EQUAL( sink.size(), 500u );
 }
 
 ///////////////////////////////cc.e////////////////////////////////////////
index 9f8ec80..eb89a50 100644 (file)
@@ -47,6 +47,16 @@ prefix_ void senf::ppi::EventDescriptor::notifyUnthrottle()
         enabled(true);
 }
 
+prefix_ void senf::ppi::EventDescriptor::enabled(bool v)
+{
+    SENF_ASSERT(v_isRegistered()); // Module::registerEvent() call missing !!
+    if (v && ! enabled_)
+        v_enable();
+    else if (! v && enabled_)
+        v_disable();
+    enabled_ = v;
+}
+
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 //#include "Events.mpp"
index 7d113b3..1e50eb7 100644 (file)
@@ -40,16 +40,6 @@ prefix_ bool senf::ppi::EventDescriptor::enabled()
     return enabled_;
 }
 
-prefix_ void senf::ppi::EventDescriptor::enabled(bool v)
-{
-    SENF_ASSERT(v_isRegistered());
-    if (v && ! enabled_)
-        v_enable();
-    else if (! v && enabled_)
-        v_disable();
-    enabled_ = v;
-}
-
 ////////////////////////////////////////
 // protected members