diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2003-07-03 18:51:27 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2003-07-03 18:51:27 +0000 |
commit | 214fa18adef8d5327c4d968983c1476e891b95f7 (patch) | |
tree | 3218dce2f86bac17d3ca3aff515694eef989aa92 /TAO | |
parent | 0f1fcb02951a4fc3e72e75a0c9f01ca887bcec84 (diff) | |
download | ATCD-214fa18adef8d5327c4d968983c1476e891b95f7.tar.gz |
ChangeLogTag: Thu Jul 03 18:51:12 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Consumer.h | 98 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Counting_Consumer.h | 55 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Counting_Supplier.h | 81 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Driver.cpp | 11 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Driver.h | 253 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Supplier.h | 138 |
6 files changed, 323 insertions, 313 deletions
diff --git a/TAO/orbsvcs/tests/Event/lib/Consumer.h b/TAO/orbsvcs/tests/Event/lib/Consumer.h index 9bb507daf0f..995103cc29f 100644 --- a/TAO/orbsvcs/tests/Event/lib/Consumer.h +++ b/TAO/orbsvcs/tests/Event/lib/Consumer.h @@ -1,18 +1,14 @@ /* -*- C++ -*- */ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// ORBSVCS Real-time Event Channel testsuite -// -// = FILENAME -// Consumer -// -// = AUTHOR -// Carlos O'Ryan (coryan@cs.wustl.edu) -// -// ============================================================================ +//============================================================================= +/** + * @file Consumer + * + * $Id$ + * + * @author Carlos O'Ryan (coryan@cs.wustl.edu) + */ +//============================================================================= + #ifndef EC_CONSUMER_H #define EC_CONSUMER_H @@ -26,97 +22,99 @@ #include "orbsvcs/RtecEventCommS.h" #include "orbsvcs/RtecEventChannelAdminC.h" +/** + * @class EC_Consumer + * + * @brief Simple consumer object to implement EC tests. + * + * This class is a consumer of events. + * The class is just a helper to simplify common tasks in EC + * tests, such as subscribing for a range of events, disconnecting + * from the EC, informing the driver of shutdown messages, etc. + * There are several ways to connect and disconnect this class, + * and it is up to the driver program to use the right one. + */ class EC_Test_Export EC_Consumer : public POA_RtecEventComm::PushConsumer { - // = TITLE - // Simple consumer object to implement EC tests. - // - // = DESCRIPTION - // This class is a consumer of events. - // The class is just a helper to simplify common tasks in EC - // tests, such as subscribing for a range of events, disconnecting - // from the EC, informing the driver of shutdown messages, etc. - // - // There are several ways to connect and disconnect this class, - // and it is up to the driver program to use the right one. - // public: + /// Constructor EC_Consumer (EC_Driver* driver, void* cookie); - // Constructor + /// The driver program can build the QoS attributes and obtain the + /// ConsumerAdmin, we do the rest. virtual void connect ( RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin, const RtecEventChannelAdmin::ConsumerQOS& qos, int shutdown_event_type ACE_ENV_ARG_DECL); - // The driver program can build the QoS attributes and obtain the - // ConsumerAdmin, we do the rest. + /** + * The driver program can build the QoS attributes and we use + * whatevet supplier_proxy we already have (useful for reconnection + * tests). + */ virtual void connect ( const RtecEventChannelAdmin::ConsumerQOS& qos, int shutdown_event_type ACE_ENV_ARG_DECL); - // The driver program can build the QoS attributes and we use - // whatevet supplier_proxy we already have (useful for reconnection - // tests). + /// returns 0 if it is not connected virtual int connected (void) const; - // returns 0 if it is not connected + /// The application can invoke this method to disconnect from the EC + /// and deactivate this class. void disconnect (ACE_ENV_SINGLE_ARG_DECL); - // The application can invoke this method to disconnect from the EC - // and deactivate this class. + /// The application is shutting down, deactivate the consumer. void shutdown (ACE_ENV_SINGLE_ARG_DECL); - // The application is shutting down, deactivate the consumer. + /// Accumulate our statistics to the totals. void accumulate (ACE_Throughput_Stats& throughput) const; - // Accumulate our statistics to the totals. + /// Printout the statistics virtual void dump_results (const char* name, ACE_UINT32 global_scale_factor); - // Printout the statistics // = The RtecEventComm::PushConsumer methods + /// The skeleton methods. virtual void push (const RtecEventComm::EventSet& events ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); virtual void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)); - // The skeleton methods. private: + /// The main driver for the test. EC_Driver* driver_; - // The main driver for the test. + /// A magic cookie passed by the driver that we pass back in our + /// callbacks. void* cookie_; - // A magic cookie passed by the driver that we pass back in our - // callbacks. + /// We talk to the EC using this proxy. RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_; - // We talk to the EC using this proxy. + /// Protect internal state TAO_SYNCH_MUTEX lock_; - // Protect internal state + /// The timestamp for the first message received ACE_hrtime_t throughput_start_; - // The timestamp for the first message received + /// Used for reporting stats ACE_Throughput_Stats throughput_; - // Used for reporting stats + /// The number of push() calls int push_count_; - // The number of push() calls + /// The type used to indicate shutdown int shutdown_event_type_; - // The type used to indicate shutdown + /// Is the consumer active in the POA? int is_active_; - // Is the consumer active in the POA? + /// Cache the object reference to speed up connect/disconnect calls. RtecEventComm::PushConsumer_var myself_; - // Cache the object reference to speed up connect/disconnect calls. }; #endif /* ECT_CONSUMER_H */ diff --git a/TAO/orbsvcs/tests/Event/lib/Counting_Consumer.h b/TAO/orbsvcs/tests/Event/lib/Counting_Consumer.h index 83de36443e9..fd2fb2bb192 100644 --- a/TAO/orbsvcs/tests/Event/lib/Counting_Consumer.h +++ b/TAO/orbsvcs/tests/Event/lib/Counting_Consumer.h @@ -1,18 +1,14 @@ /* -*- C++ -*- */ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// ORBSVCS Real-time Event Channel testsuite -// -// = FILENAME -// Counting_Consumer -// -// = AUTHOR -// Carlos O'Ryan (coryan@cs.wustl.edu) -// -// ============================================================================ +//============================================================================= +/** + * @file Counting_Consumer + * + * $Id$ + * + * @author Carlos O'Ryan (coryan@cs.wustl.edu) + */ +//============================================================================= + #ifndef EC_COUNTING_CONSUMER_H #define EC_COUNTING_CONSUMER_H @@ -26,50 +22,51 @@ #include "orbsvcs/RtecEventCommS.h" #include "orbsvcs/RtecEventChannelAdminC.h" +/** + * @class EC_Counting_Consumer + * + * @brief Simple consumer object to implement EC tests. + * + * This is a simple consumer that counts the events it receives. + */ class EC_Test_Export EC_Counting_Consumer : public POA_RtecEventComm::PushConsumer { - // = TITLE - // Simple consumer object to implement EC tests. - // - // = DESCRIPTION - // This is a simple consumer that counts the events it receives. - // public: + /// Constructor EC_Counting_Consumer (const char* name); - // Constructor + /// Simple connect/disconnect methods.. void connect (RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin, const RtecEventChannelAdmin::ConsumerQOS &qos ACE_ENV_ARG_DECL); void disconnect (ACE_ENV_SINGLE_ARG_DECL); void deactivate (ACE_ENV_SINGLE_ARG_DECL); - // Simple connect/disconnect methods.. + /// Print out an error message if the event count is too far from the + /// expected count. void dump_results (int expected_count, int tolerance); - // Print out an error message if the event count is too far from the - // expected count. // = The RtecEventComm::PushConsumer methods + /// The skeleton methods. virtual void push (const RtecEventComm::EventSet& events ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); virtual void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)); - // The skeleton methods. + /// Keep track of the number of events received. CORBA::ULong event_count; - // Keep track of the number of events received. + /// Keep track of the number of disconnect calls received. CORBA::ULong disconnect_count; - // Keep track of the number of disconnect calls received. protected: + /// The proxy RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_; - // The proxy + /// The name const char* name_; - // The name }; #endif /* ECT_CONSUMER_H */ diff --git a/TAO/orbsvcs/tests/Event/lib/Counting_Supplier.h b/TAO/orbsvcs/tests/Event/lib/Counting_Supplier.h index 16dcdf22acf..c67a0b19d85 100644 --- a/TAO/orbsvcs/tests/Event/lib/Counting_Supplier.h +++ b/TAO/orbsvcs/tests/Event/lib/Counting_Supplier.h @@ -1,18 +1,14 @@ /* -*- C++ -*- */ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// ORBSVCS Real-time Event Channel testsuite -// -// = FILENAME -// Counting_Supplier -// -// = AUTHOR -// Carlos O'Ryan (coryan@cs.wustl.edu) -// -// ============================================================================ +//============================================================================= +/** + * @file Counting_Supplier + * + * $Id$ + * + * @author Carlos O'Ryan (coryan@cs.wustl.edu) + */ +//============================================================================= + #ifndef EC_COUNTING_SUPPLIER_H #define EC_COUNTING_SUPPLIER_H @@ -27,29 +23,33 @@ #include "orbsvcs/RtecEventChannelAdminC.h" #include "ace/Task.h" +/** + * @class EC_Counting_Supplier + * + * @brief Simple supplier object + * + * This class is a supplier of events. + */ class EC_Test_Export EC_Counting_Supplier : public POA_RtecEventComm::PushSupplier { - // = TITLE - // Simple supplier object - // - // = DESCRIPTION - // This class is a supplier of events. - // public: + /// Constructor EC_Counting_Supplier (void); - // Constructor // = The RtecEventComm::PushSupplier methods + /** + * Connect as a consumer to receive a TIMEOUT every <period> + * milliseconds. + * The class pushes an event (in its supplier role) every time it + * receives the timeout. + */ void activate (RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin, int period ACE_ENV_ARG_DECL); void deactivate (ACE_ENV_SINGLE_ARG_DECL); - // Connect as a consumer to receive a TIMEOUT every <period> - // milliseconds. - // The class pushes an event (in its supplier role) every time it - // receives the timeout. + /// Simple connect/disconnect methods.. void connect (RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin, int published_source, int published_type, @@ -60,47 +60,46 @@ public: const RtecEventChannelAdmin::SupplierQOS &qos ACE_ENV_ARG_DECL); void disconnect (ACE_ENV_SINGLE_ARG_DECL); - // Simple connect/disconnect methods.. + /// The Consumer side methods. void push (const RtecEventComm::EventSet& events ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)); - // The Consumer side methods. + /// The skeleton methods. virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)); - // The skeleton methods. + /// Count the number of events sent CORBA::ULong event_count; - // Count the number of events sent + /// Count the number of disconnect_push_supplier calls CORBA::ULong disconnect_count; - // Count the number of disconnect_push_supplier calls private: + /// Adapter... ACE_PushConsumer_Adapter<EC_Counting_Supplier> consumer_adapter_; - // Adapter... + /// The adapter proxy... RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_; - // The adapter proxy... + /// Our proxy RtecEventChannelAdmin::ProxyPushConsumer_var consumer_proxy_; - // Our proxy + /// The event source int event_source_; - // The event source + /// The event type int event_type_; - // The event type }; class EC_Test_Export EC_Counting_Supplier_Task : public ACE_Task_Base { public: + /// Create the task... EC_Counting_Supplier_Task (EC_Counting_Supplier *supplier); - // Create the task... // = Check the ACE_Task_Base documentation. int svc (void); @@ -108,21 +107,21 @@ public: void stop (void); CORBA::ULong push_count (void); + /// Run a single iteration of the test void run (ACE_ENV_SINGLE_ARG_DECL); - // Run a single iteration of the test private: + /// The supplier we are turning into an active object EC_Counting_Supplier *supplier_; - // The supplier we are turning into an active object + /// The event we push through the supplier RtecEventComm::EventSet event_; - // The event we push through the supplier + /// Set to 1 when the test must stop int stop_flag_; - // Set to 1 when the test must stop + /// Count the number of push() calls CORBA::ULong push_count_; - // Count the number of push() calls TAO_SYNCH_MUTEX lock_; }; diff --git a/TAO/orbsvcs/tests/Event/lib/Driver.cpp b/TAO/orbsvcs/tests/Event/lib/Driver.cpp index e8a68fefba1..feeea4fecda 100644 --- a/TAO/orbsvcs/tests/Event/lib/Driver.cpp +++ b/TAO/orbsvcs/tests/Event/lib/Driver.cpp @@ -394,6 +394,8 @@ EC_Driver::initialize_new_ec (ACE_ENV_SINGLE_ARG_DECL) TAO_EC_Event_Channel_Attributes attr (this->root_poa_.in (), this->root_poa_.in ()); + this->modify_attributes (attr); + TAO_EC_Event_Channel *ec = new TAO_EC_Event_Channel (attr); this->ec_impl_ = ec; @@ -1019,6 +1021,15 @@ EC_Driver::print_usage (void) } void +EC_Driver::modify_attributes (TAO_EC_Event_Channel_Attributes& attr) +{ + ACE_UNUSED_ARG(attr); + + // This method can be overruled by derived tests to set the event channel + // attributes +} + +void EC_Driver::cleanup_tasks (void) { if (this->tasks_ != 0) diff --git a/TAO/orbsvcs/tests/Event/lib/Driver.h b/TAO/orbsvcs/tests/Event/lib/Driver.h index df182a1369c..da67520b14f 100644 --- a/TAO/orbsvcs/tests/Event/lib/Driver.h +++ b/TAO/orbsvcs/tests/Event/lib/Driver.h @@ -1,18 +1,14 @@ /* -*- C++ -*- */ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// ORBSVCS Real-time Event Channel testsuite -// -// = FILENAME -// Driver -// -// = AUTHOR -// Carlos O'Ryan (coryan@cs.wustl.edu) -// -// ============================================================================ +//============================================================================= +/** + * @file Driver + * + * $Id$ + * + * @author Carlos O'Ryan (coryan@cs.wustl.edu) + */ +//============================================================================= + #ifndef EC_DRIVER_H #define EC_DRIVER_H @@ -40,288 +36,299 @@ class EC_Supplier; #include "orbsvcs/CosNamingC.h" #endif +/** + * @class EC_Driver + * + * @brief Defines the interface of a test driver + * + * Abstract base class for the test driver, this let us implement a + * collocated and a non-collocated test, and to write generic + * consumers and suppliers that can call back the driver. + */ class EC_Test_Export EC_Driver { - // - // = TITLE - // Defines the interface of a test driver - // - // = DESCRIPTION - // Abstract base class for the test driver, this let us implement a - // collocated and a non-collocated test, and to write generic - // consumers and suppliers that can call back the driver. - // public: + /// Constructor EC_Driver (void); - // Constructor + /// Destructor virtual ~EC_Driver (void); - // Destructor + /// Flag to indicate in the test should be verbose. int verbose (void) const; - // Flag to indicate in the test should be verbose. + /// Execute the test. virtual int run (int argc, char* argv[]); - // Execute the test. + /// The initialization section virtual void run_init (int& argc, char* argv[] ACE_ENV_ARG_DECL); - // The initialization section + /// The cleanup section virtual void run_cleanup (ACE_ENV_SINGLE_ARG_DECL); - // The cleanup section + /// Initialize the ORB and obtain the RootPOA object virtual void initialize_orb_and_poa (int& argc, char* argv[] ACE_ENV_ARG_DECL); - // Initialize the ORB and obtain the RootPOA object + /// Parse the common command-line arguments for all tests virtual int parse_args (int& argc, char* argv[]); - // Parse the common command-line arguments for all tests + /// Print the usage method virtual void print_usage (void); - // Print the usage method + /// Print out the arguments virtual void print_args (void) const; - // Print out the arguments + /// Run the test in the real-time class, return -1 on error. virtual int move_to_rt_class (void); - // Run the test in the real-time class, return -1 on error. + /// Construct the EC and its helper objects, also activates the EC in + /// the RootPOA. virtual void initialize_ec_impl (ACE_ENV_SINGLE_ARG_DECL); - // Construct the EC and its helper objects, also activates the EC in - // the RootPOA. + /// By default connect the consumers and then the suppliers, other + /// orders should work too. virtual void connect_clients (ACE_ENV_SINGLE_ARG_DECL); - // By default connect the consumers and then the suppliers, other - // orders should work too. + /// By default disconnect the suppliers and then the consumers, other + /// orders should work too. virtual void disconnect_clients (ACE_ENV_SINGLE_ARG_DECL); - // By default disconnect the suppliers and then the consumers, other - // orders should work too. + /// By default deactivate the suppliers and then the consumers, other + /// orders should work too. virtual void shutdown_clients (ACE_ENV_SINGLE_ARG_DECL); - // By default deactivate the suppliers and then the consumers, other - // orders should work too. + /// Connect all the consumers, by default it lets each consumer + /// connect itself. virtual void connect_consumers (ACE_ENV_SINGLE_ARG_DECL); - // Connect all the consumers, by default it lets each consumer - // connect itself. + /// Connect consumer number <i> using the consumer_admin provided. virtual void connect_consumer ( RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin, int i ACE_ENV_ARG_DECL); - // Connect consumer number <i> using the consumer_admin provided. + /// Build the QoS requirements for consumer <i> virtual void build_consumer_qos ( int i, RtecEventChannelAdmin::ConsumerQOS& qos, int& shutdown_event_type ACE_ENV_ARG_DECL_NOT_USED); - // Build the QoS requirements for consumer <i> + /// Connect all the suppliers, by default it lets each supplier + /// connect itself. virtual void connect_suppliers (ACE_ENV_SINGLE_ARG_DECL); - // Connect all the suppliers, by default it lets each supplier - // connect itself. + /// Connect supplier number <i> using the supplier_admin provided. virtual void connect_supplier ( RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin, int i ACE_ENV_ARG_DECL); - // Connect supplier number <i> using the supplier_admin provided. + /// Build the QoS requirements for supplier <i> virtual void build_supplier_qos ( int i, RtecEventChannelAdmin::SupplierQOS& qos, int& shutdown_event_type ACE_ENV_ARG_DECL_NOT_USED); - // Build the QoS requirements for supplier <i> + /// Execute the test, by default simply call activate_suppliers() virtual void execute_test (ACE_ENV_SINGLE_ARG_DECL); - // Execute the test, by default simply call activate_suppliers() + /** + * Dump the results, i.e. invoke dump_results on all the suppliers + * and consumers, collect the latency and throughput results for + * each and print the totals too. + */ virtual void dump_results (void); - // Dump the results, i.e. invoke dump_results on all the suppliers - // and consumers, collect the latency and throughput results for - // each and print the totals too. + /// Disconnect all the consumers. virtual void disconnect_consumers (ACE_ENV_SINGLE_ARG_DECL); - // Disconnect all the consumers. + /// Disconnect all the suppliers. virtual void disconnect_suppliers (ACE_ENV_SINGLE_ARG_DECL); - // Disconnect all the suppliers. + /// Deactivate all the consumers. virtual void shutdown_consumers (ACE_ENV_SINGLE_ARG_DECL); - // Deactivate all the consumers. + /// Deactivate all the suppliers. virtual void shutdown_suppliers (ACE_ENV_SINGLE_ARG_DECL); - // Deactivate all the suppliers. + /// Call EC->destroy virtual void destroy_ec (ACE_ENV_SINGLE_ARG_DECL); - // Call EC->destroy + /// De-activate the EC (and its helper classes). virtual void deactivate_ec (ACE_ENV_SINGLE_ARG_DECL); - // De-activate the EC (and its helper classes). + /// Cleanup the resources virtual void cleanup_ec (void); virtual void cleanup_tasks (void); virtual void cleanup_consumers (void); virtual void cleanup_suppliers (void); - // Cleanup the resources + /// Allow modifications of the default EC attributes + virtual void modify_attributes (TAO_EC_Event_Channel_Attributes& attr); + + /// Returns the index of the consumer for @a cookie virtual int decode_consumer_cookie (void* cookie) const; - // Returns the index of the consumer for <cookie> + /// Returns the index of the supplier for @a cookie virtual int decode_supplier_cookie (void* cookie) const; - // Returns the index of the supplier for <cookie> + /// One of the consumers in the test has received an event virtual void consumer_push (void* consumer_cookie, const RtecEventComm::EventSet& event ACE_ENV_ARG_DECL); - // One of the consumers in the test has received an event + /// One of the consumers has received a shutdown event virtual void consumer_shutdown (void* consumer_cookie ACE_ENV_ARG_DECL); - // One of the consumers has received a shutdown event + /// One of the consumers in the test has been disconnected from the EC virtual void consumer_disconnect (void* consumer_cookie ACE_ENV_ARG_DECL); - // One of the consumers in the test has been disconnected from the EC + /// One of the suppliers in the test has been disconnected from the EC virtual void supplier_disconnect (void* supplier_cookie ACE_ENV_ARG_DECL); - // One of the suppliers in the test has been disconnected from the EC #if !defined(EC_DISABLE_REMOTE_EC) + /// Obtain the EC from the Naming service virtual void obtain_remote_ec (ACE_ENV_SINGLE_ARG_DECL); - // Obtain the EC from the Naming service virtual CosNaming::NamingContext_ptr get_naming_context (ACE_ENV_SINGLE_ARG_DECL); #endif #if !defined(EC_DISABLE_OLD_EC) + /// Initialize the EC using the old implementation virtual void initialize_old_ec (ACE_ENV_SINGLE_ARG_DECL); - // Initialize the EC using the old implementation #endif + /// Initialize the EC using the old implementation virtual void initialize_new_ec (ACE_ENV_SINGLE_ARG_DECL); - // Initialize the EC using the old implementation + /// Allocate the suppliers and the consumers virtual int allocate_consumers (void); virtual int allocate_suppliers (void); - // Allocate the suppliers and the consumers + /// Allocate one consumer or supplier virtual EC_Consumer* allocate_consumer (int i); virtual EC_Supplier* allocate_supplier (int i); - // Allocate one consumer or supplier + /// Allocate one task for supplier number <i> virtual int allocate_tasks (void); virtual ACE_Task_Base* allocate_task (int i); - // Allocate one task for supplier number <i> + /// Activate all the tasks, by default runs each supplier on its + /// own thread. virtual void activate_tasks (ACE_ENV_SINGLE_ARG_DECL); - // Activate all the tasks, by default runs each supplier on its - // own thread. protected: + /// The ORB CORBA::ORB_var orb_; - // The ORB + /// The Root POA PortableServer::POA_var root_poa_; - // The Root POA + /// The number of consumers int n_consumers_; - // The number of consumers + /// The consumers EC_Consumer** consumers_; - // The consumers + /// The number of suppliers int n_suppliers_; - // The number of suppliers + /// The suppliers EC_Supplier** suppliers_; - // The suppliers + /// The tasks for each supplier ACE_Task_Base** tasks_; - // The tasks for each supplier + /// How many bursts we will send from each supplier. int burst_count_; - // How many bursts we will send from each supplier. + /// The number of events int burst_size_; - // The number of events + /// The size of the payload on each event. int payload_size_; - // The size of the payload on each event. + /// The time between each event burst, in microseconds. int burst_pause_; - // The time between each event burst, in microseconds. + /** + * The consumers subscribe to different sets of events, as follows: + * + * Consumer0: [start , start + count) + * Consumer1: [start + 1*shift, start + 1*shift + count) + * Consumer2: [start + 2*shift, start + 2*shift + count) + * ..... + * .... + * . + * Some sub-tests may choose other configurations, but this is good + * for many cases. + */ int consumer_type_start_; int consumer_type_count_; int consumer_type_shift_; - // The consumers subscribe to different sets of events, as follows: - // - // Consumer0: [start , start + count) - // Consumer1: [start + 1*shift, start + 1*shift + count) - // Consumer2: [start + 2*shift, start + 2*shift + count) - // ..... - // .... - // . - // Some sub-tests may choose other configurations, but this is good - // for many cases. + /** + * The suppliers generate different sets of events, as follows: + * + * Supplier0: [start , start + count) + * Supplier1: [start + 1*shift, start + 1*shift + count) + * Supplier2: [start + 2*shift, start + 2*shift + count) + * ..... + * .... + * . + * Some sub-tests may choose other configurations, but this is good + * for many cases. + */ int supplier_type_start_; int supplier_type_count_; int supplier_type_shift_; - // The suppliers generate different sets of events, as follows: - // - // Supplier0: [start , start + count) - // Supplier1: [start + 1*shift, start + 1*shift + count) - // Supplier2: [start + 2*shift, start + 2*shift + count) - // ..... - // .... - // . - // Some sub-tests may choose other configurations, but this is good - // for many cases. + /// The name of a file where the process stores its pid const char* pid_file_name_; - // The name of a file where the process stores its pid + /// Verbosity flag int verbose_; - // Verbosity flag + /** + * The flags used to create threads, by default we attempt: + * + * THR_SCHED_FIFO|THR_BOUND|THR_NEW_LWP + * + * but if we don't have enough privileges we fall back to + * + * THR_NEW_LWP + * + */ int thr_create_flags_; - // The flags used to create threads, by default we attempt: - // - // THR_SCHED_FIFO|THR_BOUND|THR_NEW_LWP - // - // but if we don't have enough privileges we fall back to - // - // THR_NEW_LWP - // + /// Use a remote event channel. If this flag is enabled it + /// superseedes any options for the event channel implementation. int use_remote_ec_; - // Use a remote event channel. If this flag is enabled it - // superseedes any options for the event channel implementation. + /// The name of the remote event service const char* event_service_name_; - // The name of the remote event service + /// Use the old implementation of the event channel. int use_old_ec_; - // Use the old implementation of the event channel. #if !defined(TAO_EC_DISABLE_OLD_EC) + /// The module factory for the OLD ec TAO_Module_Factory* module_factory_; - // The module factory for the OLD ec #endif + /// The event channel implementation POA_RtecEventChannelAdmin::EventChannel *ec_impl_; - // The event channel implementation + /// The event channel object reference RtecEventChannelAdmin::EventChannel_var event_channel_; - // The event channel object reference }; diff --git a/TAO/orbsvcs/tests/Event/lib/Supplier.h b/TAO/orbsvcs/tests/Event/lib/Supplier.h index 9ce8e6b930a..b19a3bb77db 100644 --- a/TAO/orbsvcs/tests/Event/lib/Supplier.h +++ b/TAO/orbsvcs/tests/Event/lib/Supplier.h @@ -1,18 +1,14 @@ /* -*- C++ -*- */ -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// ORBSVCS Real-time Event Channel testsuite -// -// = FILENAME -// Supplier -// -// = AUTHOR -// Carlos O'Ryan (coryan@cs.wustl.edu) -// -// ============================================================================ +//============================================================================= +/** + * @file Supplier + * + * $Id$ + * + * @author Carlos O'Ryan (coryan@cs.wustl.edu) + */ +//============================================================================= + #ifndef EC_SUPPLIER_H #define EC_SUPPLIER_H @@ -27,129 +23,132 @@ #include "orbsvcs/RtecEventChannelAdminC.h" #include "ace/Task.h" +/** + * @class EC_Supplier + * + * @brief Simple supplier object to implement EC tests. + * + * This class is a supplier of events. + * The class is just a helper to simplify common tasks in EC + * tests, such as subscribing for a range of events, disconnecting + * from the EC, informing the driver of shutdown messages, etc. + * There are several ways to connect and disconnect this class, + * and it is up to the driver program to use the right one. + * The driver can request that to this class to send a new event, + * a new shutdown event or to become "active" and send a number of + * events at a certain rate. + */ class EC_Test_Export EC_Supplier : public POA_RtecEventComm::PushSupplier { - // - // = TITLE - // Simple supplier object to implement EC tests. - // - // = DESCRIPTION - // This class is a supplier of events. - // The class is just a helper to simplify common tasks in EC - // tests, such as subscribing for a range of events, disconnecting - // from the EC, informing the driver of shutdown messages, etc. - // - // There are several ways to connect and disconnect this class, - // and it is up to the driver program to use the right one. - // - // The driver can request that to this class to send a new event, - // a new shutdown event or to become "active" and send a number of - // events at a certain rate. - // public: + /** + * Constructor, specifies the types of events to send. + * Notice that the user can connect to the EC using other + * publications, this is useful for filtering tests. + */ EC_Supplier (EC_Driver *driver, void* supplier_cookie); - // Constructor, specifies the types of events to send. - // Notice that the user can connect to the EC using other - // publications, this is useful for filtering tests. + /// The types of the event is chosen by the driver, based on the + /// cookie and the <event_number> void send_event (int event_number ACE_ENV_ARG_DECL); - // The types of the event is chosen by the driver, based on the - // cookie and the <event_number> + /// Send <event> to the EC. void send_event (const RtecEventComm::EventSet& event ACE_ENV_ARG_DECL); - // Send <event> to the EC. + /// Set the event type and source in <event> void send_event (int event_number, const RtecEventComm::Event& event); - // Set the event type and source in <event> + /// Send a shutdown event. void send_shutdown (ACE_ENV_SINGLE_ARG_DECL); - // Send a shutdown event. + /// Connect using a <supplier_admin> and publications (<qos>) + /// computed by the user virtual void connect ( RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin, const RtecEventChannelAdmin::SupplierQOS& qos, int shutdown_event_type ACE_ENV_ARG_DECL); - // Connect using a <supplier_admin> and publications (<qos>) - // computed by the user + /// Connect using the current consumer_proxy (useful for reconnect test) virtual void connect ( const RtecEventChannelAdmin::SupplierQOS& qos, int shutdown_event_type ACE_ENV_ARG_DECL); - // Connect using the current consumer_proxy (useful for reconnect test) + /// Disconnect from the EC, also deactivates the object void disconnect (ACE_ENV_SINGLE_ARG_DECL); - // Disconnect from the EC, also deactivates the object + /// Disconnect from the EC, also deactivates the object void shutdown (ACE_ENV_SINGLE_ARG_DECL); - // Disconnect from the EC, also deactivates the object + /// Dump the results... virtual void dump_results (const char* name, ACE_UINT32 global_scale_factor); - // Dump the results... + /// Add our statistics to <stats> void accumulate (ACE_Throughput_Stats& stats) const; - // Add our statistics to <stats> + /// Return an event type to push.... void event_type (int event_number, RtecEventComm::Event& event); - // Return an event type to push.... // = The PushSupplier methods virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)); private: + /// Class we forward to. EC_Driver *driver_; - // Class we forward to. + /// Magic cookie provided by the supplier to identify ourselves void* cookie_; - // Magic cookie provided by the supplier to identify ourselves + /// Protect the internal state TAO_SYNCH_MUTEX lock_; - // Protect the internal state + /// Count the number of push() calls int push_count_; - // Count the number of push() calls + /// We talk to the EC (as a supplier) using this proxy. RtecEventChannelAdmin::ProxyPushConsumer_var consumer_proxy_; - // We talk to the EC (as a supplier) using this proxy. + /// The time for the first event sent ACE_hrtime_t throughput_start_; - // The time for the first event sent + /// Measure the elapsed time spent while sending the events. ACE_Throughput_Stats throughput_; - // Measure the elapsed time spent while sending the events. int burst_count_; int burst_size_; int payload_size_; int burst_pause_; + /// The test data. int shutdown_event_type_; - // The test data. + /// The publications, used to select the events. RtecEventChannelAdmin::SupplierQOS qos_; - // The publications, used to select the events. + /// Is the supplier active in the POA? int is_active_; - // Is the supplier active in the POA? + /// Cache the object reference to speed up connect/disconnect calls RtecEventComm::PushSupplier_var myself_; - // Cache the object reference to speed up connect/disconnect calls }; // **************************************************************** +/** + * @class EC_Supplier_Task + */ class EC_Supplier_Task : public ACE_Task_Base { - // public: + /// Constructor EC_Supplier_Task (EC_Supplier* supplier, EC_Driver* driver, void* cookie, @@ -159,36 +158,35 @@ public: int payload_size, int shutdown_event_type, ACE_Thread_Manager* thr_mgr = 0); - // Constructor + /// The svc call virtual int svc (void); - // The svc call private: + /// The supplier EC_Supplier* supplier_; - // The supplier + /// The driver program EC_Driver* driver_; - // The driver program + /// The magic cookie assigned to the supplier void* cookie_; - // The magic cookie assigned to the supplier + /// Number of events "bursts" int burst_count_; - // Number of events "bursts" + /// The number of events in a "burst", i.e. between two calls to + /// sleep. int burst_size_; - // The number of events in a "burst", i.e. between two calls to - // sleep. + /// The sleep time (in usecs) between each burst int burst_pause_; - // The sleep time (in usecs) between each burst + /// The size of the payload in each event. int payload_size_; - // The size of the payload in each event. + /// Define the shutdown event, invoked at the end of the loop. int shutdown_event_type_; - // Define the shutdown event, invoked at the end of the loop. }; #endif /* EC_SUPPLIER_H */ |