From: g0dil Date: Fri, 15 May 2009 13:22:01 +0000 (+0000) Subject: PPI: Measure ActiveFeeder performance in unit test X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=106a248acdea197d60f651643065aeac64f7acf3;p=senf.git PPI: Measure ActiveFeeder performance in unit test git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1205 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/PPI/ActiveFeeder.test.cc b/PPI/ActiveFeeder.test.cc index f54e426..8d9aa55 100644 --- a/PPI/ActiveFeeder.test.cc +++ b/PPI/ActiveFeeder.test.cc @@ -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//////////////////////////////////////// diff --git a/PPI/Events.cc b/PPI/Events.cc index 9f8ec80..eb89a50 100644 --- a/PPI/Events.cc +++ b/PPI/Events.cc @@ -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" diff --git a/PPI/Events.cci b/PPI/Events.cci index 7d113b3..1e50eb7 100644 --- a/PPI/Events.cci +++ b/PPI/Events.cci @@ -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