Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Event / Performance / Connect.h
blobd9272ca9ff92e6b24a8f101c55aecf373f1b96d8
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Connect.h
6 * @author Carlos O'Ryan (coryan@cs.wustl.edu)
7 */
8 //=============================================================================
11 #ifndef EC_CONNECT_H
12 #define EC_CONNECT_H
14 #include "Consumer.h"
15 #include "Supplier.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 /**
22 * @class EC_Connect
24 * @brief Test the EC connection feature
26 * The EC can be configured to allow re-connection of suppliers
27 * and consumers, this test verifies that:
28 * + The EC does *not* allow connections if the feature is
29 * disabled (the default)
30 * + The EC does allow connections if the feature is enabled
31 * and:
32 * - There are no memory leaks
33 * - Compares the time required for a connection vs a complete
34 * connect/disconnect cycle, specially as the number of
35 * suppliers and consumers increases.
37 class EC_Connect : public EC_Driver
39 public:
40 /// Constructor
41 EC_Connect (void);
43 // = The EC_Driver methods
44 virtual int parse_args (int& argc, ACE_TCHAR* argv[]);
45 virtual void print_usage (void);
46 virtual void print_args (void) const;
48 /// Don't run the suppliers, just test connect and disconnect calls.
49 void execute_test (void);
51 virtual void dump_results (void);
53 virtual void connect_consumer (
54 RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin,
55 int i);
56 virtual void connect_supplier (
57 RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin,
58 int i);
59 virtual void disconnect_consumers (void);
60 virtual void disconnect_suppliers (void);
62 virtual EC_Consumer* allocate_consumer (int i);
63 virtual EC_Supplier* allocate_supplier (int i);
65 virtual void connect_clients (void);
66 virtual void disconnect_clients (void);
68 private:
69 ACE_hrtime_t start_time_;
70 ACE_Throughput_Stats consumer_connect_;
71 ACE_Throughput_Stats supplier_connect_;
72 ACE_Throughput_Stats consumer_disconnect_;
73 ACE_Throughput_Stats supplier_disconnect_;
75 /// What is connected first?
76 int order_;
79 // ****************************************************************
81 class ECC_Consumer : public EC_Consumer
83 public:
84 ECC_Consumer (EC_Driver *driver, void* cookie);
86 virtual void connect (
87 RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin,
88 const RtecEventChannelAdmin::ConsumerQOS& qos,
89 int shutdown_event_type);
90 virtual void connect (
91 const RtecEventChannelAdmin::ConsumerQOS& qos,
92 int shutdown_event_type);
93 virtual void dump_results (const ACE_TCHAR* name,
94 ACE_High_Res_Timer::global_scale_factor_type global_scale_factor);
96 private:
97 ACE_Throughput_Stats connect_time_;
100 // ****************************************************************
102 class ECC_Supplier : public EC_Supplier
104 public:
105 ECC_Supplier (EC_Driver *driver, void* cookie);
107 virtual void connect (
108 RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin,
109 const RtecEventChannelAdmin::SupplierQOS& qos,
110 int shutdown_event_type);
111 virtual void connect (
112 const RtecEventChannelAdmin::SupplierQOS& qos,
113 int shutdown_event_type);
114 virtual void dump_results (const ACE_TCHAR* name,
115 ACE_High_Res_Timer::global_scale_factor_type global_scale_factor);
117 private:
118 ACE_Throughput_Stats connect_time_;
121 #endif /* EC_CONNECT_H */