Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Event / lib / Driver.cpp
blob5b389cac642cf5a93542086b7a52f4b44b00a469
1 #include "Driver.h"
2 #include "Consumer.h"
3 #include "Supplier.h"
5 #include "orbsvcs/Event_Service_Constants.h"
6 #include "orbsvcs/Event_Utilities.h"
7 #include "orbsvcs/Event/EC_Default_Factory.h"
8 #include "orbsvcs/Event/EC_Event_Channel.h"
10 #include "tao/ORB_Constants.h"
12 #include "ace/Sched_Params.h"
13 #include "ace/Arg_Shifter.h"
14 #include "ace/High_Res_Timer.h"
15 #include "ace/Stats.h"
16 #include "ace/OS_NS_errno.h"
17 #include "ace/OS_NS_unistd.h"
19 #if !defined(EC_DISABLE_OLD_EC)
20 #include "EC_Scheduler_Info.h"
21 #endif
23 #if !defined (__ACE_INLINE__)
24 #include "Driver.inl"
25 #endif /* __ACE_INLINE__ */
29 EC_Driver::EC_Driver (void)
30 : n_consumers_ (1),
31 consumers_ (0),
32 n_suppliers_ (1),
33 suppliers_ (0),
34 tasks_ (0),
35 burst_count_ (100),
36 burst_size_ (100),
37 payload_size_ (0),
38 burst_pause_ (10000),
39 consumer_type_start_ (ACE_ES_EVENT_UNDEFINED),
40 consumer_type_count_ (1),
41 consumer_type_shift_ (2),
42 supplier_type_start_ (ACE_ES_EVENT_UNDEFINED),
43 supplier_type_count_ (1),
44 supplier_type_shift_ (2),
45 pid_file_name_ (0),
46 verbose_ (0),
47 thr_create_flags_ (THR_NEW_LWP|THR_BOUND|THR_SCHED_FIFO),
48 use_remote_ec_ (0),
49 event_service_name_ (ACE_TEXT("EventService")),
50 ec_impl_ (0)
52 TAO_EC_Default_Factory::init_svcs ();
55 EC_Driver::~EC_Driver (void)
59 int
60 EC_Driver::run (int argc, ACE_TCHAR* argv[])
62 int retval = 0;
63 try
65 // Calibrate the high resolution timer *before* starting the
66 // test.
67 ACE_High_Res_Timer::calibrate ();
69 this->run_init (argc, argv);
71 this->execute_test ();
73 this->dump_results ();
75 this->run_cleanup ();
77 catch (const CORBA::Exception& ex)
79 ex._tao_print_exception ("EC_Driver::run");
80 ++retval;
82 catch (...)
84 ACE_ERROR ((LM_ERROR, "EC_Driver (%P|%t) non-corba exception raised\n"));
85 ++retval;
87 return retval;
90 void
91 EC_Driver::run_init (int &argc, ACE_TCHAR* argv[])
93 this->initialize_orb_and_poa (argc, argv);
95 if (this->parse_args (argc, argv))
96 throw CORBA::INTERNAL (TAO::VMCID, CORBA::COMPLETED_NO);
98 if (this->verbose ())
99 this->print_args ();
101 if (this->pid_file_name_ != 0)
103 FILE* pid = ACE_OS::fopen (this->pid_file_name_, "w");
104 if (pid != 0)
106 ACE_OS::fprintf (pid, "%ld\n",
107 static_cast<long> (ACE_OS::getpid ()));
108 ACE_OS::fclose (pid);
112 if (this->move_to_rt_class () == -1)
113 throw CORBA::INTERNAL (TAO::VMCID, CORBA::COMPLETED_NO);
115 this->initialize_ec_impl ();
117 if (this->allocate_consumers () == -1)
118 throw CORBA::NO_MEMORY (TAO::VMCID, CORBA::COMPLETED_NO);
120 if (this->allocate_suppliers () == -1)
121 throw CORBA::NO_MEMORY (TAO::VMCID, CORBA::COMPLETED_NO);
123 this->connect_clients ();
126 void
127 EC_Driver::run_cleanup (void)
129 this->disconnect_clients ();
131 this->shutdown_clients ();
133 this->destroy_ec ();
135 if (this->verbose ())
136 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) channel destroyed\n"));
138 this->deactivate_ec ();
140 if (this->verbose ())
141 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) channel deactivated\n"));
143 this->cleanup_tasks ();
144 this->cleanup_suppliers ();
145 this->cleanup_consumers ();
146 this->cleanup_ec ();
148 this->root_poa_->destroy (1, 1);
149 this->root_poa_ = PortableServer::POA::_nil ();
151 this->orb_->destroy ();
152 this->orb_ = CORBA::ORB::_nil ();
155 void
156 EC_Driver::initialize_orb_and_poa (int &argc, ACE_TCHAR* argv[])
158 this->orb_ =
159 CORBA::ORB_init (argc, argv);
161 CORBA::Object_var poa_object =
162 this->orb_->resolve_initial_references("RootPOA");
164 if (CORBA::is_nil (poa_object.in ()))
166 ACE_ERROR ((LM_ERROR,
167 "EC_Driver (%P|%t) Unable to initialize the POA.\n"));
168 return;
171 this->root_poa_ =
172 PortableServer::POA::_narrow (poa_object.in ());
174 PortableServer::POAManager_var poa_manager =
175 this->root_poa_->the_POAManager ();
177 poa_manager->activate ();
180 void
181 EC_Driver::print_args (void) const
183 ACE_DEBUG ((LM_DEBUG,
184 "Execution parameters:\n"
185 " consumers = <%d>\n"
186 " suppliers = <%d>\n"
187 " burst count = <%d>\n"
188 " burst size = <%d>\n"
189 " event size = <%d>\n"
190 " burst pause = <%d>\n"
191 " consumer type start = <%d>\n"
192 " consumer type count = <%d>\n"
193 " consumer type shift = <%d>\n"
194 " supplier type start = <%d>\n"
195 " supplier type count = <%d>\n"
196 " supplier type shift = <%d>\n"
197 " pid file name = <%s>\n",
199 this->n_consumers_,
200 this->n_suppliers_,
201 this->burst_count_,
202 this->burst_size_,
203 this->payload_size_,
204 this->burst_pause_,
206 this->consumer_type_start_,
207 this->consumer_type_count_,
208 this->consumer_type_shift_,
209 this->supplier_type_start_,
210 this->supplier_type_count_,
211 this->supplier_type_shift_,
213 this->pid_file_name_?this->pid_file_name_:ACE_TEXT("nil")
214 ) );
218 EC_Driver::move_to_rt_class (void)
220 int priority =
221 (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO)
222 + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2;
223 priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
224 priority);
225 // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
227 if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,
228 priority,
229 ACE_SCOPE_PROCESS)) != 0)
231 if (ACE_OS::last_error () == EPERM)
233 ACE_DEBUG ((LM_DEBUG,
234 "EC_Driver (%P|%t): user is not superuser, "
235 "so remain in time-sharing class\n"));
236 this->thr_create_flags_ = THR_NEW_LWP;
238 else
239 ACE_ERROR ((LM_ERROR,
240 "EC_Driver (%P|%t): sched_params failed\n"));
243 if (ACE_OS::thr_setprio (priority) == -1)
245 ACE_ERROR ((LM_ERROR, "EC_Driver (%P|%t) main thr_setprio failed,"
246 "no real-time features\n"));
248 return 0;
251 void
252 EC_Driver::initialize_ec_impl (void)
254 #if !defined(EC_DISABLE_REMOTE_EC)
255 if (this->use_remote_ec_ == 1)
257 this->obtain_remote_ec ();
258 return;
260 #endif
262 this->initialize_new_ec ();
265 #if !defined(EC_DISABLE_REMOTE_EC)
266 void
267 EC_Driver::obtain_remote_ec (void)
269 CosNaming::NamingContext_var naming_context =
270 this->get_naming_context ();
272 CosNaming::Name channel_name (1);
273 channel_name.length (1);
274 channel_name[0].id = CORBA::string_dup (this->event_service_name_);
276 CORBA::Object_var tmp =
277 naming_context->resolve (channel_name);
279 this->event_channel_ =
280 RtecEventChannelAdmin::EventChannel::_narrow (tmp.in ());
283 CosNaming::NamingContext_ptr
284 EC_Driver::get_naming_context (void)
286 CORBA::Object_var naming_obj =
287 this->orb_->resolve_initial_references ("NameService");
289 if (CORBA::is_nil (naming_obj.in ()))
290 ACE_ERROR ((LM_ERROR,
291 "EC_Driver (%P|%t) Unable to obtain the "
292 "Naming Service.\n"));
294 return CosNaming::NamingContext::_narrow (naming_obj.in ());
296 #endif
298 void
299 EC_Driver::initialize_new_ec (void)
301 TAO_EC_Event_Channel_Attributes attr (this->root_poa_.in (),
302 this->root_poa_.in ());
304 this->modify_attributes (attr);
306 TAO_EC_Event_Channel *ec =
307 new TAO_EC_Event_Channel (attr);
308 this->ec_impl_ = ec;
310 ec->activate ();
312 this->event_channel_ =
313 this->ec_impl_->_this ();
316 void
317 EC_Driver::deactivate_ec (void)
319 #if !defined(EC_DISABLE_REMOTE_EC)
320 if (this->use_remote_ec_ == 1)
321 return;
322 #endif
325 // Deactivate the EC
326 PortableServer::POA_var poa =
327 this->ec_impl_->_default_POA ();
328 PortableServer::ObjectId_var id =
329 poa->servant_to_id (this->ec_impl_);
330 poa->deactivate_object (id.in ());
333 if (this->verbose ())
334 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) EC deactivated\n"));
338 void
339 EC_Driver::destroy_ec (void)
341 this->event_channel_->destroy ();
345 EC_Driver::allocate_consumers (void)
347 ACE_NEW_RETURN (this->consumers_,
348 EC_Consumer*[this->n_consumers_],
349 -1);
350 for (int i = 0; i < this->n_consumers_; ++i)
351 this->consumers_[i] =
352 this->allocate_consumer (i);
353 return 0;
357 EC_Driver::allocate_suppliers (void)
359 ACE_NEW_RETURN (this->suppliers_,
360 EC_Supplier*[this->n_suppliers_],
361 -1);
362 for (int i = 0; i < this->n_suppliers_; ++i)
363 this->suppliers_[i] =
364 this->allocate_supplier (i);
365 return 0;
368 EC_Consumer*
369 EC_Driver::allocate_consumer (int i)
371 return new EC_Consumer (this,
372 this->consumers_ + i);
375 EC_Supplier*
376 EC_Driver::allocate_supplier (int i)
378 return new EC_Supplier (this,
379 this->suppliers_ + i);
382 void
383 EC_Driver::connect_clients (void)
385 this->connect_consumers ();
387 this->connect_suppliers ();
390 void
391 EC_Driver::disconnect_clients (void)
393 this->disconnect_suppliers ();
395 this->disconnect_consumers ();
398 void
399 EC_Driver::shutdown_clients (void)
401 this->shutdown_suppliers ();
403 this->shutdown_consumers ();
406 void
407 EC_Driver::connect_consumers (void)
409 RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin =
410 this->event_channel_->for_consumers ();
412 for (int i = 0; i < this->n_consumers_; ++i)
414 this->connect_consumer (consumer_admin.in (), i);
416 if (this->verbose ())
417 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) connected consumer(s)\n"));
420 void
421 EC_Driver::connect_consumer (
422 RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin,
423 int i)
425 RtecEventChannelAdmin::ConsumerQOS qos;
426 int shutdown_event_type;
427 this->build_consumer_qos (i, qos, shutdown_event_type);
429 this->consumers_[i]->connect (consumer_admin,
430 qos,
431 shutdown_event_type);
434 void
435 EC_Driver::build_consumer_qos (
436 int i,
437 RtecEventChannelAdmin::ConsumerQOS& qos,
438 int& shutdown_event_type)
440 RtecBase::handle_t rt_info = 0;
442 int type_start =
443 this->consumer_type_start_
444 + i * this->consumer_type_shift_;
446 shutdown_event_type = type_start + this->consumer_type_count_;
448 ACE_ConsumerQOS_Factory qos_factory;
449 qos_factory.start_disjunction_group (1 + this->consumer_type_count_);
450 qos_factory.insert_type (shutdown_event_type, rt_info);
452 for (int j = 0; j != this->consumer_type_count_; ++j)
453 qos_factory.insert_type (type_start + j, rt_info);
455 qos = qos_factory.get_ConsumerQOS ();
458 void
459 EC_Driver::connect_suppliers (void)
461 RtecEventChannelAdmin::SupplierAdmin_var supplier_admin =
462 this->event_channel_->for_suppliers ();
464 for (int i = 0; i < this->n_suppliers_; ++i)
466 this->connect_supplier (supplier_admin.in (), i);
469 if (this->verbose ())
470 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) connected supplier(s)\n"));
473 void
474 EC_Driver::connect_supplier (
475 RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin,
476 int i)
478 RtecEventChannelAdmin::SupplierQOS qos;
479 int shutdown_event_type;
480 this->build_supplier_qos (i, qos, shutdown_event_type);
482 this->suppliers_[i]->connect (supplier_admin,
483 qos,
484 shutdown_event_type);
487 void
488 EC_Driver::build_supplier_qos (
489 int i,
490 RtecEventChannelAdmin::SupplierQOS& qos,
491 int& shutdown_event_type)
493 int type_start = this->supplier_type_start_ + i*this->supplier_type_shift_;
494 int supplier_id = i + 1;
495 shutdown_event_type = type_start + this->supplier_type_count_;
497 RtecBase::handle_t rt_info = 0;
499 ACE_SupplierQOS_Factory qos_factory;
500 for (int j = 0; j != this->supplier_type_count_; ++j)
501 qos_factory.insert (supplier_id,
502 type_start + j,
503 rt_info, 1);
505 qos_factory.insert (supplier_id,
506 shutdown_event_type,
507 rt_info, 1);
509 qos = qos_factory.get_SupplierQOS ();
512 void
513 EC_Driver::execute_test (void)
515 if (this->allocate_tasks () == -1)
516 return;
518 this->activate_tasks ();
520 if (this->verbose ())
521 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) suppliers are active\n"));
523 // Wait for the supplier threads...
524 if (ACE_Thread_Manager::instance ()->wait () == -1)
526 ACE_ERROR ((LM_ERROR, "EC_Driver (%P|%t) Thread_Manager wait failed\n"));
529 if (this->verbose ())
530 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) suppliers finished\n"));
534 EC_Driver::allocate_tasks (void)
536 if (this->tasks_ != 0)
537 return 0;
539 ACE_NEW_RETURN (this->tasks_,
540 ACE_Task_Base*[this->n_suppliers_],
541 -1);
543 for (int i = 0; i < this->n_suppliers_; ++i)
544 this->tasks_[i] =
545 this->allocate_task (i);
546 return 0;
549 ACE_Task_Base*
550 EC_Driver::allocate_task (int i)
552 int start = this->supplier_type_start_ + i*this->supplier_type_shift_;
553 return new EC_Supplier_Task (this->suppliers_[i],
554 this,
555 this->suppliers_ + i,
556 this->burst_count_,
557 this->burst_size_,
558 this->burst_pause_,
559 this->payload_size_,
560 start + this->supplier_type_count_);
563 void
564 EC_Driver::activate_tasks (void)
566 int priority =
567 (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO)
568 + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2;
570 if (ACE_BIT_DISABLED (this->thr_create_flags_, THR_SCHED_FIFO))
572 priority =
573 ACE_Sched_Params::priority_min (ACE_SCHED_OTHER);
576 for (int i = 0; i < this->n_suppliers_; ++i)
578 if (this->tasks_[i]->activate (this->thr_create_flags_,
579 1, 0, priority) == -1)
581 ACE_ERROR ((LM_ERROR,
582 "EC_Driver (%P|%t) Cannot activate thread "
583 "for supplier %d\n%p\n",
584 i, "EC_Driver - OS error is:"));
589 void
590 EC_Driver::disconnect_suppliers (void)
592 if (this->suppliers_ == 0)
593 return;
594 for (int i = 0; i < this->n_suppliers_; ++i)
596 this->suppliers_[i]->disconnect ();
598 if (this->verbose ())
599 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) suppliers disconnected\n"));
602 void
603 EC_Driver::disconnect_consumers (void)
605 if (this->consumers_ == 0)
606 return;
607 for (int i = 0; i < this->n_consumers_; ++i)
609 this->consumers_[i]->disconnect ();
611 if (this->verbose ())
612 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) consumers disconnected\n"));
615 void
616 EC_Driver::shutdown_suppliers (void)
618 if (this->suppliers_ == 0)
619 return;
620 for (int i = 0; i < this->n_suppliers_; ++i)
622 this->suppliers_[i]->shutdown ();
624 if (this->verbose ())
625 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) suppliers deactivated\n"));
628 void
629 EC_Driver::shutdown_consumers (void)
631 if (this->consumers_ == 0)
632 return;
633 for (int i = 0; i < this->n_consumers_; ++i)
635 this->consumers_[i]->shutdown ();
637 if (this->verbose ())
638 ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) consumers deactivated\n"));
641 void
642 EC_Driver::dump_results (void)
644 ACE_Throughput_Stats throughput;
645 ACE_High_Res_Timer::global_scale_factor_type gsf =
646 ACE_High_Res_Timer::global_scale_factor ();
647 ACE_TCHAR buf[BUFSIZ];
648 for (int j = 0; j < this->n_consumers_; ++j)
650 ACE_OS::sprintf (buf, ACE_TEXT("Consumer [%02d]"), j);
652 this->consumers_[j]->dump_results (buf, gsf);
653 this->consumers_[j]->accumulate (throughput);
655 ACE_DEBUG ((LM_DEBUG, "\n"));
657 ACE_Throughput_Stats suppliers;
658 for (int i = 0; i < this->n_suppliers_; ++i)
660 ACE_OS::sprintf (buf, ACE_TEXT("Supplier [%02d]"), i);
662 this->suppliers_[i]->dump_results (buf, gsf);
663 this->suppliers_[i]->accumulate (suppliers);
666 ACE_DEBUG ((LM_DEBUG, "\nTotals:\n"));
667 throughput.dump_results (ACE_TEXT("EC_Consumer/totals"), gsf);
669 ACE_DEBUG ((LM_DEBUG, "\n"));
670 suppliers.dump_results (ACE_TEXT("EC_Supplier/totals"), gsf);
674 EC_Driver::parse_args (int &argc, ACE_TCHAR *argv [])
676 ACE_Arg_Shifter arg_shifter (argc, argv);
678 while (arg_shifter.is_anything_left ())
680 const ACE_TCHAR *arg = arg_shifter.get_current ();
682 if (ACE_OS::strcmp (arg, ACE_TEXT("-verbose")) == 0)
684 arg_shifter.consume_arg ();
685 this->verbose_ = 1;
688 else if (ACE_OS::strcmp (arg, ACE_TEXT("-remote")) == 0)
690 arg_shifter.consume_arg ();
692 this->use_remote_ec_ = 1;
693 if (arg_shifter.is_parameter_next ())
695 this->event_service_name_ = arg_shifter.get_current ();
696 arg_shifter.consume_arg ();
700 else if (ACE_OS::strcmp (arg, ACE_TEXT("-suppliers")) == 0)
702 arg_shifter.consume_arg ();
704 if (arg_shifter.is_parameter_next ())
706 this->n_suppliers_ = ACE_OS::atoi (arg_shifter.get_current ());
707 arg_shifter.consume_arg ();
711 else if (ACE_OS::strcmp (arg, ACE_TEXT("-consumers")) == 0)
713 arg_shifter.consume_arg ();
715 if (arg_shifter.is_parameter_next ())
717 this->n_consumers_ = ACE_OS::atoi (arg_shifter.get_current ());
718 arg_shifter.consume_arg ();
722 else if (ACE_OS::strcmp (arg, ACE_TEXT("-burstcount")) == 0)
724 arg_shifter.consume_arg ();
726 if (arg_shifter.is_parameter_next ())
728 this->burst_count_ = ACE_OS::atoi (arg_shifter.get_current ());
729 arg_shifter.consume_arg ();
733 else if (ACE_OS::strcmp (arg, ACE_TEXT("-burstsize")) == 0)
735 arg_shifter.consume_arg ();
737 if (arg_shifter.is_parameter_next ())
739 this->burst_size_ = ACE_OS::atoi (arg_shifter.get_current ());
740 arg_shifter.consume_arg ();
744 else if (ACE_OS::strcmp (arg, ACE_TEXT("-payloadsize")) == 0)
746 arg_shifter.consume_arg ();
748 if (arg_shifter.is_parameter_next ())
750 this->payload_size_ = ACE_OS::atoi (arg_shifter.get_current ());
751 arg_shifter.consume_arg ();
755 else if (ACE_OS::strcmp (arg, ACE_TEXT("-burstpause")) == 0)
757 arg_shifter.consume_arg ();
759 if (arg_shifter.is_parameter_next ())
761 this->burst_pause_ = ACE_OS::atoi (arg_shifter.get_current ());
762 arg_shifter.consume_arg ();
766 else if (ACE_OS::strcmp (arg, ACE_TEXT("-consumer_tstart")) == 0)
768 arg_shifter.consume_arg ();
770 if (arg_shifter.is_parameter_next ())
772 this->consumer_type_start_ =
773 ACE_ES_EVENT_UNDEFINED
774 + ACE_OS::atoi (arg_shifter.get_current ());
775 arg_shifter.consume_arg ();
779 else if (ACE_OS::strcmp (arg, ACE_TEXT("-consumer_tcount")) == 0)
781 arg_shifter.consume_arg ();
783 if (arg_shifter.is_parameter_next ())
785 this->consumer_type_count_ =
786 ACE_OS::atoi (arg_shifter.get_current ());
787 arg_shifter.consume_arg ();
791 else if (ACE_OS::strcmp (arg, ACE_TEXT("-consumer_tshift")) == 0)
793 arg_shifter.consume_arg ();
795 if (arg_shifter.is_parameter_next ())
797 this->consumer_type_shift_ =
798 ACE_OS::atoi (arg_shifter.get_current ());
799 arg_shifter.consume_arg ();
803 else if (ACE_OS::strcmp (arg, ACE_TEXT("-supplier_tstart")) == 0)
805 arg_shifter.consume_arg ();
807 if (arg_shifter.is_parameter_next ())
809 this->supplier_type_start_ =
810 ACE_ES_EVENT_UNDEFINED
811 + ACE_OS::atoi (arg_shifter.get_current ());
812 arg_shifter.consume_arg ();
816 else if (ACE_OS::strcmp (arg, ACE_TEXT("-supplier_tcount")) == 0)
818 arg_shifter.consume_arg ();
820 if (arg_shifter.is_parameter_next ())
822 this->supplier_type_count_ =
823 ACE_OS::atoi (arg_shifter.get_current ());
824 arg_shifter.consume_arg ();
828 else if (ACE_OS::strcmp (arg, ACE_TEXT("-supplier_tshift")) == 0)
830 arg_shifter.consume_arg ();
832 if (arg_shifter.is_parameter_next ())
834 this->supplier_type_shift_ =
835 ACE_OS::atoi (arg_shifter.get_current ());
836 arg_shifter.consume_arg ();
840 else
842 arg_shifter.ignore_arg ();
846 return 0;
849 void
850 EC_Driver::print_usage (void)
852 ACE_DEBUG ((LM_DEBUG,
853 "EC_Driver Usage:\n"
854 " -verbose\n"
855 " -remote <ec_name>\n"
856 " -old_reactive\n"
857 " -old_threaded\n"
858 " -suppliers <nsuppliers>\n"
859 " -consumers <nsuppliers>\n"
860 " -burstcount <bursts>\n"
861 " -burstsize <size>\n"
862 " -payloadsize <size>\n"
863 " -burstpause <usecs>\n"
864 " -consumer_tstart <type>\n"
865 " -consumer_tcount <count>\n"
866 " -consumer_tshift <shift>\n"
867 " -supplier_tstart <type>\n"
868 " -supplier_tcount <count>\n"
869 " -supplier_tshift <shift>\n"
873 void
874 EC_Driver::modify_attributes (TAO_EC_Event_Channel_Attributes& attr)
876 ACE_UNUSED_ARG(attr);
878 // This method can be overruled by derived tests to set the event channel
879 // attributes
882 void
883 EC_Driver::cleanup_tasks (void)
885 if (this->tasks_ != 0)
887 for (int i = 0; i != this->n_suppliers_; ++i)
889 delete this->tasks_[i];
890 this->tasks_[i] = 0;
892 delete[] this->tasks_;
893 this->tasks_ = 0;
897 void
898 EC_Driver::cleanup_suppliers (void)
900 if (this->suppliers_ != 0)
902 for (int i = 0; i != this->n_suppliers_; ++i)
904 delete this->suppliers_[i];
905 this->suppliers_[i] = 0;
907 delete[] this->suppliers_;
908 this->suppliers_ = 0;
912 void
913 EC_Driver::cleanup_consumers (void)
915 if (this->consumers_ != 0)
917 for (int i = 0; i != this->n_consumers_; ++i)
919 delete this->consumers_[i];
920 this->consumers_[i] = 0;
922 delete[] this->consumers_;
923 this->consumers_ = 0;
927 void
928 EC_Driver::cleanup_ec (void)
930 delete this->ec_impl_;
931 #if !defined(EC_DISABLE_OLD_EC)
932 delete this->module_factory_;
933 #endif
937 EC_Driver::decode_consumer_cookie (void* cookie) const
939 return static_cast<EC_Consumer**> (cookie) - this->consumers_;
943 EC_Driver::decode_supplier_cookie (void* cookie) const
945 return static_cast<EC_Supplier**> (cookie) - this->suppliers_;
948 void
949 EC_Driver::consumer_push (void*,
950 const RtecEventComm::EventSet&)
954 void
955 EC_Driver::consumer_shutdown (void*)
959 void
960 EC_Driver::consumer_disconnect (void*)
964 void
965 EC_Driver::supplier_disconnect (void*)