2 //=============================================================================
6 * @author Pradeep Gore <pradeep@cs.wustl.edu>
8 //=============================================================================
11 #ifndef NOTIFY_Throughput_H
12 #define NOTIFY_Throughput_H
14 #include "Notify_Test_Client.h"
15 #include "Notify_StructuredPushConsumer.h"
16 #include "Notify_StructuredPushSupplier.h"
18 #include "ace/Stats.h"
19 #include "ace/Throughput_Stats.h"
20 #include "ace/High_Res_Timer.h"
21 #include "ace/Sched_Params.h"
25 #pragma warning(disable:4250)
31 * @brief Run a server thread
33 * Use the ACE_Task_Base class to run server threads
35 class Worker
: public ACE_Task_Base
41 void orb (CORBA::ORB_ptr orb
);
43 /// The thread entry point.
53 /***************************************************************************/
55 class Notify_Throughput
;
57 class Throughput_StructuredPushConsumer
58 : public TAO_Notify_Tests_StructuredPushConsumer
62 Throughput_StructuredPushConsumer (Notify_Throughput
*test_client
);
64 // = StructuredPushSupplier methods
65 virtual void push_structured_event (
66 const CosNotification::StructuredEvent
& notification
);
68 /// Accumulate the throughput statistics into <throughput>
69 void accumulate_into (ACE_Throughput_Stats
&throughput
) const;
71 /// Accumulate the throughput statistics into <throughput>
72 void dump_stats (const ACE_TCHAR
* msg
,
73 ACE_High_Res_Timer::global_scale_factor_type gsf
);
76 Notify_Throughput
* test_client_
;
78 /// Protect internal state
79 TAO_SYNCH_MUTEX lock_
;
81 /// The timestamp for the first message received
82 ACE_hrtime_t throughput_start_
;
84 /// Used for reporting stats
85 ACE_Throughput_Stats throughput_
;
87 /// The number of push() calls
91 /***************************************************************************/
93 class Throughput_StructuredPushSupplier
94 : public TAO_Notify_Tests_StructuredPushSupplier
,
99 Throughput_StructuredPushSupplier (Notify_Throughput
* test_client
);
102 virtual ~Throughput_StructuredPushSupplier ();
104 // = The ACE_Task_Base methods....
107 /// Accumulate the throughput statistics into <throughput>
108 void accumulate_into (ACE_Throughput_Stats
&throughput
) const;
110 /// Accumulate the throughput statistics into <throughput>
111 void dump_stats (const ACE_TCHAR
* msg
,
112 ACE_High_Res_Timer::global_scale_factor_type gsf
);
115 Notify_Throughput
* test_client_
;
117 /// Count the number of push() calls
120 /// The time for the first event sent
121 ACE_hrtime_t throughput_start_
;
123 /// Measure the elapsed time spent while sending the events.
124 ACE_Throughput_Stats throughput_
;
127 /***************************************************************************/
129 class Notify_Throughput
: public Notify_Test_Client
132 // Initialization and termination code
133 Notify_Throughput ();
134 virtual ~Notify_Throughput ();
136 int parse_args(int argc
, ACE_TCHAR
*argv
[]) ;
139 int init (int argc
, ACE_TCHAR
*argv
[]);
144 /// Peers call this when done.
147 /// check if we got the expected results.
148 void dump_results ();
152 /// Create participants.
155 /// is the ec collocated.
156 CORBA::Boolean collocated_ec_
;
158 /// How many bursts we will send from each supplier.
161 /// The time between each event burst, in microseconds.
164 /// Number of events to send per supplier in every burst
167 /// data size to transmit.
179 /// Number of events received that each consumer expects to see.
180 int perconsumer_count_
;
182 /// The name of the EC to resolve.
183 ACE_CString ec_name_
;
185 /// The one channel that we create using the factory.
186 CosNotifyChannelAdmin::EventChannel_var ec_
;
188 /// The consumer admin used by consumers.
189 CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_
;
191 /// The supplier admin used by suppliers.
192 CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin_
;
195 Throughput_StructuredPushConsumer
** consumers_
;
198 Throughput_StructuredPushSupplier
** suppliers_
;
202 // = Helpers to signal done.
203 /// how many peers are done.
204 int peer_done_count_
;
206 /// The lock to serialize access to members.
207 TAO_SYNCH_MUTEX lock_
;
209 /// exit wait condition
210 TAO_SYNCH_CONDITION condition_
;
212 friend class Throughput_StructuredPushSupplier
;
213 friend class Throughput_StructuredPushConsumer
;
216 /***************************************************************************/
218 #if defined(_MSC_VER)
220 #endif /* _MSC_VER */
222 #endif /* NOTIFY_TESTS_EventS_H */