diff options
author | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-11-18 17:16:01 +0000 |
---|---|---|
committer | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-11-18 17:16:01 +0000 |
commit | 055972dcd3f650114edbca71a65cff8fed185a38 (patch) | |
tree | 1cf87e430fdd392a4dc0d4104dd6d930ddbcc364 | |
parent | 830f9f5eedc7846331eb745fdfd056fbb0de31a2 (diff) | |
download | ATCD-055972dcd3f650114edbca71a65cff8fed185a38.tar.gz |
*** empty log message ***
9 files changed, 227 insertions, 703 deletions
diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.cpp b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.cpp index cf120d10301..841b11a3d11 100644 --- a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.cpp +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.cpp @@ -1,146 +1,139 @@ // $Id$ -#include "ciao/CIAO_common.h" #include "Consumer_exec.h" -#define DISPLACEMENT 256 +#include <fstream> +#include <iostream> /// Default constructor. -MyImpl::BMDevice_exec_i::BMDevice_exec_i (void) - : str_ ("BM DEVICE DATA") +Consumer_Impl::Consumer_exec_i::Consumer_exec_i (void) + : event_count_ (0) { - } /// Default destructor. -MyImpl::BMDevice_exec_i::~BMDevice_exec_i () -{ -} - -BasicSP::CCM_ReadData_ptr -MyImpl::BMDevice_exec_i::get_data_read (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) +Consumer_Impl::Consumer_exec_i::~Consumer_exec_i () { - return BasicSP::CCM_ReadData::_duplicate (this); } void -MyImpl::BMDevice_exec_i::push_timeout (BasicSP::TimeOut * - ACE_ENV_ARG_DECL) +Consumer_Impl::Consumer_exec_i::push_timeout (EC_Benchmark::TimeOut * + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - // Nitify others - BasicSP::DataAvailable_var event = new OBV_BasicSP::DataAvailable; + ////ACE_DEBUG ((LM_DEBUG, "==============Consumer, received a timeout from Producer \n")); - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, - "BMDevice, received a timeout from EC \n")); - } + // Benchmarking: record the timestamp + ACE_hrtime_t end = ACE_OS::gethrtime (); + + this->end_time_[this->event_count_] = end; // cache the end time - this->context_->push_data_available (event - ACE_ENV_ARG_PARAMETER); -} + std::cerr << end << std::endl; -char * -MyImpl::BMDevice_exec_i::data_read (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return CORBA::string_dup (this->str_); -} + this->event_count_++; -char * -MyImpl::BMDevice_exec_i::get_data (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->data_read (ACE_ENV_SINGLE_ARG_PARAMETER); + //std::cerr << this->event_count_ << std::endl; + + if (this->event_count_ >= niterations) + std::cerr << "Benchmarking finished\n"; } // Operations from Components::SessionComponent void -MyImpl::BMDevice_exec_i::set_session_context ( +Consumer_Impl::Consumer_exec_i::set_session_context ( Components::SessionContext_ptr ctx ACE_ENV_ARG_DECL ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, - "MyImpl::BMDevice_exec_i::set_session_context\n")); - } + ACE_DEBUG ((LM_DEBUG, "Consumer_Impl::Consumer_exec_i::set_session_context\n")); this->context_ = - BasicSP::CCM_BMDevice_Context::_narrow (ctx - ACE_ENV_ARG_PARAMETER); + Consumer_Impl::Consumer_Exec_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); ACE_CHECK; if (CORBA::is_nil (this->context_.in ())) - { ACE_THROW (CORBA::INTERNAL ()); - } // Urm, we actually discard exceptions thown from this operation. } void -MyImpl::BMDevice_exec_i::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Consumer_Impl::Consumer_exec_i::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { + ACE_DEBUG ((LM_DEBUG, "Consumer_Impl::Consumer_exec_i::ciao_preactivate\n")); } void -MyImpl::BMDevice_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) +Consumer_Impl::Consumer_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, - "MyImpl::BMDevice_exec_i::ccm_activate\n")); - } - + ACE_DEBUG ((LM_DEBUG, "Consumer_Impl::Consumer_exec_i::ccm_activate\n")); } void -MyImpl::BMDevice_exec_i::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Consumer_Impl::Consumer_exec_i::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { + ACE_DEBUG ((LM_DEBUG, "Consumer_Impl::Consumer_exec_i::ciao_postactivate\n")); } void -MyImpl::BMDevice_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Consumer_Impl::Consumer_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + ACE_DEBUG ((LM_DEBUG, "done\n")); + std::cerr << "global scale factor is: " << gsf << std::endl; + + std::ifstream producer_in; + producer_in.open ("begin.dat"); + + std::ofstream consumer_out; + consumer_out.open ("end.dat"); + + std::ofstream delta_out; + delta_out.open ("delta.dat"); + + for (int i = 0; i < niterations; ++i) { - ACE_DEBUG ((LM_DEBUG, - "MyImpl::BMDevice_exec_i::ccm_passivate\n")); + ACE_hrtime_t begin; + producer_in >> begin; + consumer_out << this->end_time_[i] << "\n"; + delta_out << (this->end_time_[i] -begin)/gsf << "\n"; } + + producer_in.close (); + consumer_out.close (); + delta_out.close (); + + ACE_DEBUG ((LM_DEBUG, "Consumer_Impl::Consumer_exec_i::ccm_passivate\n")); } void -MyImpl::BMDevice_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Consumer_Impl::Consumer_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - if (CIAO::debug_level () > 0) - { - ACE_DEBUG ((LM_DEBUG, - "MyImpl::BMDevice_exec_i::ccm_remove\n")); - } + ACE_DEBUG ((LM_DEBUG, "Consumer_Impl::Consumer_exec_i::ccm_remove\n")); } +//======================================================== + /// Default ctor. -MyImpl::BMDeviceHome_exec_i::BMDeviceHome_exec_i () +Consumer_Impl::ConsumerHome_exec_i::ConsumerHome_exec_i () { } /// Default dtor. -MyImpl::BMDeviceHome_exec_i::~BMDeviceHome_exec_i () +Consumer_Impl::ConsumerHome_exec_i::~ConsumerHome_exec_i () { } @@ -149,21 +142,21 @@ MyImpl::BMDeviceHome_exec_i::~BMDeviceHome_exec_i () // Implicit home operations. ::Components::EnterpriseComponent_ptr -MyImpl::BMDeviceHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) +Consumer_Impl::ConsumerHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { Components::EnterpriseComponent_ptr tmp= 0; ACE_NEW_THROW_EX (tmp, - MyImpl::BMDevice_exec_i, + Consumer_Impl::Consumer_exec_i, CORBA::NO_MEMORY ()); return tmp; } -extern "C" BMDEVICE_EXEC_Export ::Components::HomeExecutorBase_ptr -createBMDeviceHome_Impl (void) +extern "C" CONSUMER_EXEC_Export ::Components::HomeExecutorBase_ptr +createConsumerHome_Impl (void) { - return new MyImpl::BMDeviceHome_exec_i; + return new Consumer_Impl::ConsumerHome_exec_i; } diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.h index a33f82e5006..e85623172ec 100644 --- a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.h +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.h @@ -2,61 +2,51 @@ // ================================================================ /** - * @file BMDevice_exec.h + * @file Consumer_exec.h * - * Header file for the actual BMDevice and BMDeviceHome component - * implementations. These classes are the implementations of local - * interfaces defined in BMDeviceEI.idl. + * Header file for the actual Consumer and ConsumerHome component + * implementations. * - * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + * @author Gan Deng <gan.deng@vanderbilt.edu> */ // ================================================================ -#ifndef CIAO_BMDEVICE_EXEC_H -#define CIAO_BMDEVICE_EXEC_H +#ifndef CIAO_CONSUMER_EXEC_H +#define CIAO_CONSUMER_EXEC_H + +#include "ConsumerEC.h" +#include "Consumer_exec_export.h" -#include "BMDeviceEIC.h" #include "tao/LocalObject.h" +#include "ace/High_Res_Timer.h" + +const int niterations = 100; -namespace MyImpl +namespace Consumer_Impl { /** - * @class BMDEVICE_exec_i + * @class Consumer_exec_i * * An example RateGen executor implementation class. */ - class BMDEVICE_EXEC_Export BMDevice_exec_i : - public virtual BasicSP::BMDevice_Exec, + class CONSUMER_EXEC_Export Consumer_exec_i : + public virtual Consumer_Exec, public virtual TAO_Local_RefCounted_Object { public: /// Default constructor. - BMDevice_exec_i (); + Consumer_exec_i (); /// Default destructor. - ~BMDevice_exec_i (); - - // Operations from BasicSP::BMDevice + ~Consumer_exec_i (); - virtual BasicSP::CCM_ReadData_ptr - get_data_read (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + // Operations from EC_Benchmark::Consumer virtual void - push_timeout (BasicSP::TimeOut *ev + push_timeout (EC_Benchmark::TimeOut *ev ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - // Operations from BasicSP::position - - virtual char * - data_read (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual char * - get_data (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Operations from Components::SessionComponent virtual void @@ -79,7 +69,6 @@ namespace MyImpl ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)); - virtual void ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, @@ -90,27 +79,30 @@ namespace MyImpl ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)); protected: - const char *str_; + /// Copmponent specific context + Consumer_Exec_Context_var context_; + + CORBA::ULong event_count_; + // Keep track of the number of events received. - /// Copmponent specific context - BasicSP::CCM_BMDevice_Context_var context_; + ACE_hrtime_t end_time_[niterations]; }; /** - * @class BMDeviceHome_exec_i + * @class ConsumerHome_exec_i * - * BMDevice home executor implementation class. + * Consumer home executor implementation class. */ - class BMDEVICE_EXEC_Export BMDeviceHome_exec_i : - public virtual BasicSP::CCM_BMDeviceHome, + class CONSUMER_EXEC_Export ConsumerHome_exec_i : + public virtual ConsumerHome_Exec, public virtual TAO_Local_RefCounted_Object { public: /// Default ctor. - BMDeviceHome_exec_i (); + ConsumerHome_exec_i (); /// Default dtor. - ~BMDeviceHome_exec_i (); + virtual ~ConsumerHome_exec_i (); // Explicit home operations. @@ -121,12 +113,11 @@ namespace MyImpl ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)); }; - } // Executor DLL entry point. CIAO's deployment and assembly framework // invokes this function on the resulting DLL to get the home executor. -extern "C" BMDEVICE_EXEC_Export ::Components::HomeExecutorBase_ptr -createBMDeviceHome_Impl (void); +extern "C" CONSUMER_EXEC_Export ::Components::HomeExecutorBase_ptr +createConsumerHome_Impl (void); -#endif /* CIAO_BMDEVICE_EXEC_H*/ +#endif /* CIAO_CONSUMER_EXEC_H*/ diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt.h index 4b1f9308bf4..ed8a26f34d5 100644 --- a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt.h +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt.h @@ -31,8 +31,8 @@ #include "ciao/Container_Base.h" #include "ciao/Servant_Impl_T.h" -#include "tao/LocalObject.h" -#include "tao/PortableServer/Key_Adapters.h" +#include "ciao/Context_Impl_T.h" +#include "ciao/Home_Servant_Impl_T.h" #include "ace/Active_Map_Manager_T.h" #include "ConsumerS.h" @@ -41,14 +41,28 @@ namespace Consumer_Impl { namespace CIAO_GLUE_EC_Benchmark { + class Consumer_Servant; + class CONSUMER_SVNT_Export Consumer_Context - : public virtual ::EC_Benchmark::CCM_Consumer_Context, - public virtual TAO_Local_RefCounted_Object + : public virtual CIAO::Context_Impl< + ::EC_Benchmark::CCM_Consumer_Context, + Consumer_Servant, + ::EC_Benchmark::Consumer, + ::EC_Benchmark::Consumer_var + > { public: // We will allow the servant glue code we generate to access our state. friend class Consumer_Servant; + /// Hack for VC6. + typedef CIAO::Context_Impl< + ::EC_Benchmark::CCM_Consumer_Context, + Consumer_Servant, + ::EC_Benchmark::Consumer, + ::EC_Benchmark::Consumer_var + > ctx_svnt_base; + Consumer_Context ( ::Components::CCMHome_ptr home, ::CIAO::Session_Container *c, @@ -56,62 +70,11 @@ namespace Consumer_Impl virtual ~Consumer_Context (void); - // Operations from ::Components::CCMContext. - - virtual ::Components::Principal_ptr - get_caller_principal ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual ::Components::CCMHome_ptr - get_CCM_home ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual CORBA::Boolean - get_rollback_only ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::IllegalState)); - - virtual ::Components::Transaction::UserTransaction_ptr - get_user_transaction ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::IllegalState)); - - virtual CORBA::Boolean - is_caller_in_role ( - const char *role - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void - set_rollback_only ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::IllegalState)); - - // Operations from ::Components::SessionContext interface. - - virtual CORBA::Object_ptr - get_CCM_object ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::IllegalState)); - // Operations for Consumer receptacles and event sources, // defined in ::EC_Benchmark::CCM_Consumer_Context. // CIAO-specific. - ::CIAO::Session_Container * - _ciao_the_Container (void) const; - static Consumer_Context * _narrow ( ::Components::SessionContext_ptr p @@ -121,11 +84,6 @@ namespace Consumer_Impl // Methods that manage this component's connections and consumers. protected: - ::Components::CCMHome_var home_; - ::CIAO::Session_Container *container_; - - Consumer_Servant *servant_; - ::EC_Benchmark::Consumer_var component_; }; } @@ -137,17 +95,16 @@ namespace Consumer_Impl ::EC_Benchmark::CCM_Consumer, ::EC_Benchmark::CCM_Consumer_var, Consumer_Context - >, - public virtual PortableServer::RefCountServantBase + > { public: - /// Hack for VC6 the most sucky compiler + /// Hack for VC6. typedef CIAO::Servant_Impl< POA_EC_Benchmark::Consumer, ::EC_Benchmark::CCM_Consumer, ::EC_Benchmark::CCM_Consumer_var, Consumer_Context - > our_base; + > comp_svnt_base; Consumer_Servant ( ::EC_Benchmark::CCM_Consumer_ptr executor, @@ -212,24 +169,6 @@ namespace Consumer_Impl // Component attribute operations. - // Operations for Navigation interface. - - virtual CORBA::Object_ptr - provide_facet ( - const char *name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::InvalidName)); - - virtual ::Components::FacetDescriptions * - get_named_facets ( - const ::Components::NameList & /* names */ - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::InvalidName)); - // Operations for Receptacles interface. virtual ::Components::Cookie * @@ -256,37 +195,8 @@ namespace Consumer_Impl ::Components::CookieRequired, ::Components::NoConnection)); - virtual ::Components::ConnectionDescriptions * - get_connections ( - const char *name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::InvalidName)); - - virtual ::Components::ReceptacleDescriptions * - get_all_receptacles ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual ::Components::ReceptacleDescriptions * - get_named_receptacles ( - const ::Components::NameList & /* names */ - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::InvalidName)); - // Operations for Events interface. - virtual ::Components::EventConsumerBase_ptr - get_consumer ( - const char *sink_name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::InvalidName)); - virtual ::Components::Cookie * subscribe ( const char *publisher_name, @@ -319,81 +229,6 @@ namespace Consumer_Impl ::Components::AlreadyConnected, ::Components::InvalidConnection)); - virtual ::Components::EventConsumerBase_ptr - disconnect_consumer ( - const char *source_name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::InvalidName, - ::Components::NoConnection)); - - virtual ::Components::ConsumerDescriptions * - get_named_consumers ( - const ::Components::NameList & /* names */ - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::InvalidName)); - - virtual ::Components::EmitterDescriptions * - get_all_emitters ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual ::Components::EmitterDescriptions * - get_named_emitters( - const ::Components::NameList & /* names */ - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::InvalidName)); - - virtual ::Components::PublisherDescriptions * - get_all_publishers ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual ::Components::PublisherDescriptions * - get_named_publishers ( - const ::Components::NameList & /* names */ - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::InvalidName)); - - // Operations for CCMObject interface. - - virtual void - component_UUID ( - const char * new_component_UUID - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual CIAO::CONNECTION_ID - component_UUID ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual CORBA::IRObject_ptr - get_component_def ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void - configuration_complete ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::InvalidConfiguration)); - - virtual void - remove ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::RemoveFailure)); - // CIAO specific operations on the servant CORBA::Object_ptr get_facet_executor (const char *name @@ -417,21 +252,40 @@ namespace Consumer_Impl get_consumer_timeout_i ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - - ACE_CString component_UUID_; }; } namespace CIAO_GLUE_EC_Benchmark { class CONSUMER_SVNT_Export ConsumerHome_Servant - : public virtual POA_EC_Benchmark::ConsumerHome, - public virtual PortableServer::RefCountServantBase + : public virtual CIAO::Home_Servant_Impl< + POA_EC_Benchmark::ConsumerHome, + ::EC_Benchmark::CCM_ConsumerHome, + ::EC_Benchmark::CCM_ConsumerHome_var, + ::EC_Benchmark::Consumer, + ::EC_Benchmark::Consumer_var, + ::EC_Benchmark::CCM_Consumer, + ::EC_Benchmark::CCM_Consumer_var, + Consumer_Servant + > { public: + /// Hack for VC6. + typedef CIAO::Home_Servant_Impl< + POA_EC_Benchmark::ConsumerHome, + ::EC_Benchmark::CCM_ConsumerHome, + ::EC_Benchmark::CCM_ConsumerHome_var, + ::EC_Benchmark::Consumer, + ::EC_Benchmark::Consumer_var, + ::EC_Benchmark::CCM_Consumer, + ::EC_Benchmark::CCM_Consumer_var, + Consumer_Servant + > home_svnt_base; + ConsumerHome_Servant ( ::EC_Benchmark::CCM_ConsumerHome_ptr exe, ::CIAO::Session_Container *c); + virtual ~ConsumerHome_Servant (void); // Home operations. @@ -439,76 +293,6 @@ namespace Consumer_Impl // Home factory and finder operations. // Attribute operations. - - // Operations for keyless home interface. - - virtual ::Components::CCMObject_ptr - create_component ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::CreateFailure)); - - // Operations for implicit home interface. - - virtual ::EC_Benchmark::Consumer_ptr - create ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::CreateFailure)); - - // Operations for CCMHome interface. - - virtual ::CORBA::IRObject_ptr - get_component_def ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual ::CORBA::IRObject_ptr - get_home_def ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void - remove_component ( - ::Components::CCMObject_ptr comp - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC (( - ::CORBA::SystemException, - ::Components::RemoveFailure)); - - // Supported operations. - - protected: - // CIAO-specific operations. - - ::EC_Benchmark::Consumer_ptr - _ciao_activate_component ( - ::EC_Benchmark::CCM_Consumer_ptr exe - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void - _ciao_passivate_component ( - ::EC_Benchmark::Consumer_ptr comp - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - protected: - ::EC_Benchmark::CCM_ConsumerHome_var - executor_; - - ::CIAO::Session_Container * - container_; - - ACE_Hash_Map_Manager_Ex< - PortableServer::ObjectId, - Consumer_Servant *, - TAO_ObjectId_Hash, - ACE_Equal_To<PortableServer::ObjectId>, - ACE_SYNCH_MUTEX> - component_map_; }; extern "C" CONSUMER_SVNT_Export ::PortableServer::Servant diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark.idl b/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark.idl index 859aa694eda..08b817742c8 100644 --- a/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark.idl +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark.idl @@ -22,7 +22,7 @@ module EC_Benchmark interface trigger { void start (); - void stop (); + //void stop (); }; /** diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.idl b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.idl index b428da022d7..fb69adfa8bb 100644 --- a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.idl +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.idl @@ -18,7 +18,7 @@ module EC_Benchmark { component Producer supports trigger { - publishes TimeOut timeout; + emits TimeOut timeout; }; home ProducerHome manages Producer diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.mpc b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.mpc index ec7c469e181..822c70a7856 100644 --- a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.mpc +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.mpc @@ -23,7 +23,7 @@ project(Producer_svnt) : ciao_servant_dnc { sharedname = Producer_svnt libs += Producer_stub EC_Benchmark_stub EC_Benchmark_svnt libpaths += .. - idlflags += -Wb,skel_export_macro=PRODUCER_SVNT_Export -Wb,skel_export_include=Producer_svnt_export.h + idlflags += -Wb,export_macro=PRODUCER_SVNT_Export -Wb,export_include=Producer_svnt_export.h dynamicflags = PRODUCER_SVNT_BUILD_DLL CIDL_Files { @@ -70,5 +70,8 @@ project (Producer_controller) : ciao_client_dnc, valuetype { Source_Files { controller.cpp } + + Header_Files { + } } diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.cpp b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.cpp index 0a7d012fc7e..665d1c7eda3 100644 --- a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.cpp +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.cpp @@ -1,199 +1,54 @@ // $Id$ -#include "EC_exec.h" -#include "CIAO_common.h" -#include "ace/Timer_Queue.h" -#include "ace/Reactor.h" +#include "Producer_exec.h" +#include <fstream> +#include "ace/High_Res_Timer.h" //================================================================= -MyImpl::timeout_Handler::timeout_Handler (MyImpl::EC_exec_i *cb) - : active_ (0), - done_ (0), - tid_ (0), - pulse_callback_ (cb) +Producer_Impl::Producer_exec_i::Producer_exec_i () { - // Nothing - this->reactor (new ACE_Reactor); } -MyImpl::timeout_Handler::~timeout_Handler () +Producer_Impl::Producer_exec_i::~Producer_exec_i () { - delete this->reactor (); - this->reactor (0); -} - -int -MyImpl::timeout_Handler::open () -{ - return this->activate (); -} - -int -MyImpl::timeout_Handler::close () -{ - this->done_ = 1; - this->reactor ()->notify (); - - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "Waiting\n")); - return this->wait (); -} - -int -MyImpl::timeout_Handler::start (CORBA::Long hertz) -{ - if (hertz == 0 || this->active_ != 0) // Not valid - return -1; - - long usec = 1000000 / hertz; - - this->tid_ = this->reactor ()->schedule_timer (this, - 0, - ACE_Time_Value (0, usec), - ACE_Time_Value (0, usec)); - - this->active_ = 1; - return 0; -} - -int -MyImpl::timeout_Handler::stop (void) -{ - if (this->active_ == 0) // Not valid. - return -1; - - this->reactor ()->cancel_timer (this); - - this->active_ = 0; - return 0; -} - -int -MyImpl::timeout_Handler::active (void) -{ - return this->active_; -} - -int -MyImpl::timeout_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask) -{ - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), - this, - handle, - close_mask)); - - return 0; -} - -int -MyImpl::timeout_Handler::handle_timeout (const ACE_Time_Value &, - const void *) -{ - this->pulse_callback_->pulse (); - -// ACE_DEBUG ((LM_DEBUG, -// ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"), -// this, -// tv.sec (), -// tv.usec ())); - - return 0; -} - -int -MyImpl::timeout_Handler::svc (void) -{ - this->reactor ()->owner (ACE_OS::thr_self ()); - - while (!this->done_) - this->reactor ()->handle_events (); - - return 0; -} - -//================================================================= - -MyImpl::EC_exec_i::EC_exec_i () - : hertz_ (0), - pulser_ (this) -{ - -} - -MyImpl::EC_exec_i::EC_exec_i (CORBA::Long hz) - : hertz_ (hz), - pulser_ (this) -{ -} - -MyImpl::EC_exec_i::~EC_exec_i () -{ -} - -CORBA::Long -MyImpl::EC_exec_i::hertz (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->hertz_; -} - -void -MyImpl::EC_exec_i::hertz (CORBA::Long hertz - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->hertz_ = hertz; } // Operations from supported interface(s) void -MyImpl::EC_exec_i::start (ACE_ENV_SINGLE_ARG_DECL) +Producer_Impl::Producer_exec_i::start (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (this->hertz_ == 0 || this->pulser_.active()) - ACE_THROW (CORBA::BAD_INV_ORDER ()); + EC_Benchmark::TimeOut_var ev = new OBV_EC_Benchmark::TimeOut (); - // @@ Start the rate generator - this->pulser_.start (this->hertz_); -} + ////ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Producer pushing timeout event!\n"))); -void -MyImpl::EC_exec_i::stop (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - if (! this->pulser_.active ()) - ACE_THROW (CORBA::BAD_INV_ORDER ()); + ACE_hrtime_t start = ACE_OS::gethrtime (); + + this->context_->push_timeout (ev.in () + ACE_ENV_ARG_PARAMETER); + + std::ofstream producer_out; - // @@ stop the rate generator - this->pulser_.stop (); -} + producer_out.open ("begin.dat", ios::app); -CORBA::Boolean -MyImpl::EC_exec_i::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->pulser_.active (); + producer_out << start << "\n"; } // Operations from Components::SessionComponent void -MyImpl::EC_exec_i::set_session_context (Components::SessionContext_ptr ctx - ACE_ENV_ARG_DECL) +Producer_Impl::Producer_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::set_session_context\n")); + ACE_DEBUG ((LM_DEBUG, "Producer_Impl::EC_exec_i::set_session_context\n")); this->context_ = - BasicSP::CCM_EC_Context::_narrow (ctx - ACE_ENV_ARG_PARAMETER); + Producer_Impl::Producer_Exec_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); ACE_CHECK; if (CORBA::is_nil (this->context_.in ())) @@ -203,98 +58,71 @@ MyImpl::EC_exec_i::set_session_context (Components::SessionContext_ptr ctx } void -MyImpl::EC_exec_i::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Producer_Impl::Producer_exec_i::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { + ACE_DEBUG ((LM_DEBUG, "Producer_Impl::Producer_exec_i::ciao_preactivate\n")); } void -MyImpl::EC_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Producer_Impl::Producer_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_activate\n")); - - this->pulser_.open (); + ACE_DEBUG ((LM_DEBUG, "Producer_Impl::Producer_exec_i::ccm_activate\n")); } void -MyImpl::EC_exec_i::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Producer_Impl::Producer_exec_i::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { + ACE_DEBUG ((LM_DEBUG, "Producer_Impl::Producer_exec_i::ciao_postactivate\n")); } void -MyImpl::EC_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Producer_Impl::Producer_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_passivate\n")); - this->pulser_.close (); + ACE_DEBUG ((LM_DEBUG, "Producer_Impl::Producer_exec_i::ccm_passivate\n")); } void -MyImpl::EC_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Producer_Impl::Producer_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_remove\n")); + ACE_DEBUG ((LM_DEBUG, "Producer_Impl::Producer_exec_i::ccm_remove\n")); } -void -MyImpl::EC_exec_i::pulse (void) -{ - ACE_TRY_NEW_ENV - { - if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Pushing BasicSP::TimeOut event!\n"))); - - BasicSP::TimeOut_var ev = new OBV_BasicSP::TimeOut (); +//======================================================== - this->context_->push_timeout (ev.in () - ACE_ENV_ARG_PARAMETER); - } - ACE_CATCHANY - { - // @@ do nothing? - } - ACE_ENDTRY; - -} - -MyImpl::ECHome_exec_i::ECHome_exec_i () +Producer_Impl::ProducerHome_exec_i::ProducerHome_exec_i () { } -MyImpl::ECHome_exec_i::~ECHome_exec_i () +Producer_Impl::ProducerHome_exec_i::~ProducerHome_exec_i () { } ::Components::EnterpriseComponent_ptr -MyImpl::ECHome_exec_i::new_EC (CORBA::Long hertz - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return new MyImpl::EC_exec_i (hertz); -} - -::Components::EnterpriseComponent_ptr -MyImpl::ECHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Producer_Impl::ProducerHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - return new MyImpl::EC_exec_i (); + Components::EnterpriseComponent_ptr tmp= 0; + ACE_NEW_THROW_EX (tmp, + Producer_Impl::Producer_exec_i, + CORBA::NO_MEMORY ()); + + return tmp; } -extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr -createECHome_Impl (void) +extern "C" PRODUCER_EXEC_Export ::Components::HomeExecutorBase_ptr +createProducerHome_Impl (void) { - return new MyImpl::ECHome_exec_i (); + return new Producer_Impl::ProducerHome_exec_i (); } diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.h index 1acd7cc92f6..3a1a27a96d3 100644 --- a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.h +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.h @@ -14,52 +14,34 @@ #ifndef PRODUCER_EXEC_H #define PRODUCER_EXEC_H -#include "SenderEC.h" -#include "Sender_exec_export.h" +#include "ProducerEC.h" +#include "Producer_exec_export.h" #include "tao/LocalObject.h" namespace Producer_Impl - +{ /** * @class Producer_exec_i * * Producer executor implementation class. */ class PRODUCER_EXEC_Export Producer_exec_i : - public virtual EC_Benchmark::Producer_Exec, + public virtual Producer_Exec, public virtual TAO_Local_RefCounted_Object { public: /// Default constructor. - EC_exec_i (); - - /// Initialize with a default frequency. - EC_exec_i (CORBA::Long hz); + Producer_exec_i (); /// Default destructor. - ~EC_exec_i (); - - // Attribute operations. - - virtual CORBA::Long hertz (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void hertz (CORBA::Long hertz - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); + ~Producer_exec_i (); // Operations from supported interface(s) virtual void start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual CORBA::Boolean active (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Operations from Components::SessionComponent virtual void set_session_context (Components::SessionContext_ptr ctx @@ -88,43 +70,26 @@ namespace Producer_Impl ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)); - /// Helper function to be called back by timeout_Handler - void pulse (void); - protected: - /// Frequency - CORBA::Long hertz_; - /// Copmponent specific context - BasicSP::CCM_EC_Context_var context_; - - /// An active object that actually trigger the generation of - /// periodic events. - timeout_Handler pulser_; + Producer_Exec_Context_var context_; }; /** - * @class ECHome_exec_i + * @class ProducerHome_exec_i * - * EC home executor implementation class. + * Producer home executor implementation class. */ - class EC_EXEC_Export ECHome_exec_i : - public virtual BasicSP::CCM_ECHome, + class PRODUCER_EXEC_Export ProducerHome_exec_i : + public virtual ProducerHome_Exec, public virtual TAO_Local_RefCounted_Object { public: /// Default ctor. - ECHome_exec_i (); + ProducerHome_exec_i (); /// Default dtor. - ~ECHome_exec_i (); - - // Explicit home operations. - - virtual ::Components::EnterpriseComponent_ptr - new_EC (CORBA::Long hertz - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ~ProducerHome_exec_i (); // Implicit home operations. @@ -133,10 +98,9 @@ namespace Producer_Impl ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)); }; - } -extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr -createECHome_Impl (void); +extern "C" PRODUCER_EXEC_Export ::Components::HomeExecutorBase_ptr +createProducerHome_Impl (void); -#endif /* CIAO_ECGEN_EXEC_H */ +#endif /* CIAO_PRODUCER_EXEC_H */ diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/controller.cpp b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/controller.cpp index d52ac54dba9..40ace0c486b 100644 --- a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/controller.cpp +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/controller.cpp @@ -3,17 +3,15 @@ /** * @file controller.cpp * - * This program interact with a EC component, and set the rate of the - * EC. + * This program interact with a Producer component. */ -#include "ECC.h" +#include "ProducerC.h" #include "ace/Get_Opt.h" -#include "ace/streams.h" -const char *rategen_ior_ = 0; -int rate = 2; -int turn_on = 1; +char* producer_ior = 0; + +int niterations = 100; int parse_args (int argc, char *argv[]) @@ -25,30 +23,15 @@ parse_args (int argc, char *argv[]) { switch (c) { - case 'o': - turn_on = 1; - break; - - case 'f': - turn_on = 0; - break; - case 'k': - rategen_ior_ = get_opts.opt_arg (); + producer_ior = get_opts.opt_arg (); break; - case 'r': - rate = atoi (get_opts.opt_arg ()); - break; - case '?': // display help for use of the server. default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s\n" - "-o (Turn on the rate generator)\n" - "-f (Turn off the rate generator)\n" - "-k <EC IOR> (default is file://rategen.ior)\n" - "-r <rate in hertz> (default is 3)\n" + "-k <EC IOR> (default is file://Producer.ior)\n" "\n", argv [0]), -1); @@ -56,14 +39,9 @@ parse_args (int argc, char *argv[]) } } - if (rategen_ior_ == 0) - { - rategen_ior_ = "file://ec.ior"; - } - - if (rate == 0) + if (producer_ior == 0) { - rate = 3; + producer_ior = "file://Producer.ior"; } return 0; @@ -87,44 +65,27 @@ main (int argc, char *argv[]) } CORBA::Object_var obj = - orb->string_to_object (rategen_ior_ + orb->string_to_object (producer_ior ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - BasicSP::EC_var pulser - = BasicSP::EC::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); + EC_Benchmark::Producer_var producer + = EC_Benchmark::Producer::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - if (CORBA::is_nil (pulser.in ())) + if (CORBA::is_nil (producer.in ())) { ACE_ERROR_RETURN ((LM_ERROR, - "Unable to acquire 'EC' objref\n"), + "Unable to acquire 'Producer' objref\n"), -1); } - pulser->hertz (rate - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (turn_on) + for (int i = 0; i < niterations; ++i) { - pulser->hertz (rate - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "Start up the Event services\n")); - - pulser->start (ACE_ENV_SINGLE_ARG_PARAMETER); + producer->start (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } - else - { - pulser->stop (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "Stop the ES\n")); - } orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; |