summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhuangming <huangminghuang@users.noreply.github.com>2003-11-23 02:52:20 +0000
committerhuangming <huangminghuang@users.noreply.github.com>2003-11-23 02:52:20 +0000
commit0579af9cf4ad12baa10a61f00acd5174e222bd14 (patch)
tree9b98fe1375c9f478e2026153d2285167c122713d
parent6aed8df739c1f28b92c77d96e267d35220674875 (diff)
downloadATCD-0579af9cf4ad12baa10a61f00acd5174e222bd14.tar.gz
*** empty log message ***
-rw-r--r--TAO/orbsvcs/tests/FtRtEvent/FtRtEvent_Test.cpp1
-rw-r--r--TAO/orbsvcs/tests/FtRtEvent/PushConsumer.cpp20
-rw-r--r--TAO/orbsvcs/tests/FtRtEvent/PushConsumer.h3
-rw-r--r--TAO/orbsvcs/tests/FtRtEvent/PushSupplier.cpp43
4 files changed, 36 insertions, 31 deletions
diff --git a/TAO/orbsvcs/tests/FtRtEvent/FtRtEvent_Test.cpp b/TAO/orbsvcs/tests/FtRtEvent/FtRtEvent_Test.cpp
index b92638cfb15..13ef57385d0 100644
--- a/TAO/orbsvcs/tests/FtRtEvent/FtRtEvent_Test.cpp
+++ b/TAO/orbsvcs/tests/FtRtEvent/FtRtEvent_Test.cpp
@@ -21,6 +21,7 @@ FtRtEvent_Test_Base::FtRtEvent_Test_Base()
{
options_.num_iterations=100;
options_.timer_interval.set(1,0);
+ options_.proxy_consumer_file="consumer.ior";
}
FtRtEvent_Test_Base::~FtRtEvent_Test_Base()
diff --git a/TAO/orbsvcs/tests/FtRtEvent/PushConsumer.cpp b/TAO/orbsvcs/tests/FtRtEvent/PushConsumer.cpp
index 218a14f7446..31afd0a68b6 100644
--- a/TAO/orbsvcs/tests/FtRtEvent/PushConsumer.cpp
+++ b/TAO/orbsvcs/tests/FtRtEvent/PushConsumer.cpp
@@ -4,7 +4,6 @@
#include "orbsvcs/Event_Utilities.h"
#include "orbsvcs/FtRtEvent/Utils/resolve_init.h"
#include "FtRtEvent_Test.h"
-#include <vector>
#include <fstream>
#include "orbsvcs/FtRtEvent/Utils/Log.h"
@@ -13,9 +12,6 @@ ACE_RCSID (FtRtEvent,
PushConsumer,
"$Id$")
-namespace {
- std::vector<int> run_times;
-}
PushConsumer_impl::PushConsumer_impl()
{
@@ -27,7 +23,7 @@ int PushConsumer_impl::init(CORBA::ORB_ptr orb,
{
orb_ = orb;
num_iterations_ = options.num_iterations;
- run_times.assign(options.num_iterations, -1);
+ run_times_.assign(options.num_iterations, -1);
RtecEventChannelAdmin::ConsumerQOS qos;
qos.is_gateway = 1;
@@ -77,12 +73,12 @@ PushConsumer_impl::push (const RtecEventComm::EventSet & event
TimeBase::TimeT elaps =
time_val.sec () * 10000000 + time_val.usec ()* 10 - event[0].header.ec_send_time;
event[0].data.any_value >>= x;
- run_times[x] = static_cast<int>(elaps/10);
-
- TAO_FTRTEC::Log(3, "received event %d\n", x);
-
- if ( num_iterations_ == static_cast<int>(x) ) {
+ if ( num_iterations_ > static_cast<int>(x) ) {
+ run_times_[x] = static_cast<int>(elaps/10);
+ TAO_FTRTEC::Log(3, "received event %d\n", x);
+ }
+ else {
supplier_->disconnect_push_supplier();
orb_->shutdown();
output_result();
@@ -116,9 +112,9 @@ PushConsumer_impl::output_result()
{
int lost = 0;
for (int i =0; i < num_iterations_; ++i)
- if (run_times[i] == -1) lost++;
+ if (run_times_[i] == -1) lost++;
else
- ACE_DEBUG((LM_DEBUG, "%5d received, elapsed time = %d\n",i, run_times[i]));
+ ACE_DEBUG((LM_DEBUG, "%5d received, elapsed time = %d\n",i, run_times_[i]));
ACE_DEBUG((LM_DEBUG, "%d events lost out of %d events\n", lost, num_iterations_));;
}
diff --git a/TAO/orbsvcs/tests/FtRtEvent/PushConsumer.h b/TAO/orbsvcs/tests/FtRtEvent/PushConsumer.h
index dcea2b2b8cc..d1f93c7fab2 100644
--- a/TAO/orbsvcs/tests/FtRtEvent/PushConsumer.h
+++ b/TAO/orbsvcs/tests/FtRtEvent/PushConsumer.h
@@ -13,6 +13,7 @@
#define PUSHCONSUMERIMPL_H
#include "orbsvcs/RtecEventChannelAdminC.h"
#include "orbsvcs/RtecEventCommS.h"
+#include <vector>
struct Options;
@@ -46,6 +47,8 @@ private:
CORBA::ORB_var orb_;
int num_iterations_;
RtecEventChannelAdmin::ProxyPushSupplier_var supplier_;
+ std::vector<int> run_times_;
+
PushConsumer_impl(const PushConsumer_impl&);
void operator==(const PushConsumer_impl&);
};
diff --git a/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.cpp b/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.cpp
index 9d6a3b3e38b..67112ec78bb 100644
--- a/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.cpp
+++ b/TAO/orbsvcs/tests/FtRtEvent/PushSupplier.cpp
@@ -119,21 +119,24 @@ int PushSupplier_impl::handle_timeout (const ACE_Time_Value &current_time,
ACE_UNUSED_ARG(act);
ACE_UNUSED_ARG(current_time);
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY {
- RtecEventComm::EventSet event (1);
- event.length (1);
- event[0].header.type = ACE_ES_EVENT_UNDEFINED;
- event[0].header.source = 1;
- event[0].header.ttl = 1;
+ FTRTEC_TRACE("PushSupplier_impl::handle_timeout");
+
+ RtecEventComm::EventSet event (1);
+ event.length (1);
+ event[0].header.type = ACE_ES_EVENT_UNDEFINED;
+ event[0].header.source = 1;
+ event[0].header.ttl = 1;
- ACE_Time_Value time_val = ACE_OS::gettimeofday ();
- TAO_FTRTEC::Log(1, "sending data %d\n", seq_no_);
+ ACE_Time_Value time_val = ACE_OS::gettimeofday ();
+ TAO_FTRTEC::Log(1, "sending data %d\n", seq_no_);
- event[0].header.ec_send_time = time_val.sec () * 10000000 + time_val.usec ()* 10;
- event[0].data.any_value <<= seq_no_;
+ event[0].header.ec_send_time = time_val.sec () * 10000000 + time_val.usec ()* 10;
+ event[0].data.any_value <<= seq_no_;
+ bool final = (num_iterations_ <= (int) seq_no_++);
- if (num_iterations_ > (int) seq_no_++) {
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY {
+ if (!final) {
consumer_->push(event ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
@@ -147,19 +150,21 @@ int PushSupplier_impl::handle_timeout (const ACE_Time_Value &current_time,
ACE_OS::sleep(1);
consumer->push(event ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
- ACE_DEBUG((LM_DEBUG, "shutdown orb\n"));
- this->reactor()->cancel_timer(this);
- this->reactor()->end_reactor_event_loop();
- this->reactor(0);
- orb_->shutdown();
}
-
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "A CORBA Exception occurred.");
}
ACE_ENDTRY;
+
+ if (final) {
+ ACE_DEBUG((LM_DEBUG, "shutdown orb\n"));
+ this->reactor()->cancel_timer(this);
+ this->reactor()->end_reactor_event_loop();
+ this->reactor(0);
+ orb_->shutdown();
+ }
+
return 0;
}