diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-22 21:01:22 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-22 21:01:22 +0000 |
commit | 028dd27bce0e70a924c1087daa09bd27cecda125 (patch) | |
tree | fea2a7dcad8a1b2f710ddb17c9a6a557283d91f9 /TAO/orbsvcs/tests | |
parent | 350b7796166cacde4bf848bace3db5208978817b (diff) | |
download | ATCD-028dd27bce0e70a924c1087daa09bd27cecda125.tar.gz |
ChangeLogTag:Wed Apr 22 15:56:58 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/orbsvcs/tests')
-rw-r--r-- | TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp | 73 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h | 8 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/EC_Multiple/gen_data | 28 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/EC_Multiple/latency.pl | 65 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/EC_Multiple/svc.conf | 49 |
5 files changed, 213 insertions, 10 deletions
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" |