Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / tests / EC_Throughput / ECT_Throughput.h
blob9d2a48261b1af3dd7833e34c1a67482632c90070
1 /* -*- C++ -*- */
2 //
3 // ============================================================================
4 //
5 // = DESCRIPTION
6 // This is a helper class for the throughput tests of the Event
7 // Channel.
8 // Used for the collocated test.
9 //
10 // ============================================================================
12 #ifndef ECT_THROUGHPUT_H
13 #define ECT_THROUGHPUT_H
15 #include "ECT_Driver.h"
16 #include "ECT_Consumer.h"
17 #include "ECT_Supplier.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 class ECT_Throughput : public ECT_Driver
25 public:
26 ECT_Throughput (void);
28 virtual ~ECT_Throughput (void);
30 enum {
31 MAX_CONSUMERS = 16,
32 // Maximum number of consumers.
33 MAX_SUPPLIERS = 16
34 // Maximum number of suppliers.
37 int run (int argc, ACE_TCHAR* argv[]);
38 // Execute the test.
40 virtual void shutdown_consumer (void* consumer_cookie);
41 // Callback method for consumers, each consumer will call this
42 // method once it receives all the shutdown events from the
43 // suppliers.
45 private:
46 int parse_args (int argc, ACE_TCHAR* argv[]);
47 // parse the command line args
49 void connect_consumers (RtecScheduler::Scheduler_ptr scheduler,
50 RtecEventChannelAdmin::EventChannel_ptr local_ec);
51 void disconnect_consumers (void);
52 // Connect and disconnect the consumers.
54 void connect_suppliers (RtecScheduler::Scheduler_ptr scheduler,
55 RtecEventChannelAdmin::EventChannel_ptr local_ec);
56 void disconnect_suppliers (void);
57 // Connect the suppliers.
59 void activate_suppliers (void);
60 // Activate the suppliers, i.e. they start generating events.
62 void dump_results (void);
63 // Dump the results for each supplier.
65 private:
66 Test_Consumer* consumers_[ECT_Throughput::MAX_CONSUMERS];
67 // The consumer array.
69 int n_consumers_;
70 // The number of consumers.
72 Test_Supplier* suppliers_[ECT_Throughput::MAX_SUPPLIERS];
73 // The suppliers array.
75 int n_suppliers_;
76 // The number of suppliers.
78 int burst_count_;
79 // How many bursts we will send from each supplier.
81 int burst_size_;
82 // The number of events
84 int event_size_;
85 // The size of the payload on each event.
87 int burst_pause_;
88 // The time between each event burst, in microseconds.
90 int consumer_type_start_;
91 int consumer_type_count_;
92 int consumer_type_shift_;
93 // The consumers subscribe to different sets of events, as follows:
94 // Consumer0: [start , start + count)
95 // Consumer1: [start + 1*shift, start + 1*shift + count)
96 // Consumer2: [start + 2*shift, start + 2*shift + count)
97 // And so on.
99 int supplier_type_start_;
100 int supplier_type_count_;
101 int supplier_type_shift_;
102 // The suppliers generate different sets of events, as follows:
103 // Supplier0: [start , start + count)
104 // Supplier1: [start + 1*shift, start + 1*shift + count)
105 // Supplier2: [start + 2*shift, start + 2*shift + count)
106 // And so on.
108 const ACE_TCHAR* pid_file_name_;
109 // The name of a file where the process stores its pid
111 CORBA::ORB_var orb_;
112 // A reference to the ORB, to shut it down properly.
114 TAO_SYNCH_MUTEX lock_;
115 int active_count_;
116 // How many consumers are still receiving events.
118 int ec_concurrency_hwm_;
119 // Set the HWM for the concurrency in the EC.
121 int thr_create_flags_;
122 // The thread creation flags
125 #endif /* ECT_TRHOUGHPUT_H */