summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthrall <thrall@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-03-21 03:23:34 +0000
committerthrall <thrall@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-03-21 03:23:34 +0000
commit3458930847e66254bcc58341693c582b51196fbe (patch)
tree05542bc03d7135c257631975f5583188c9115ea3
parent16bac2973dd3d99d98dd33c454dc9228b96f82d7 (diff)
downloadATCD-3458930847e66254bcc58341693c582b51196fbe.tar.gz
Configurator_SyntaxHandler: fixed bug where consumers without
dependants weren't registering with EC. Set worktime from configuration file. supplierec.xml: Lowered event rate to avoid starving process thread. Added Subtask3_Trigger type to resolve Gateway dependency. Status: No known bugs. I need to do more testing to be sure.
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp70
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp24
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.h2
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/Consumer_EC.cpp10
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/Consumer_Supplier_EC.cpp10
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/supplierec.xml15
-rw-r--r--TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/svc.conf2
7 files changed, 85 insertions, 48 deletions
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp
index 1a6847bf865..52027dc0af9 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/Configurator_SyntaxHandler.cpp
@@ -429,7 +429,7 @@ Configurator_SyntaxHandler::parseConsumer (Consumer* vs, void* arg)
ACE_THROW_SPEC ((ACEXML_SAXException))
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT("SyntaxHandler visiting Consumer: %s\n"),vs->name.c_str()));
- //ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Consumer dependants at %@\n"),vs->dependants));
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Consumer subscriptions at %@\n"),vs->subscriptions));
if (!vs->subscriptions)
{
@@ -442,12 +442,11 @@ Configurator_SyntaxHandler::parseConsumer (Consumer* vs, void* arg)
Kokyu_EC::QoSVector subs;
vs->subscriptions->visit(this,&subs);
- //ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Consumer dependants at %@\n"),vs->dependants));
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Consumer dependants at %@\n"),vs->dependants));
SupplierVector dependants; //dependants push_back
if (vs->dependants)
vs->dependants->visit(this,&dependants);
- //ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Consumer dependants at %@\n"),vs->dependants));
// Register Consumer
Kokyu_EC *ec = static_cast<Kokyu_EC*> (arg);
@@ -455,42 +454,67 @@ Configurator_SyntaxHandler::parseConsumer (Consumer* vs, void* arg)
RtEventChannelAdmin::Time max_exec;
ECSupplier::EventTypeVector subtypes;
Kokyu_EC::QoSVector::iterator subiter = subs.begin();
- for (; subiter != subs.end(); ++subiter)
+ int count;
+ for (count=0; subiter != subs.end(); ++subiter,++count)
{
Kokyu_EC::QoSVector::value_type qos = *subiter;
- if (max_exec < qos.wc_time) // find maximum worst-case time
+ if (max_exec < qos.wc_time || !count) // find maximum worst-case time
max_exec = qos.wc_time;
subtypes.push_back(qos.type);
}
+ // DEBUG
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Consumer subscription types: ")));
+ ECSupplier::EventTypeVector::iterator typeiter;
+ for (typeiter = subtypes.begin(); typeiter != subtypes.end(); ++typeiter)
+ {
+ ECSupplier::EventTypeVector::value_type type = *typeiter;
+
+ ACE_DEBUG ((LM_DEBUG, "%d ",type));
+ }
+ ACE_DEBUG((LM_DEBUG,"\n"));
+ // END DEBUG
+
ACE_Time_Value exec_time; // Consumer executes max worst-case time
ORBSVCS_Time::TimeT_to_Time_Value (exec_time,max_exec);
ECConsumer *consumer;
ACE_NEW_RETURN(consumer,
ECConsumer(subtypes),-1);
- //consumer->setWorkTime(exec_time);
+ consumer->setWorkTime(exec_time);
// for each dependant, set up the dependency
- SupplierVector::iterator siter = dependants.begin();
- for (; siter != dependants.end(); ++siter)
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Consumer setting up dependencies: %d"), dependants.size()));
+ if (dependants.size())
{
- SupplierVector::value_type supplier = *siter;
- SupplierMap::VALUE ecsupplier;
- this->suppliermap.find(supplier->name,ecsupplier);
- ACE_ASSERT(ecsupplier); // shouldn't have got here with no Supplier
-
- // if multiple timeouts, this won't reg supplier multiple times
- consumer->pushDependant(ecsupplier);
- ec->add_consumer_with_supplier(consumer,
- vs->name.c_str(),
- subs,
- ecsupplier,
- supplier->name.c_str(),
- ecsupplier->getPublishedTypes()
- ACE_ENV_ARG_PARAMETER
- );
+ SupplierVector::iterator siter = dependants.begin();
+ for (; siter != dependants.end(); ++siter)
+ {
+ SupplierVector::value_type supplier = *siter;
+ SupplierMap::VALUE ecsupplier;
+ this->suppliermap.find(supplier->name,ecsupplier);
+ ACE_ASSERT(ecsupplier); // shouldn't have got here with no Supplier
+
+ // if multiple timeouts, this won't reg supplier multiple times
+ consumer->pushDependant(ecsupplier);
+ ec->add_consumer_with_supplier(consumer,
+ vs->name.c_str(),
+ subs,
+ ecsupplier,
+ supplier->name.c_str(),
+ ecsupplier->getPublishedTypes()
+ ACE_ENV_ARG_PARAMETER
+ );
+ }
+ }
+ else
+ { // no dependants to register
+ ec->add_consumer(consumer,
+ vs->name.c_str(),
+ subs
+ ACE_ENV_ARG_PARAMETER
+ );
}
this->consumermap.bind(vs->name,consumer);
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp
index 2160cbbcf7a..928879672a0 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.cpp
@@ -17,7 +17,7 @@
ACE_RCSID(EC_Examples, ECConsumer, "$Id$")
ECConsumer::ECConsumer (EventTypeVector &sub_types, Service_Handler * handler)
- : worktime_(0,0)
+ : _worktime(0,0)
, handler_(handler)
, sub_types_(sub_types)
{
@@ -26,7 +26,7 @@ ECConsumer::ECConsumer (EventTypeVector &sub_types, Service_Handler * handler)
ECConsumer::ECConsumer (EventTypeVector &sub_types,
ACE_Time_Value& worktime,
Service_Handler *handler)
- : worktime_(worktime)
+ : _worktime(worktime)
, handler_(handler)
, sub_types_(sub_types)
{
@@ -64,21 +64,17 @@ ECConsumer::push (const RtecEventComm::EventSet& events
}
ACE_High_Res_Timer timer;
- ACE_Time_Value elapsed_time;
+ ACE_Time_Value elapsed_time(ACE_Time_Value::zero);
static CORBA::ULong prime_number = 9619899;
ACE_DEBUG((LM_DEBUG,"ECConsumer (%P|%t) worktime is %isec %iusec\n",
- this->worktime_.sec(),this->worktime_.usec()));
-
- // DEBUG
- //this->worktime_.set(0,200000);
- // END DEBUG
+ this->_worktime.sec(),this->_worktime.usec()));
ACE_Time_Value start_time(ACE_OS::gettimeofday());
timer.start();
int j=0;
- while (elapsed_time <= this->worktime_)
+ while (elapsed_time <= this->_worktime)
{
//ACE_DEBUG((LM_DEBUG,"%isec %iusec elapsed\n",elapsed_time.sec(),elapsed_time.usec()));
@@ -113,9 +109,17 @@ ECConsumer::push (const RtecEventComm::EventSet& events
for(; siter != this->dependants_.end(); ++siter)
{
SupplierVector::value_type supplier = *siter;
+ ACE_DEBUG((LM_DEBUG,"ECConsumer (%P|%t) processing dependant %d\n",supplier->get_id()));
supplier->timeout_occured(ACE_ENV_SINGLE_ARG_PARAMETER);
}
+ ACE_DEBUG((LM_DEBUG,"ECConsumer (%P|%t) finished processing dependants\n"));
+ // DEBUG
+// static int t = 0;
+// if (t++ >= 2)
+// this->_worktime.set(0,200000);
+ // END DEBUG
+
if (this->handler_ != 0)
{
ACE_DEBUG((LM_DEBUG,"ECConsumer (%P|%t) calling handle_service_stop()\n"));
@@ -133,7 +137,7 @@ ECConsumer::disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
void
ECConsumer::setWorkTime(ACE_Time_Value& worktime)
{
- this->worktime_.set(worktime.sec(),worktime.usec());
+ this->_worktime.set(worktime.sec(),worktime.usec());
}
void
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.h b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.h
index 612a0d379ca..e56cc687c40 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.h
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/ECConsumer.h
@@ -82,7 +82,7 @@ public:
void pushDependant (ECSupplier *dep);
protected:
- ACE_Time_Value worktime_;
+ ACE_Time_Value _worktime;
SupplierVector dependants_;
InfoHandle rt_info_;
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/Consumer_EC.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/Consumer_EC.cpp
index a1913f2e83a..174bf0e486a 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/Consumer_EC.cpp
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/Consumer_EC.cpp
@@ -36,17 +36,17 @@ main (int argc, char *argv[])
Arguments args;
args.filename_.set(ACE_TEXT("consumerec.xml"));
+ // ORB initialization boiler plate...
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
// parse args for config filename
if (parse_args(argc,argv,args) == -1)
{
return 1;
}
- // ORB initialization boiler plate...
- CORBA::ORB_var orb =
- CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
CORBA::Object_var object =
orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/Consumer_Supplier_EC.cpp b/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/Consumer_Supplier_EC.cpp
index 906e3c21f3d..d273f8d878b 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/Consumer_Supplier_EC.cpp
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/Consumer_Supplier_EC.cpp
@@ -36,17 +36,17 @@ main (int argc, char *argv[])
Arguments args;
args.filename_.set(ACE_TEXT("conssuppec.xml"));
+ // ORB initialization boiler plate...
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
// parse args for config filename
if (parse_args(argc,argv,args) == -1)
{
return 1;
}
- // ORB initialization boiler plate...
- CORBA::ORB_var orb =
- CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
CORBA::Object_var object =
orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/supplierec.xml b/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/supplierec.xml
index 3dd48824442..b24140fd6ca 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/supplierec.xml
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/supplierec.xml
@@ -6,12 +6,12 @@
<!-- Define the events -->
<!-- THESE NEED TO BE THE SAME AS DEFINED IN THE CLIENT XML! -->
<Timeout name="Subtask1 Timeout" >
- <Period>200</Period> <!-- in msec -->
+ <Period>5000</Period> <!-- in msec -->
<Phase>0</Phase> <!-- in msec -->
</Timeout>
<Event name="Subtask1 Trigger" type="16">
- <Period>200</Period> <!-- in msec -->
+ <Period>5000</Period> <!-- in msec -->
<Phase>0</Phase> <!-- in msec -->
<Criticality value="VERY_LOW" />
<Importance value="VERY_LOW" />
@@ -20,7 +20,7 @@
</Event>
<Event name="Subtask2 Trigger" type="17">
- <Period>200</Period> <!-- in msec -->
+ <Period>5000</Period> <!-- in msec -->
<Phase>0</Phase> <!-- in msec -->
<Criticality value="VERY_LOW" />
<Importance value="VERY_LOW" />
@@ -28,6 +28,15 @@
<TypicalExecution>50</TypicalExecution> <!-- in msec -->
</Event>
+<Event name="Subtask3 Trigger" type="18">
+ <Period>200</Period> <!-- in msec -->
+ <Phase>0</Phase> <!-- in msec -->
+ <Criticality value="VERY_HIGH" />
+ <Importance value="VERY_HIGH" />
+ <WorstExecution>50</WorstExecution> <!-- in msec -->
+ <TypicalExecution>50</TypicalExecution> <!-- in msec -->
+</Event>
+
<!-- Configure the ECs -->
<RemoteEventChannel name="Middle" connection="Output">
<IORFile>Middle.ior</IORFile>
diff --git a/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/svc.conf b/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/svc.conf
index 5e29db8c817..c340a388883 100644
--- a/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/svc.conf
+++ b/TAO/orbsvcs/examples/RtEC/ECConfigurator/chain_test/svc.conf
@@ -1,3 +1,3 @@
# $Id$
#change SCHED_OTHER to SCHED_FIFO or SCHED_RR to run in Real time class
-static EC_Factory "-ECProxyPushConsumerCollection mt:immediate:list -ECProxyPushSupplierCollection mt:immediate:list -ECdispatching kokyu SCHED_OTHER -ECscheduling kokyu -ECfiltering kokyu -ECproxyconsumerlock thread -ECproxysupplierlock thread -ECsupplierfiltering per-supplier -ECobserver basic"
+static EC_Factory "-ECProxyPushConsumerCollection mt:immediate:list -ECProxyPushSupplierCollection mt:immediate:list -ECdispatching kokyu SCHED_OTHER -ECscheduling kokyu -ECfiltering kokyu -ECproxyconsumerlock thread -ECproxysupplierlock thread -ECsupplierfiltering per-supplier -ECObserver basic"