summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/ChangeLog-98c23
-rw-r--r--TAO/orbsvcs/Scheduling_Service/Scheduling_Service.cpp37
-rw-r--r--TAO/orbsvcs/orbsvcs/Scheduler_Factory.cpp43
-rw-r--r--TAO/orbsvcs/orbsvcs/Scheduler_Factory.h7
-rw-r--r--TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp73
-rw-r--r--TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h8
-rwxr-xr-xTAO/orbsvcs/tests/EC_Multiple/gen_data28
-rwxr-xr-xTAO/orbsvcs/tests/EC_Multiple/latency.pl65
-rw-r--r--TAO/orbsvcs/tests/EC_Multiple/svc.conf49
9 files changed, 283 insertions, 50 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 9ebcdb2e76e..b28101faa37 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,26 @@
+Wed Apr 22 15:56:58 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * orbsvcs/tests/EC_Multiple/EC_Multiple.h:
+ * orbsvcs/tests/EC_Multiple/EC_Multiple.cpp:
+ The test also has a collocated scheduling service now.
+
+ * orbsvcs/tests/EC_Multiple/svc.conf:
+ Added a missing svc.conf file.
+
+ * orbsvcs/Scheduling_Service/Scheduling_Service.cpp:
+ The -n option can be used to specify the scheduling service name.
+
+ * orbsvcs/orbsvcs/Scheduler_Factory.h:
+ * orbsvcs/orbsvcs/Scheduler_Factory.cpp:
+ We can find scheduling services with different names now.
+ Removed all method that used resolve_initial_references() to
+ find the scheduling service; this was needed before the naming
+ service was working.
+
+ * orbsvcs/tests/EC_Multiple/latency.pl:
+ * orbsvcs/tests/EC_Multiple/gen_data:
+ Simple scripts to process the data obtained in the experiments.
+
Mon Apr 20 16:46:07 1998 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu>
* TAO_IDL/be/be_visitor_interface.cpp: An ACE_NESTED_CLASS was
diff --git a/TAO/orbsvcs/Scheduling_Service/Scheduling_Service.cpp b/TAO/orbsvcs/Scheduling_Service/Scheduling_Service.cpp
index 1bc1b03710b..085c4385c42 100644
--- a/TAO/orbsvcs/Scheduling_Service/Scheduling_Service.cpp
+++ b/TAO/orbsvcs/Scheduling_Service/Scheduling_Service.cpp
@@ -2,20 +2,53 @@
// $Id$
//
+#include "ace/Get_Opt.h"
#include "tao/corba.h"
#include "orbsvcs/CosNamingC.h"
#include "orbsvcs/Sched/Config_Scheduler.h"
+const char* service_name = "ScheduleService";
+
+int
+parse_args (int argc, char *argv [])
+{
+ ACE_Get_Opt get_opt (argc, argv, "n:");
+ int opt;
+
+ while ((opt = get_opt ()) != EOF)
+ {
+ switch (opt)
+ {
+ case 'n':
+ service_name = get_opt.optarg;
+ break;
+ case '?':
+ default:
+ ACE_DEBUG ((LM_DEBUG,
+ "Usage: %s "
+ "-n service_name "
+ "\n",
+ argv[0]));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
int main (int argc, char *argv[])
{
TAO_TRY
{
// Initialize ORB.
CORBA::ORB_var orb =
- CORBA::ORB_init (argc, argv, "internet", TAO_TRY_ENV);
+ CORBA::ORB_init (argc, argv, "", TAO_TRY_ENV);
TAO_CHECK_ENV;
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
CORBA::Object_var poa_object =
orb->resolve_initial_references("RootPOA");
if (CORBA::is_nil (poa_object.in ()))
@@ -59,7 +92,7 @@ int main (int argc, char *argv[])
// Register the servant with the Naming Context....
CosNaming::Name schedule_name (1);
schedule_name.length (1);
- schedule_name[0].id = CORBA::string_dup ("ScheduleService");
+ schedule_name[0].id = CORBA::string_dup (service_name);
naming_context->bind (schedule_name, scheduler.in (), TAO_TRY_ENV);
TAO_CHECK_ENV;
diff --git a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.cpp b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.cpp
index 66a161b7883..f1194cb7657 100644
--- a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.cpp
+++ b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.cpp
@@ -91,42 +91,13 @@ RtecScheduler::Scheduler_ptr static_server ()
int
ACE_Scheduler_Factory::use_config (CosNaming::NamingContext_ptr naming)
{
- if (server_ != 0 || entry_count != -1)
- {
- // No errors, runtime execution simply takes precedence over
- // config runs.
- return 0;
- }
-
- TAO_TRY
- {
- CosNaming::Name schedule_name (1);
- schedule_name[0].id = CORBA::string_dup ("ScheduleService");
- schedule_name.length (1);
- CORBA::Object_ptr objref =
- naming->resolve (schedule_name, TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- server_ =
- RtecScheduler::Scheduler::_narrow(objref, TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- RtecScheduler::Scheduler::_duplicate (server_);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- server_ = 0;
- ACE_ERROR_RETURN ((LM_ERROR,
- "ACE_Scheduler_Factory::use_context - "
- " exception while resolving server\n"), -1);
- }
- TAO_ENDTRY;
- return 0;
+ return ACE_Scheduler_Factory::use_config (naming,
+ "ScheduleService");
}
int
-ACE_Scheduler_Factory::use_config (CORBA::ORB_ptr orb)
+ACE_Scheduler_Factory::use_config (CosNaming::NamingContext_ptr naming,
+ const char* name)
{
if (server_ != 0 || entry_count != -1)
{
@@ -137,8 +108,11 @@ ACE_Scheduler_Factory::use_config (CORBA::ORB_ptr orb)
TAO_TRY
{
+ CosNaming::Name schedule_name (1);
+ schedule_name[0].id = CORBA::string_dup (name);
+ schedule_name.length (1);
CORBA::Object_ptr objref =
- orb->resolve_initial_references ("ScheduleService");
+ naming->resolve (schedule_name, TAO_TRY_ENV);
TAO_CHECK_ENV;
server_ =
@@ -159,7 +133,6 @@ ACE_Scheduler_Factory::use_config (CORBA::ORB_ptr orb)
return 0;
}
-
RtecScheduler::Scheduler_ptr
ACE_Scheduler_Factory::server (void)
{
diff --git a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h
index 7cf7649295d..879889bd315 100644
--- a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h
+++ b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h
@@ -48,9 +48,10 @@ public:
// Setup the variables needed for a config run, using the
// NamingContext to locate a Scheduler.
- static int use_config (CORBA::ORB_ptr orb);
- // Setup the variable needed for a config run, using an environment
- // variable to locate a Scheduler.
+ static int use_config (CosNaming::NamingContext_ptr naming,
+ const char* name);
+ // Setup the variables needed for a config run, using the
+ // NamingContext to locate a Scheduler.
static int use_runtime (int entry_count,
POD_RT_Info rt_info[]);
diff --git a/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp b/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp
index 132b787cdf6..bb1520478cb 100644
--- a/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp
+++ b/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp
@@ -3,6 +3,7 @@
//
#include "ace/Get_Opt.h"
+#include "ace/Auto_Ptr.h"
#include "tao/Timeprobe.h"
#include "orbsvcs/Event_Utilities.h"
@@ -10,6 +11,7 @@
#include "orbsvcs/Scheduler_Factory.h"
#include "orbsvcs/Time_Utilities.h"
#include "orbsvcs/RtecEventChannelAdminC.h"
+#include "orbsvcs/Sched/Config_Scheduler.h"
#include "orbsvcs/Event/Event_Channel.h"
#include "EC_Multiple.h"
@@ -154,6 +156,10 @@ EC_Proxy::shutdown (CORBA::Environment& _env)
Test_ECP::Test_ECP (void)
: consumer_ (this),
supplier_ (this),
+ rmt_ec_name_ ("EC"),
+ lcl_ec_name_ ("EC"),
+ sched_name_ ("ScheduleService"),
+ dyn_sched_ (0),
event_a_ (0),
event_b_ (0),
event_c_ (0),
@@ -200,7 +206,33 @@ Test_ECP::run (int argc, char* argv[])
CosNaming::NamingContext::_narrow (naming_obj.in (), TAO_TRY_ENV);
TAO_CHECK_ENV;
- ACE_Scheduler_Factory::use_config (naming_context.in ());
+ auto_ptr<ACE_Config_Scheduler> scheduler_impl;
+ if (this->dyn_sched_)
+ {
+ scheduler_impl = new ACE_Config_Scheduler;
+ if (scheduler_impl.get () == 0)
+ return 1;
+
+ RtecScheduler::Scheduler_var scheduler =
+ scheduler_impl->_this (TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ CORBA::String_var str =
+ orb->object_to_string (scheduler.in (), TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ ACE_DEBUG ((LM_DEBUG, "The scheduler IOR is <%s>\n", str.in ()));
+
+ // Register the servant with the Naming Context....
+ CosNaming::Name schedule_name (1);
+ schedule_name.length (1);
+ schedule_name[0].id = CORBA::string_dup (this->sched_name_);
+ naming_context->bind (schedule_name, scheduler.in (), TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+ }
+
+ ACE_Scheduler_Factory::use_config (naming_context.in (),
+ this->sched_name_);
// Register Event_Service with Naming Service.
ACE_EventChannel ec_impl;
@@ -253,11 +285,9 @@ Test_ECP::run (int argc, char* argv[])
ACE_DEBUG ((LM_DEBUG, "connected supplier\n"));
- if (this->connect_consumer (local_ec.in (),
- TAO_TRY_ENV) == -1)
- return 1;
-
- ACE_DEBUG ((LM_DEBUG, "connected consumer\n"));
+ tv.set (5, 0);
+ if (orb->run (&tv) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "orb->run"), 1);
if (this->connect_ecp (local_ec.in (),
remote_ec.in (),
@@ -266,6 +296,16 @@ Test_ECP::run (int argc, char* argv[])
ACE_DEBUG ((LM_DEBUG, "connected proxy\n"));
+ tv.set (5, 0);
+ if (orb->run (&tv) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "orb->run"), 1);
+
+ if (this->connect_consumer (local_ec.in (),
+ TAO_TRY_ENV) == -1)
+ return 1;
+
+ ACE_DEBUG ((LM_DEBUG, "connected consumer\n"));
+
ACE_DEBUG ((LM_DEBUG, "running multiple EC test\n"));
if (orb->run () == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "orb->run"), 1);
@@ -604,8 +644,13 @@ Test_ECP::push (const RtecEventComm::EventSet &events,
ACE_hrtime_t s;
ORBSVCS_Time::TimeT_to_hrtime (s, e.creation_time_);
int nsec = r - s;
- ACE_DEBUG ((LM_DEBUG, "Latency[%d]: %d (from %d)\n",
- this->supplier_id_, nsec, e.source_));
+ if (this->supplier_id_ == e.source_)
+ ACE_DEBUG ((LM_DEBUG, "Latency[LOCAL]: %d\n",
+ nsec));
+ else
+ ACE_DEBUG ((LM_DEBUG, "Latency[REMOTE]: %d\n",
+ nsec));
+
}
}
}
@@ -629,7 +674,7 @@ Test_ECP::shutdown (CORBA::Environment& _env)
int
Test_ECP::parse_args (int argc, char *argv [])
{
- ACE_Get_Opt get_opt (argc, argv, "l:r:a:b:c:t:m:");
+ ACE_Get_Opt get_opt (argc, argv, "l:r:s:da:b:c:t:m:");
int opt;
while ((opt = get_opt ()) != EOF)
@@ -642,6 +687,12 @@ Test_ECP::parse_args (int argc, char *argv [])
case 'r':
this->rmt_ec_name_ = get_opt.optarg;
break;
+ case 's':
+ this->sched_name_ = get_opt.optarg;
+ break;
+ case 'd':
+ this->dyn_sched_ = 1;
+ break;
case 'a':
this->event_a_ =
ACE_ES_EVENT_UNDEFINED + ACE_OS::atoi (get_opt.optarg);
@@ -666,6 +717,8 @@ Test_ECP::parse_args (int argc, char *argv [])
"Usage: %s "
"-l local_ec_name "
"-r remote_ec_name "
+ "-d (use local scheduling service) "
+ "-s scheduling service name "
"<-a event_type_a> "
"<-b event_type_b> "
"<-c event_type_c> "
@@ -704,9 +757,11 @@ template class ACE_PushConsumer_Adapter<Test_ECP>;
template class ACE_PushSupplier_Adapter<Test_ECP>;
template class ACE_PushConsumer_Adapter<EC_Proxy>;
template class ACE_PushSupplier_Adapter<EC_Proxy>;
+template class auto_ptr<ACE_Config_Scheduler>;
#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_PushConsumer_Adapter<Test_ECP>
#pragma instantiate ACE_PushSupplier_Adapter<Test_ECP>
#pragma instantiate ACE_PushConsumer_Adapter<EC_Proxy>
#pragma instantiate ACE_PushSupplier_Adapter<EC_Proxy>
+#pragma instantiate auto_ptr<ACE_Config_Scheduler>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h b/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h
index de3a58139ef..c0a492803c0 100644
--- a/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h
+++ b/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h
@@ -165,7 +165,13 @@ private:
char* lcl_ec_name_;
// The name of the "local" EC.
-
+
+ char* sched_name_;
+ // The name of the scheduling service.
+
+ int dyn_sched_;
+ // Use a collocated dynamic scheduler.
+
int event_a_;
int event_b_;
int event_c_;
diff --git a/TAO/orbsvcs/tests/EC_Multiple/gen_data b/TAO/orbsvcs/tests/EC_Multiple/gen_data
new file mode 100755
index 00000000000..11617d1d062
--- /dev/null
+++ b/TAO/orbsvcs/tests/EC_Multiple/gen_data
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+./latency.pl -k LOCAL -r 100 EC1.log EC2.log >local.log
+tail +3 local.log | sort -n > local.data
+./latency.pl -k REMOTE -r 1000 EC1.log EC2.log >remote.log
+tail +3 remote.log | sort -n > remote.data
+
+gnuplot <<_EOF_
+set grid xtics ytics
+set terminal pbm color
+set output "local.pbm"
+plot 'local.data' w i
+set terminal x11
+plot 'local.data' w i
+pause 5
+
+set terminal pbm color
+set output "remote.pbm"
+plot 'remote.data' w i
+set terminal x11
+plot 'remote.data' w i
+pause 5
+
+_EOF_
+
diff --git a/TAO/orbsvcs/tests/EC_Multiple/latency.pl b/TAO/orbsvcs/tests/EC_Multiple/latency.pl
new file mode 100755
index 00000000000..d2648e5be51
--- /dev/null
+++ b/TAO/orbsvcs/tests/EC_Multiple/latency.pl
@@ -0,0 +1,65 @@
+#
+# $Id$
+#
+# Extract a histogram, minium, maximum and average for the latency
+# results produced by the test.
+#
+
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# The first three lines above let this script run without specifying the
+# full path to perl, as long as it is in the user's PATH.
+# Taken from perlrun man page.
+
+use Getopt::Std;
+
+$opt_k = 'REMOTE';
+$opt_r = 1000;
+
+getopts ('k:r:');
+
+$max = 0;
+$min = 0;
+$sum = 0;
+$sum2 = 0;
+$n = 0;
+%histo = ();
+
+while (<>) {
+ if (!m/^Latency\[$opt_k\]/) {
+ next;
+ }
+ chop;
+ @f = split(/:/, $_);
+ if ($n == 0) {
+ $min = $f[1];
+ $max = $f[1];
+ $sum = $f[1];
+ $sum2 = $f[1];
+ $n = 1;
+ } else {
+ if ($min > $f[1]) {
+ $min = $f[1];
+ }
+ if ($max < $f[1]) {
+ $max = $f[1];
+ }
+ $sum += $f[1];
+ $sum2 += $f[1] * $f[1];
+ $n++;
+ }
+ $i = int ($f[1] / $opt_r);
+ $histo{"$i"}++;
+}
+
+print "Latency results for $opt_k:\n";
+print "Minimum: $min, Maximum: $max, Average: ", int($sum / $n),
+ " Deviation: ",
+ int(sqrt (($sum2/$n - ($sum/$n)*($sum/$n)))), "\n";
+
+while ( ($key,$value) = each %histo ) {
+ print $key * $opt_r, " $value\n";
+}
+
diff --git a/TAO/orbsvcs/tests/EC_Multiple/svc.conf b/TAO/orbsvcs/tests/EC_Multiple/svc.conf
new file mode 100644
index 00000000000..43c6a486c92
--- /dev/null
+++ b/TAO/orbsvcs/tests/EC_Multiple/svc.conf
@@ -0,0 +1,49 @@
+# $Id$
+#
+# This file contains a sample ACE_Service_Config configuration
+# file specifying the strategy factories utilized by an application
+# using TAO. There are currently only two possible factories:
+# Client_Strategy_Factory and Server_Strategy_Factory. These names
+# must be used as the second argument to their corresponding line,
+# because that's what the ORB uses to find the desired factory.
+#
+# Note that there are two unordinary characteristics of the way *this*
+# file is set up:
+# - both client and server strategies are specified in the same
+# file, which would only make sense for co-located clients & servers
+# - both of the factories are actually sourced out of libTAO.so
+# (TAO.DLL on Win32), and they would normally be in a separate
+# dll from the TAO ORB Core.
+#
+# The options which can be passed to the Resource Factory are:
+#
+# -ORBresources <which>
+# where <which> can be 'global' to specify globally-held resources,
+# or 'tss' to specify thread-specific resources.
+#
+# The options which can be passed to the Client are:
+# <none currently>
+#
+# The options which can be passed to the Server are:
+#
+# -ORBconcurrency <which>
+# where <which> can be 'thread-per-connection' to specify
+# use of the ACE_Threaded_Strategy concurrency strategy,
+# or 'reactive' to specify use of the ACE_Reactive_Strategy
+# concurrency strategy.
+#
+# -ORBthreadflags <flags>
+# specifies the default thread flags to use, where <flags> is a
+# logical OR'ing of the flags THR_DETACHED, THR_BOUND, THR_NEW_LWP,
+# THR_SUSPENDED, or THR_DAEMON. Note that not every flag may be valid
+# on every platform.
+#
+# -ORBdemuxstrategy <which>
+# where <which> can be one of 'dynamic', 'linear', 'active', or 'user',
+# and specifies the type of object lookup strategy used internally.
+# -ORBtablesize <unsigned>
+# specifies the size of the object table
+#
+dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global"
+dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory()
+dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128"