3 // ============================================================================
6 // This test to measure how many events per minute can the EC
7 // process, it also serves as an example how how to encode complex
8 // data types in a octet sequence.
10 // ============================================================================
12 #ifndef ECT_CONSUMER_H
13 #define ECT_CONSUMER_H
15 #include "ECT_Driver.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "orbsvcs/Channel_Clients_T.h"
22 #include "orbsvcs/RtecSchedulerC.h"
23 #include "orbsvcs/RtecEventChannelAdminC.h"
25 #include "ace/OS_NS_time.h"
26 #include "ace/Throughput_Stats.h"
28 class Test_Consumer
: public POA_RtecEventComm::PushConsumer
31 // Receive the events.
34 // This class is a consumer of events. It subscribes for a
35 // continous ranges of event types, this permits studying the
36 // effect of the number of subscriptions for each particular kind
37 // of event on the EC.
40 Test_Consumer (ECT_Driver
* driver
,
43 int stall_length
= 0);
45 void connect (RtecScheduler::Scheduler_ptr scheduler
,
49 RtecEventChannelAdmin::EventChannel_ptr ec
);
50 // This method connects the consumer to the EC.
52 void disconnect (void);
53 // Disconnect from the EC.
55 void dump_results (const ACE_TCHAR
* name
,
56 ACE_Basic_Stats::scale_factor_type global_scale_factor
);
57 // Print out the results
59 void accumulate (ACE_Throughput_Stats
& stats
) const;
60 // Add our throughput and latency statistics to <stats>
62 virtual void push (const RtecEventComm::EventSet
& events
);
63 virtual void disconnect_push_consumer (void);
64 // The skeleton methods.
68 // The main driver for the test.
71 // A magic cookie passed by the driver that we pass back in our
75 // The number of suppliers that are feeding this consumer, we
76 // terminate once we receive a shutdown event from each supplier.
78 RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_
;
79 // We talk to the EC using this proxy.
81 TAO_SYNCH_MUTEX lock_
;
83 ACE_hrtime_t first_event_
;
84 // How many events we have received.
86 ACE_Throughput_Stats throughput_
;
87 // Used for reporting stats.
90 // How many shutdown events we have received.
93 // How long (in seconds) we wait to continue processing
94 // after receiving the first push.
97 #endif /* ECT_CONSUMER_H */