diff options
Diffstat (limited to 'TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp')
-rw-r--r-- | TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp | 100 |
1 files changed, 32 insertions, 68 deletions
diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp b/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp index 3381064c357..f34d1002cf5 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp @@ -3,7 +3,6 @@ #include "ace/Get_Opt.h" #include "ace/Auto_Ptr.h" #include "ace/Sched_Params.h" -#include "ace/High_Res_Timer.h" #include "tao/Timeprobe.h" #include "orbsvcs/Event_Utilities.h" @@ -15,7 +14,7 @@ #include "orbsvcs/Event/Event_Channel.h" #include "orbsvcs/Event/Module_Factory.h" #include "orbsvcs/Event/EC_Event_Channel.h" -#include "orbsvcs/Event/EC_Default_Factory.h" +#include "orbsvcs/Event/EC_Basic_Factory.h" #include "orbsvcs/Event/EC_ConsumerAdmin.h" #include "ECT_Throughput.h" @@ -24,8 +23,6 @@ ACE_RCSID(EC_Throughput, ECT_Throughput, "$Id$") int main (int argc, char *argv []) { - TAO_EC_Default_Factory::init_svcs (); - ECT_Throughput driver; return driver.run (argc, argv); } @@ -48,9 +45,8 @@ ECT_Throughput::ECT_Throughput (void) pid_file_name_ (0), active_count_ (0), reactive_ec_ (0), - new_ec_ (1), - ec_concurrency_hwm_ (1), - thr_create_flags_ (THR_NEW_LWP|THR_BOUND|THR_SCHED_FIFO) + new_ec_ (0), + ec_concurrency_hwm_ (1) { } @@ -63,10 +59,6 @@ ECT_Throughput::run (int argc, char* argv[]) { TAO_TRY { - // Calibrate the high resolution timer *before* starting the - // test. - ACE_High_Res_Timer::calibrate (); - this->orb_ = CORBA::ORB_init (argc, argv, "", TAO_TRY_ENV); TAO_CHECK_ENV; @@ -96,7 +88,7 @@ ECT_Throughput::run (int argc, char* argv[]) " burst count = <%d>\n" " burst size = <%d>\n" " event size = <%d>\n" - " burst pause = <%d>\n" + " burst size = <%d>\n" " consumer type start = <%d>\n" " consumer type count = <%d>\n" " consumer type shift = <%d>\n" @@ -137,30 +129,24 @@ ECT_Throughput::run (int argc, char* argv[]) } } - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, - priority); - // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. + int min_priority = + ACE_Sched_Params::priority_min (ACE_SCHED_FIFO); + // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, - priority, + min_priority, ACE_SCOPE_PROCESS)) != 0) { if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "%s: user is not superuser, " - "so remain in time-sharing class\n", argv[0])); - this->thr_create_flags_ = THR_NEW_LWP; - } + ACE_DEBUG ((LM_DEBUG, + "%s: user is not superuser, " + "so remain in time-sharing class\n", argv[0])); else ACE_ERROR ((LM_ERROR, "%s: ACE_OS::sched_params failed\n", argv[0])); } - if (ACE_OS::thr_setprio (priority) == -1) + if (ACE_OS::thr_setprio (min_priority) == -1) { ACE_ERROR ((LM_ERROR, "(%P|%t) main thr_setprio failed," "no real-time features\n")); @@ -214,6 +200,7 @@ ECT_Throughput::run (int argc, char* argv[]) // The factories must be destroyed *after* the EC, hence the // auto_ptr declarations must go first.... auto_ptr<TAO_Module_Factory> module_factory; + auto_ptr<TAO_EC_Factory> ec_factory; auto_ptr<POA_RtecEventChannelAdmin::EventChannel> ec_impl; if (this->new_ec_ == 0) @@ -240,16 +227,14 @@ ECT_Throughput::run (int argc, char* argv[]) } else { - TAO_EC_Event_Channel_Attributes attr (root_poa.in (), - root_poa.in ()); - attr.busy_hwm = this->ec_concurrency_hwm_; - attr.max_write_delay = this->ec_concurrency_hwm_; + auto_ptr<TAO_EC_Factory> auto_ec_factory (new TAO_EC_Basic_Factory (root_poa.in ())); + ec_factory = auto_ec_factory; TAO_EC_Event_Channel *ec = - new TAO_EC_Event_Channel (attr); - + new TAO_EC_Event_Channel (ec_factory.get ()); ec->activate (TAO_TRY_ENV); TAO_CHECK_ENV; + ec->consumer_admin ()->busy_hwm (this->ec_concurrency_hwm_); auto_ptr<POA_RtecEventChannelAdmin::EventChannel> auto_ec_impl (ec); ec_impl = auto_ec_impl; @@ -279,6 +264,16 @@ ECT_Throughput::run (int argc, char* argv[]) ACE_DEBUG ((LM_DEBUG, "suppliers are active\n")); + ACE_DEBUG ((LM_DEBUG, "running the event loop\n")); + if (this->orb_->run () == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "orb->run"), -1); + ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); + +#if 0 + naming_context->unbind (schedule_name, TAO_TRY_ENV); + TAO_CHECK_ENV; +#endif + // Wait for the supplier threads... if (ACE_Thread_Manager::instance ()->wait () == -1) { @@ -302,8 +297,6 @@ ECT_Throughput::run (int argc, char* argv[]) TAO_CHECK_ENV; } - ACE_DEBUG ((LM_DEBUG, "EC deactivated\n")); - { // Deactivate the Scheduler PortableServer::POA_var poa = @@ -316,22 +309,14 @@ ECT_Throughput::run (int argc, char* argv[]) TAO_CHECK_ENV; } - ACE_DEBUG ((LM_DEBUG, "scheduler deactivated\n")); - this->disconnect_consumers (TAO_TRY_ENV); TAO_CHECK_ENV; - ACE_DEBUG ((LM_DEBUG, "consumers disconnected\n")); - this->disconnect_suppliers (TAO_TRY_ENV); TAO_CHECK_ENV; - ACE_DEBUG ((LM_DEBUG, "suppliers disconnected\n")); - channel->destroy (TAO_TRY_ENV); TAO_CHECK_ENV; - - ACE_DEBUG ((LM_DEBUG, "channel destroyed\n")); } TAO_CATCHANY { @@ -428,19 +413,9 @@ ECT_Throughput::connect_suppliers void ECT_Throughput::activate_suppliers (CORBA::Environment &) { - int priority = - (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) - + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; - for (int i = 0; i < this->n_suppliers_; ++i) { - if (this->suppliers_[i]->activate (this->thr_create_flags_, - 1, 0, priority) == -1) - { - ACE_ERROR ((LM_ERROR, - "Cannot activate thread for supplier %d\n", - i)); - } + this->suppliers_[i]->activate (); } } @@ -467,30 +442,20 @@ ECT_Throughput::disconnect_consumers (CORBA::Environment &TAO_IN_ENV) void ECT_Throughput::dump_results (void) { - ECT_Driver::Throughput_Stats consumers; - ECT_Driver::Latency_Stats latency; for (int j = 0; j < this->n_consumers_; ++j) { char buf[BUFSIZ]; ACE_OS::sprintf (buf, "consumer_%02.2d", j); this->consumers_[j]->dump_results (buf); - this->consumers_[j]->accumulate (consumers); - this->consumers_[j]->accumulate (latency); } - consumers.dump_results ("ECT_Consumer", "throughput"); - latency.dump_results ("ECT_Consumer", "latency"); - - ECT_Driver::Throughput_Stats suppliers; for (int i = 0; i < this->n_suppliers_; ++i) { char buf[BUFSIZ]; ACE_OS::sprintf (buf, "supplier_%02.2d", i); this->suppliers_[i]->dump_results (buf); - this->suppliers_[i]->accumulate (suppliers); } - suppliers.dump_results ("ECT_Supplier", "accumulated"); this->dump_latency_results ("Latency"); } @@ -599,7 +564,6 @@ ECT_Throughput::parse_args (int argc, char *argv []) ACE_DEBUG ((LM_DEBUG, "Usage: %s " "[ORB options] " - "-r -d -x " "-c <n_consumers> " "-s <n_suppliers> " "-u <burst count> " @@ -651,7 +615,7 @@ ECT_Throughput::parse_args (int argc, char *argv []) || this->n_consumers_ >= ECT_Throughput::MAX_CONSUMERS) { this->n_consumers_ = 1; - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_DEBUG, "%s: number of consumers or " "suppliers out of range, " "reset to default (%d)\n", @@ -662,7 +626,7 @@ ECT_Throughput::parse_args (int argc, char *argv []) || this->n_suppliers_ >= ECT_Throughput::MAX_SUPPLIERS) { this->n_suppliers_ = 1; - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_DEBUG, "%s: number of suppliers out of range, " "reset to default (%d)\n", argv[0], 1), -1); @@ -672,7 +636,7 @@ ECT_Throughput::parse_args (int argc, char *argv []) { this->n_suppliers_ = 1; this->n_consumers_ = 1; - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_DEBUG, "%s: no suppliers or consumers, " "reset to default (%d of each)\n", argv[0], 1), -1); @@ -681,7 +645,7 @@ ECT_Throughput::parse_args (int argc, char *argv []) if (this->ec_concurrency_hwm_ <= 0) { this->ec_concurrency_hwm_ = 1; - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_DEBUG, "%s: invalid concurrency HWM, " "reset to default (%d)\n", argv[0], 1), -1); |