diff options
Diffstat (limited to 'TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/RedGreen_Test.cpp')
-rw-r--r-- | TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/RedGreen_Test.cpp | 234 |
1 files changed, 115 insertions, 119 deletions
diff --git a/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/RedGreen_Test.cpp b/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/RedGreen_Test.cpp index f1c2f119a18..b82defc7350 100644 --- a/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/RedGreen_Test.cpp +++ b/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/RedGreen_Test.cpp @@ -1,4 +1,4 @@ -/* -*- C++ -*- $Id$*/ +/* -*- C++ -*- $Id$ #include "RedGreen_Test.h" #include "ace/Arg_Shifter.h" @@ -22,7 +22,7 @@ ACE_Atomic_Op <TAO_SYNCH_MUTEX, int> g_result_count = 0; ACE_hrtime_t g_throughput_start_; int -RedGreen_Test::parse_args (int argc, +RedGreen_Test::parse_args (int argc, char *argv[]) { ACE_Arg_Shifter arg_shifter (argc, argv); @@ -34,8 +34,8 @@ RedGreen_Test::parse_args (int argc, if ((current_arg = arg_shifter.get_the_parameter ("-burst_size"))) { this->burst_size_ = ACE_OS::atoi (current_arg); - ACE_DEBUG ((LM_DEBUG, - "Burst size = %d\n", + ACE_DEBUG ((LM_DEBUG, + "Burst size = %d\n", burst_size_)); // The number of events to send/receive. arg_shifter.consume_arg (); @@ -45,7 +45,7 @@ RedGreen_Test::parse_args (int argc, ACE_DEBUG((LM_DEBUG, "usage: %s " "-burst_size [count]\n", - argv[0], + argv[0], argv[0])); arg_shifter.consume_arg (); @@ -78,34 +78,34 @@ RedGreen_Test::~RedGreen_Test () } void -RedGreen_Test::init (int argc, - char *argv [] - TAO_ENV_ARG_DECL) +RedGreen_Test::init (int argc, + char *argv [] + ACE_ENV_ARG_DECL) { - this->init_ORB (argc, - argv - TAO_ENV_ARG_PARAMETER); + this->init_ORB (argc, + argv + ACE_ENV_ARG_PARAMETER); ACE_CHECK; - this->resolve_naming_service (TAO_ENV_SINGLE_ARG_PARAMETER); + this->resolve_naming_service (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - this->resolve_Notify_factory (TAO_ENV_SINGLE_ARG_PARAMETER); + this->resolve_Notify_factory (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - this->create_EC (TAO_ENV_SINGLE_ARG_PARAMETER); + this->create_EC (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - this->create_supplieradmin (TAO_ENV_SINGLE_ARG_PARAMETER); + this->create_supplieradmin (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - this->create_consumeradmin (TAO_ENV_SINGLE_ARG_PARAMETER); + this->create_consumeradmin (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - this->create_consumers (TAO_ENV_SINGLE_ARG_PARAMETER); + this->create_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - this->create_suppliers (TAO_ENV_SINGLE_ARG_PARAMETER); + this->create_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; } void -RedGreen_Test::run (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test::run (ACE_ENV_SINGLE_ARG_DECL) { - this->send_events (TAO_ENV_SINGLE_ARG_PARAMETER); + this->send_events (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; worker_.thr_mgr ()->wait (); @@ -121,17 +121,17 @@ RedGreen_Test::done (void) void RedGreen_Test::init_ORB (int argc, char *argv [] - TAO_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) { this->orb_ = CORBA::ORB_init (argc, argv, "" - TAO_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; CORBA::Object_ptr poa_object = this->orb_->resolve_initial_references("RootPOA" - TAO_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; if (CORBA::is_nil (poa_object)) @@ -141,15 +141,15 @@ RedGreen_Test::init_ORB (int argc, return; } this->root_poa_ = - PortableServer::POA::_narrow (poa_object - TAO_ENV_ARG_PARAMETER); + PortableServer::POA::_narrow (poa_object + ACE_ENV_ARG_PARAMETER); ACE_CHECK; PortableServer::POAManager_var poa_manager = - root_poa_->the_POAManager (TAO_ENV_SINGLE_ARG_PARAMETER); + root_poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - poa_manager->activate (TAO_ENV_SINGLE_ARG_PARAMETER); + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; worker_.orb (this->orb_.in ()); @@ -163,11 +163,11 @@ RedGreen_Test::init_ORB (int argc, } void -RedGreen_Test::resolve_naming_service (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test::resolve_naming_service (ACE_ENV_SINGLE_ARG_DECL) { CORBA::Object_var naming_obj = this->orb_->resolve_initial_references (NAMING_SERVICE_NAME - TAO_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; // Need to check return value for errors. @@ -177,13 +177,13 @@ RedGreen_Test::resolve_naming_service (TAO_ENV_SINGLE_ARG_DECL) } this->naming_context_ = - CosNaming::NamingContext::_narrow (naming_obj.in () - TAO_ENV_ARG_PARAMETER); + CosNaming::NamingContext::_narrow (naming_obj.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK; } void -RedGreen_Test::resolve_Notify_factory (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test::resolve_Notify_factory (ACE_ENV_SINGLE_ARG_DECL) { CosNaming::Name name (1); name.length (1); @@ -191,89 +191,89 @@ RedGreen_Test::resolve_Notify_factory (TAO_ENV_SINGLE_ARG_DECL) CORBA::Object_var obj = this->naming_context_->resolve (name - TAO_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; this->notify_factory_ = CosNotifyChannelAdmin::EventChannelFactory::_narrow ( obj.in () - TAO_ENV_ARG_PARAMETER + ACE_ENV_ARG_PARAMETER ); ACE_CHECK; } void -RedGreen_Test::create_EC (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test::create_EC (ACE_ENV_SINGLE_ARG_DECL) { CosNotifyChannelAdmin::ChannelID id; this->ec_ = notify_factory_->create_channel (this->initial_qos_, this->initial_admin_, id - TAO_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; ACE_ASSERT (!CORBA::is_nil (ec_.in ())); } void -RedGreen_Test::create_supplieradmin (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test::create_supplieradmin (ACE_ENV_SINGLE_ARG_DECL) { CosNotifyChannelAdmin::AdminID adminid; supplier_admin_ = - ec_->new_for_suppliers (this->ifgop_, - adminid - TAO_ENV_ARG_PARAMETER); + ec_->new_for_suppliers (this->ifgop_, + adminid + ACE_ENV_ARG_PARAMETER); ACE_CHECK; ACE_ASSERT (!CORBA::is_nil (supplier_admin_.in ())); } void -RedGreen_Test:: create_consumeradmin (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test:: create_consumeradmin (ACE_ENV_SINGLE_ARG_DECL) { CosNotifyChannelAdmin::AdminID adminid; consumer_admin_ = - ec_->new_for_consumers (this->ifgop_, - adminid - TAO_ENV_ARG_PARAMETER); + ec_->new_for_consumers (this->ifgop_, + adminid + ACE_ENV_ARG_PARAMETER); ACE_CHECK; ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ())); } void -RedGreen_Test::create_consumers (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test::create_consumers (ACE_ENV_SINGLE_ARG_DECL) { ACE_NEW (this->normal_consumer_, RedGreen_Test_StructuredPushConsumer (this)); this->normal_consumer_->connect (this->consumer_admin_.in () - TAO_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; ACE_NEW (this->slow_consumer_, SlowConsumer (this)); this->slow_consumer_->connect (this->consumer_admin_.in () - TAO_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; } void -RedGreen_Test::create_suppliers (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test::create_suppliers (ACE_ENV_SINGLE_ARG_DECL) { ACE_NEW (this->supplier_, RedGreen_Test_StructuredPushSupplier ()); this->supplier_->connect (this->supplier_admin_.in () - TAO_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; } void -RedGreen_Test::send_events (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test::send_events (ACE_ENV_SINGLE_ARG_DECL) { - // Setup the Consumer 1 to receive + // Setup the Consumer 1 to receive //event_type : "DOMAIN_GREEN", "DOMAIN_GREEN". CosNotification::EventTypeSeq added_1(1); CosNotification::EventTypeSeq removed_1 (0); @@ -284,9 +284,9 @@ RedGreen_Test::send_events (TAO_ENV_SINGLE_ARG_DECL) removed_1.length (0); this->normal_consumer_->get_proxy_supplier ()->subscription_change ( - added_1, + added_1, removed_1 - TAO_ENV_ARG_PARAMETER + ACE_ENV_ARG_PARAMETER ); ACE_CHECK; @@ -300,9 +300,9 @@ RedGreen_Test::send_events (TAO_ENV_SINGLE_ARG_DECL) removed_2.length (0); this->slow_consumer_->get_proxy_supplier ()->subscription_change ( - added_2, + added_2, removed_2 - TAO_ENV_ARG_PARAMETER + ACE_ENV_ARG_PARAMETER ); ACE_CHECK; @@ -335,12 +335,12 @@ RedGreen_Test::send_events (TAO_ENV_SINGLE_ARG_DECL) // let supplier 1 send all these events for (int i = 0; i < this->burst_size_; ++i) { - this->supplier_->send_event (red_event - TAO_ENV_ARG_PARAMETER); + this->supplier_->send_event (red_event + ACE_ENV_ARG_PARAMETER); ACE_CHECK; - this->supplier_->send_event (green_event - TAO_ENV_ARG_PARAMETER); + this->supplier_->send_event (green_event + ACE_ENV_ARG_PARAMETER); ACE_CHECK; } } @@ -353,42 +353,38 @@ RedGreen_Test::dump_results (void) ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); char buf[BUFSIZ]; - ACE_OS::sprintf (buf, - "Normal Consumer [%02d]", + ACE_OS::sprintf (buf, + "Normal Consumer [%02d]", 1); - normal_consumer_->dump_stats (buf, + normal_consumer_->dump_stats (buf, gsf); normal_consumer_->accumulate_into (throughput); - ACE_OS::sprintf (buf, - "Slow Consumer [%02d]", + ACE_OS::sprintf (buf, + "Slow Consumer [%02d]", 2); - slow_consumer_->dump_stats (buf, + slow_consumer_->dump_stats (buf, gsf); slow_consumer_->accumulate_into (throughput); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "\n")); ACE_Throughput_Stats suppliers; - ACE_OS::sprintf (buf, - "Supplier [%02d]", + ACE_OS::sprintf (buf, + "Supplier [%02d]", 1); - this->supplier_->dump_stats (buf, + this->supplier_->dump_stats (buf, gsf); this->supplier_->accumulate_into (suppliers); - ACE_DEBUG ((LM_DEBUG, - "\nTotals:\n")); - throughput.dump_results ("Notify_Consumer/totals", - gsf); + ACE_DEBUG ((LM_DEBUG, "\nTotals:\n")); + throughput.dump_results ("Notify_Consumer/totals", gsf); - ACE_DEBUG ((LM_DEBUG, - "\n")); - suppliers.dump_results ("Notify_Supplier/totals", - gsf); + ACE_DEBUG ((LM_DEBUG, "\n")); + suppliers.dump_results ("Notify_Supplier/totals", gsf); } // ***************************************************************** @@ -416,29 +412,29 @@ RedGreen_Test_StructuredPushConsumer::accumulate_into ( } void -RedGreen_Test_StructuredPushConsumer::dump_stats (const char* msg, +RedGreen_Test_StructuredPushConsumer::dump_stats (const char* msg, ACE_UINT32 gsf) { - this->throughput_.dump_results (msg, + this->throughput_.dump_results (msg, gsf); } void RedGreen_Test_StructuredPushConsumer::connect ( - CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin - TAO_ENV_ARG_DECL + CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin + ACE_ENV_ARG_DECL ) { // Activate the consumer with the default_POA_. CosNotifyComm::StructuredPushConsumer_var objref = - this->_this (TAO_ENV_SINGLE_ARG_PARAMETER); + this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; CosNotifyChannelAdmin::ProxySupplier_var proxysupplier = consumer_admin->obtain_notification_push_supplier ( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - proxy_supplier_id_ - TAO_ENV_ARG_PARAMETER + CosNotifyChannelAdmin::STRUCTURED_EVENT, + proxy_supplier_id_ + ACE_ENV_ARG_PARAMETER ); ACE_CHECK; @@ -447,23 +443,23 @@ RedGreen_Test_StructuredPushConsumer::connect ( // narrow this->proxy_supplier_ = CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow ( - proxysupplier.in () - TAO_ENV_ARG_PARAMETER + proxysupplier.in () + ACE_ENV_ARG_PARAMETER ); ACE_CHECK; ACE_ASSERT (!CORBA::is_nil (proxy_supplier_.in ())); proxy_supplier_->connect_structured_push_consumer (objref.in () - TAO_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; } void -RedGreen_Test_StructuredPushConsumer::disconnect (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test_StructuredPushConsumer::disconnect (ACE_ENV_SINGLE_ARG_DECL) { this->proxy_supplier_-> - disconnect_structured_push_supplier (TAO_ENV_SINGLE_ARG_PARAMETER); + disconnect_structured_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; } @@ -471,7 +467,7 @@ void RedGreen_Test_StructuredPushConsumer::offer_change ( const CosNotification::EventTypeSeq & /*added*/, const CosNotification::EventTypeSeq & /*removed*/ - TAO_ENV_ARG_DECL_NOT_USED + ACE_ENV_ARG_DECL_NOT_USED ) ACE_THROW_SPEC ((CORBA::SystemException, CosNotifyComm::InvalidEventType)) @@ -482,13 +478,13 @@ RedGreen_Test_StructuredPushConsumer::offer_change ( void RedGreen_Test_StructuredPushConsumer::push_structured_event ( const CosNotification::StructuredEvent & notification - TAO_ENV_ARG_DECL_NOT_USED + ACE_ENV_ARG_DECL_NOT_USED ) ACE_THROW_SPEC ((CORBA::SystemException, CosEventComm::Disconnected)) { - ACE_GUARD (TAO_SYNCH_MUTEX, - ace_mon, + ACE_GUARD (TAO_SYNCH_MUTEX, + ace_mon, this->lock_); const char* domain_name = notification.header.fixed_header.event_type.domain_name; @@ -496,10 +492,10 @@ RedGreen_Test_StructuredPushConsumer::push_structured_event ( const char* type_name = notification.header.fixed_header.event_type.type_name; - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "Consumer %d event, domain = %s, type = %s\n", - this->proxy_supplier_id_, - domain_name, + this->proxy_supplier_id_, + domain_name, type_name)); TimeBase::TimeT latency_base_recorded; @@ -528,7 +524,7 @@ RedGreen_Test_StructuredPushConsumer::push_structured_event ( void RedGreen_Test_StructuredPushConsumer::disconnect_structured_push_consumer ( - TAO_ENV_SINGLE_ARG_DECL_NOT_USED + ACE_ENV_SINGLE_ARG_DECL_NOT_USED ) ACE_THROW_SPEC ((CORBA::SystemException)) { @@ -551,7 +547,7 @@ SlowConsumer::SlowConsumer (RedGreen_Test* RedGreen_Test) void SlowConsumer::push_structured_event ( const CosNotification::StructuredEvent & notification - TAO_ENV_ARG_DECL + ACE_ENV_ARG_DECL ) ACE_THROW_SPEC ((CORBA::SystemException, CosEventComm::Disconnected)) @@ -560,8 +556,8 @@ SlowConsumer::push_structured_event ( ACE_OS::sleep (1); RedGreen_Test_StructuredPushConsumer::push_structured_event ( - notification - TAO_ENV_ARG_PARAMETER + notification + ACE_ENV_ARG_PARAMETER ); } @@ -588,28 +584,28 @@ RedGreen_Test_StructuredPushSupplier::accumulate_into ( } void -RedGreen_Test_StructuredPushSupplier::dump_stats (const char* msg, +RedGreen_Test_StructuredPushSupplier::dump_stats (const char* msg, ACE_UINT32 gsf) { - this->throughput_.dump_results (msg, + this->throughput_.dump_results (msg, gsf); } void RedGreen_Test_StructuredPushSupplier::connect ( - CosNotifyChannelAdmin::SupplierAdmin_ptr supplier_admin - TAO_ENV_ARG_DECL + CosNotifyChannelAdmin::SupplierAdmin_ptr supplier_admin + ACE_ENV_ARG_DECL ) { CosNotifyComm::StructuredPushSupplier_var objref = - this->_this (TAO_ENV_SINGLE_ARG_PARAMETER); + this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; CosNotifyChannelAdmin::ProxyConsumer_var proxyconsumer = supplier_admin->obtain_notification_push_consumer ( - CosNotifyChannelAdmin::STRUCTURED_EVENT, - proxy_consumer_id_ - TAO_ENV_ARG_PARAMETER + CosNotifyChannelAdmin::STRUCTURED_EVENT, + proxy_consumer_id_ + ACE_ENV_ARG_PARAMETER ); ACE_CHECK; @@ -618,25 +614,25 @@ RedGreen_Test_StructuredPushSupplier::connect ( // narrow this->proxy_consumer_ = CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow ( - proxyconsumer.in () - TAO_ENV_ARG_PARAMETER + proxyconsumer.in () + ACE_ENV_ARG_PARAMETER ); ACE_CHECK; ACE_ASSERT (!CORBA::is_nil (proxy_consumer_.in ())); proxy_consumer_->connect_structured_push_supplier (objref.in () - TAO_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; } void -RedGreen_Test_StructuredPushSupplier::disconnect (TAO_ENV_SINGLE_ARG_DECL) +RedGreen_Test_StructuredPushSupplier::disconnect (ACE_ENV_SINGLE_ARG_DECL) { ACE_ASSERT (!CORBA::is_nil (this->proxy_consumer_.in ())); this->proxy_consumer_->disconnect_structured_push_consumer ( - TAO_ENV_SINGLE_ARG_PARAMETER + ACE_ENV_SINGLE_ARG_PARAMETER ); } @@ -644,7 +640,7 @@ void RedGreen_Test_StructuredPushSupplier::subscription_change ( const CosNotification::EventTypeSeq & /*added*/, const CosNotification::EventTypeSeq & /*removed */ - TAO_ENV_ARG_DECL_NOT_USED + ACE_ENV_ARG_DECL_NOT_USED ) ACE_THROW_SPEC ((CORBA::SystemException, CosNotifyComm::InvalidEventType)) @@ -654,8 +650,8 @@ RedGreen_Test_StructuredPushSupplier::subscription_change ( void RedGreen_Test_StructuredPushSupplier::send_event ( - CosNotification::StructuredEvent& event - TAO_ENV_ARG_DECL + CosNotification::StructuredEvent& event + ACE_ENV_ARG_DECL ) { event.filterable_data.length (1); @@ -669,7 +665,7 @@ RedGreen_Test_StructuredPushSupplier::send_event ( start); // any event.filterable_data[0].value <<= latency_base; - proxy_consumer_->push_structured_event (event TAO_ENV_ARG_PARAMETER); + proxy_consumer_->push_structured_event (event ACE_ENV_ARG_PARAMETER); ACE_CHECK; ACE_hrtime_t end = ACE_OS::gethrtime (); @@ -681,7 +677,7 @@ RedGreen_Test_StructuredPushSupplier::send_event ( void RedGreen_Test_StructuredPushSupplier::disconnect_structured_push_supplier ( - TAO_ENV_SINGLE_ARG_DECL_NOT_USED + ACE_ENV_SINGLE_ARG_DECL_NOT_USED ) ACE_THROW_SPEC ((CORBA::SystemException)) { |