summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/RTCorba
diff options
context:
space:
mode:
authormarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-12-02 05:22:19 +0000
committermarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-12-02 05:22:19 +0000
commit638fda427fb24a21fa8d31fc52645196e936f0b8 (patch)
tree9d9e1a0ad16cb40d796f549d5f31eb52a2e5cd8d /TAO/performance-tests/RTCorba
parent3f3d0e843cdb11ea7f4b3802b64ac80bcfcd466a (diff)
downloadATCD-638fda427fb24a21fa8d31fc52645196e936f0b8.tar.gz
ChangeLogTag:Wed Dec 1 23:05:19 1999 Marina Spivak <marina@cs.wustl.edu>
Diffstat (limited to 'TAO/performance-tests/RTCorba')
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/Makefile59
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/README43
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/client.conf4
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/client.cpp342
-rwxr-xr-xTAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/run-test.pl59
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/server.conf3
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/server.cpp142
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Makefile50
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/Makefile59
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/README48
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/client.conf4
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/client.cpp308
-rwxr-xr-xTAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/run-test.pl64
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/server.conf3
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/server.cpp263
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/Makefile59
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/README35
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/client.conf4
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/client.cpp304
-rwxr-xr-xTAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/run-test.pl55
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/server.conf3
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/server.cpp125
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/test.idl10
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.cpp37
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.h47
-rw-r--r--TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.i6
26 files changed, 2136 insertions, 0 deletions
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/Makefile b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/Makefile
new file mode 100644
index 00000000000..3295ad96ddc
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/Makefile
@@ -0,0 +1,59 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+ifndef TAO_ROOT
+ TAO_ROOT = $(ACE_ROOT)/TAO
+endif # ! TAO_ROOT
+
+LDLIBS = -lTAO
+
+BIN = server client
+
+CLIENT_OBJS = client.o \
+ testC.o
+SERVER_OBJS = server.o \
+ test_i.o \
+ testC.o \
+ testS.o
+
+vpath test% ..
+
+BUILD = $(BIN)
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+VBIN = $(BIN:%=%$(VAR))
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(TAO_ROOT)/rules.tao.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+include $(TAO_ROOT)/taoconfig.mk
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+server: $(addprefix $(VDIR),$(SERVER_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+client: $(addprefix $(VDIR),$(CLIENT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+realclean: clean
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/README b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/README
new file mode 100644
index 00000000000..a971ac7340c
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/README
@@ -0,0 +1,43 @@
+// $Id$
+
+This directory contains programs for measuring performance with
+the endpoint per priority scenario (described below).
+
+Server establishes several endpoints (see -ORBEndPoint option), each
+with a different priority (i.e., serviced by threads with different
+priorities), creates a Test object and exports its ior. Client runs
+the specified number of threads at specified priorities (see command
+line arguments description below), with each thread invoking
+operations on the ior exported by the server. However, because the
+ClientPriorityPolicy is set in the client, the ORB picks which server
+endpoint should be used based on the priority of the invoking thread,
+i.e., it picks a server endpoint which has the same priority as the
+invoking thread. (We try to preserve the priority of the requests n
+to n).
+
+See run-test.pl for a sample run. (Perl script starts a server, and
+then runs a client with 5 low-priority threads and one high-priority thread).
+
+Command Line Arguments
+**********************
+
+server
+
+-o <ior_output_file> Name of the file where to store IOR of the server.
+
+-n <number of threads> Number of threads, which will be servicing
+ endpoint and connections for each priority.
+
+client
+
+-i <ior> IOR of the object to use for invocations.
+
+-n <number of iterations> Number of invocations each thread must
+ perform on the object.
+
+-p <period> Period with which invocations should be made.
+
+-t <corba_priority> Specify a corba priority of a a client
+ thread to run. This option can be used
+ multiple times in order to specify the
+ number of threads in the client and their priorities.
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/client.conf b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/client.conf
new file mode 100644
index 00000000000..2c6e1c531d8
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/client.conf
@@ -0,0 +1,4 @@
+# $Id$
+#
+static Resource_Factory "-ORBReactorRegistry per-priority -ORBSchedPolicy SCHED_FIFO -ORBPriorityMapping direct"
+static Client_Strategy_Factory "-ORBclientconnectionhandler RW"
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/client.cpp b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/client.cpp
new file mode 100644
index 00000000000..13877373425
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/client.cpp
@@ -0,0 +1,342 @@
+// $Id$
+
+#include "../testC.h"
+#include "tao/rtcorbafwd.h"
+#include "tao/Priority_Mapping.h"
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+#include "ace/Stats.h"
+#include "ace/High_Res_Timer.h"
+#include "ace/Sched_Params.h"
+
+ACE_RCSID(Latency, client, "$Id$")
+
+class Client : public ACE_Task_Base
+{
+ // = TITLE
+ // Run the client thread
+ //
+ // = DESCRIPTION
+ // Use the ACE_Task_Base class to run the client threads.
+ //
+public:
+ Client (void);
+ // ctor
+
+ void set (Test_ptr server, int niterations, int id, CORBA::ORB_ptr);
+ // Set the test attributes.
+
+ void accumulate_into (ACE_Throughput_Stats &throughput) const;
+ // Accumulate the throughput statistics into <throughput>
+
+ void dump_stats (const char* msg, ACE_UINT32 gsf);
+ // Accumulate the throughput statistics into <throughput>
+
+ // = The ACE_Task_Base methods....
+ virtual int svc (void);
+
+private:
+ CORBA::ORB_ptr orb_;
+
+ Test_var server_;
+ // The server.
+
+ int niterations_;
+ // The number of iterations on each client thread.
+
+ int id_;
+ // The index into array for this thread.
+
+ ACE_Throughput_Stats throughput_;
+ // Keep throughput statistics on a per-thread basis
+};
+
+// ****************************************************************
+
+const char *ior = "file://test.ior";
+int nthreads = 0;
+int niterations = 1000;
+int period = -1;
+const int MAX_THREADS = 128;
+Client client[MAX_THREADS];
+int priorities[MAX_THREADS];
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "i:t:n:p:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'i':
+ ior = get_opts.optarg;
+ break;
+ case 't':
+ if (nthreads < MAX_THREADS)
+ {
+ priorities[nthreads] = ACE_OS::atoi (get_opts.optarg);
+ nthreads++;
+ }
+ break;
+ case 'n':
+ niterations = ACE_OS::atoi (get_opts.optarg);
+ break;
+ case 'p':
+ period = ACE_OS::atoi (get_opts.optarg);
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-i <ior> "
+ "-t <priority> "
+ "-n <niterations> "
+ "-p <period> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int policy = ACE_SCHED_FIFO;
+ int flags = THR_SCHED_FIFO|THR_NEW_LWP|THR_JOINABLE;
+ int priority =
+ ACE_Sched_Params::priority_max (policy);
+
+ // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+ if (ACE_OS::sched_params (ACE_Sched_Params (policy,
+ priority,
+ ACE_SCOPE_PROCESS)) != 0)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "server (%P|%t): user is not superuser, "
+ "test runs in time-shared class\n"));
+ policy = ACE_SCHED_OTHER;
+ flags = THR_NEW_LWP|THR_JOINABLE;
+ }
+ else
+ ACE_ERROR ((LM_ERROR,
+ "server (%P|%t): sched_params failed\n"));
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
+
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var object =
+ orb->string_to_object (ior, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ Test_var server =
+ Test::_narrow (object.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (server.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Object reference <%s> is nil\n",
+ ior),
+ 1);
+ }
+
+ RTCORBA::PriorityMapping *pm =
+ orb->orb_core ()->priority_mapping ();
+ for (int i = 0; i != nthreads; ++i)
+ {
+ client[i].set (server.in (), niterations, i, orb.in ());
+
+ CORBA::Short native_priority = 0;
+ pm->to_native (priorities[i], native_priority);
+
+ if (client[i].activate (flags,
+ 1, 1,
+ native_priority) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot activate client threads\n"),
+ 1);
+ }
+
+ ACE_Thread_Manager::instance ()->wait ();
+
+ ACE_DEBUG ((LM_DEBUG, "threads finished\n"));
+
+ ACE_Throughput_Stats throughput;
+
+ for (int j = 0; j != nthreads; ++j)
+ {
+ client[j].accumulate_into (throughput);
+
+ char buf[64];
+ ACE_OS::sprintf (buf, "Thread(index= %d)", j);
+ client[j].dump_stats (buf, gsf);
+ }
+ throughput.dump_results ("Aggregated", gsf);
+
+ server->shutdown ("", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Catched exception:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+// ****************************************************************
+
+Client::Client (void)
+{
+}
+
+void
+Client::set (Test_ptr server,
+ int niterations,
+ int id,
+ CORBA::ORB_ptr orb)
+{
+ this->server_ = Test::_duplicate (server);
+ this->niterations_ = niterations;
+ this->id_ = id;
+ orb_ = orb;
+}
+
+int
+Client::svc (void)
+{
+ ACE_hthread_t current;
+ ACE_Thread::self (current);
+ int native_priority;
+ ACE_Thread::getprio (current, native_priority);
+ ACE_DEBUG ((LM_DEBUG,
+ "Thead (%t): index = %d corba_priority = %d"
+ " actual native priority = %d\n",
+ this->id_,
+ priorities[this->id_],
+ native_priority));
+
+
+ ACE_TRY_NEW_ENV
+ {
+ // Set the Client Priority Policy for invocations.
+
+ // Obtain PolicyCurrent.
+ CORBA::Object_var policy_current_object =
+ orb_->resolve_initial_references ("PolicyCurrent");
+
+ CORBA::PolicyCurrent_var policy_current =
+ CORBA::PolicyCurrent::_narrow (policy_current_object.in (),
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (policy_current.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to get PolicyCurrent.\n"),
+ -1);
+
+ // Create Client Priority Policy with mode==USE_THREAD_PRIORITY.
+ TAO::PrioritySpecification ps;
+ ps.mode = TAO::USE_THREAD_PRIORITY;
+ CORBA::Any value;
+ value <<= ps;
+ CORBA::Policy_var policy =
+ orb_->create_policy (TAO::CLIENT_PRIORITY_POLICY_TYPE,
+ value,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Set the policy using PolicyCurrent.
+ CORBA::PolicyList policy_list;
+ policy_list.length (1);
+ policy_list[0] = policy;
+
+ policy_current->set_policy_overrides (policy_list,
+ CORBA::ADD_OVERRIDE,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Clean up the resources.
+ policy->destroy (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Try to increase chances of each thread having its own
+ // connection. (Not an issue if all threads have different priorities.)
+ for (int j = 0; j < 100; ++j)
+ {
+ CORBA::PolicyList_var pols;
+ server_->_validate_connection (pols.out (),
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+
+ ACE_hrtime_t throughput_base = ACE_OS::gethrtime ();
+
+ for (int i = 0; i < this->niterations_; ++i)
+ {
+ // Record current time.
+ ACE_hrtime_t latency_base = ACE_OS::gethrtime ();
+
+ // Invoke method.
+ server_->test_method (this->id_,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Grab timestamp again.
+ ACE_hrtime_t now = ACE_OS::gethrtime ();
+
+ if (period != -1)
+ {
+ ACE_Time_Value tv (0, period * 1000);
+ ACE_OS::sleep (tv);
+ }
+
+ // Skip the first sample (prime).
+ if (i != 0)
+ {
+ // Record statistics.
+ this->throughput_.sample (now - throughput_base,
+ now - latency_base);
+ }
+ else
+ throughput_base = ACE_OS::gethrtime ();
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Latency: exception raised");
+ }
+ ACE_ENDTRY;
+ return 0;
+}
+
+void
+Client::accumulate_into (ACE_Throughput_Stats &throughput) const
+{
+ throughput.accumulate (this->throughput_);
+}
+
+void
+Client::dump_stats (const char* msg, ACE_UINT32 gsf)
+{
+ this->throughput_.dump_results (msg, gsf);
+}
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/run-test.pl b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/run-test.pl
new file mode 100755
index 00000000000..2d9c60637ab
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/run-test.pl
@@ -0,0 +1,59 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+unshift @INC, '../../../../../bin';
+require ACEutils;
+
+$client_conf="client.conf";
+$server_conf="server.conf";
+$threads='2';
+$iorfile = "test.ior";
+
+print STDERR "================ Endpoint Per Priority Test\n";
+
+unlink $iorfile;
+
+$SV = Process::Create ($EXEPREFIX."server$EXE_EXT ",
+ " -ORBSvcConf server.conf"
+ . " -ORBEndPoint iiop://localhost:0/priority=1 "
+ . " -ORBEndPoint iiop://localhost:0/priority=2 "
+ . " -ORBEndPoint iiop://localhost:0/priority=3 "
+ . " -ORBEndPoint iiop://localhost:0/priority=4 "
+ . " -ORBEndPoint iiop://localhost:0/priority=5 "
+ . " -ORBEndPoint iiop://localhost:0/priority=30 "
+ . " -o $iorfile -n $threads");
+
+if (ACE::waitforfile_timed ($iorfile, 5) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
+ " -ORBSvcConf client.conf "
+ . " -i file://$iorfile "
+ . " -t 1 -t 2 -t 3 -t 4 -t 5 -t 30 -n 1000");
+
+$client = $CL->TimedWait (60);
+if ($client == -1) {
+ print STDERR "ERROR: client timedout\n";
+ $CL->Kill (); $CL->TimedWait (1);
+}
+
+$server = $SV->TimedWait (10);
+if ($server == -1) {
+ print STDERR "ERROR: server timedout\n";
+ $SV->Kill (); $SV->TimedWait (1);
+}
+
+unlink $iorfile;
+
+if ($server != 0 || $client != 0) {
+ exit 1;
+}
+
+exit 0;
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/server.conf b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/server.conf
new file mode 100644
index 00000000000..3154f0eb0c3
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/server.conf
@@ -0,0 +1,3 @@
+# $Id$
+#
+static Resource_Factory "-ORBReactorType tp -ORBReactorRegistry per-priority -ORBSchedPolicy SCHED_FIFO -ORBPriorityMapping direct"
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/server.cpp b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/server.cpp
new file mode 100644
index 00000000000..b0d92f7892d
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Endpoint_Per_Priority/server.cpp
@@ -0,0 +1,142 @@
+// $Id$
+
+#include "../test_i.h"
+#include "tao/Pool_Per_Endpoint.h"
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+#include "ace/Sched_Params.h"
+
+ACE_RCSID(TPP, server, "$Id$")
+
+const char *ior_output_file = "test.ior";
+int nthreads = 1;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "o:n:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.optarg;
+ break;
+
+ case 'n':
+ nthreads = ACE_OS::atoi (get_opts.optarg);
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "-n <number of threads>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int policy = ACE_SCHED_FIFO;
+ int flags = THR_NEW_LWP|THR_JOINABLE|THR_SCHED_FIFO;
+ int priority =
+ ACE_Sched_Params::priority_max (policy);
+
+ // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+ if (ACE_OS::sched_params (ACE_Sched_Params (policy,
+ priority,
+ ACE_SCOPE_PROCESS)) != 0)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "server (%P|%t): user is not superuser, "
+ "test runs in time-shared class\n"));
+ policy = ACE_SCHED_OTHER;
+ flags = THR_NEW_LWP|THR_JOINABLE|THR_SCHED_DEFAULT;
+ }
+ else
+ ACE_ERROR ((LM_ERROR,
+ "server (%P|%t): sched_params failed\n"));
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var poa_object =
+ orb->resolve_initial_references("RootPOA");
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ Test_i server_impl;
+
+ Test_var server =
+ server_impl._this (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::String_var ior =
+ orb->object_to_string (server.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ()));
+
+ // Output the ior to a file.
+ if (ior_output_file != 0)
+ {
+ FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file for writing IOR: %s",
+ ior_output_file),
+ 1);
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+ }
+
+ poa_manager->activate (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ TAO_Pool_Per_Endpoint pool (orb.in (),
+ policy,
+ nthreads,
+ flags);
+
+ pool.run (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "event loop finished\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Catched exception:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Makefile b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Makefile
new file mode 100644
index 00000000000..15964e66ac1
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Makefile
@@ -0,0 +1,50 @@
+#--------------------------------------------------------------------------
+#
+# $Id$
+#
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+ifndef TAO_ROOT
+ TAO_ROOT = $(ACE_ROOT)/TAO
+endif
+
+TAO_IDLFLAGS += -Ge 1
+
+ifdef AMI
+TAO_IDLFLAGS += -GC
+endif # AMI
+
+IDL_SRCS = test
+IDL_FILES = \
+ $(addsuffix S, $(IDL_SRCS)) \
+ $(addsuffix C, $(IDL_SRCS))
+
+BIN = idl_stubs
+
+DIRS = Single_Endpoint \
+ Orb_Per_Priority \
+ Endpoint_Per_Priority
+
+all: all.local all.nested
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(TAO_ROOT)/rules.tao.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nolocal.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+include $(TAO_ROOT)/taoconfig.mk
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+idl_stubs: $(addsuffix .h, $(IDL_FILES))
+
+realclean:
+ -$(RM) $(foreach file, $(IDL_SRCS), $(foreach ext, $(IDL_EXT), $(file)$(ext)))
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/Makefile b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/Makefile
new file mode 100644
index 00000000000..3295ad96ddc
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/Makefile
@@ -0,0 +1,59 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+ifndef TAO_ROOT
+ TAO_ROOT = $(ACE_ROOT)/TAO
+endif # ! TAO_ROOT
+
+LDLIBS = -lTAO
+
+BIN = server client
+
+CLIENT_OBJS = client.o \
+ testC.o
+SERVER_OBJS = server.o \
+ test_i.o \
+ testC.o \
+ testS.o
+
+vpath test% ..
+
+BUILD = $(BIN)
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+VBIN = $(BIN:%=%$(VAR))
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(TAO_ROOT)/rules.tao.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+include $(TAO_ROOT)/taoconfig.mk
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+server: $(addprefix $(VDIR),$(SERVER_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+client: $(addprefix $(VDIR),$(CLIENT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+realclean: clean
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/README b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/README
new file mode 100644
index 00000000000..4fe699a2116
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/README
@@ -0,0 +1,48 @@
+// $Id$
+
+This directory contains programs for measuring performance with
+the orb per priority scenario (described below).
+
+For each corba priority specified on the command line, server spawns a
+thread, in which it creates an ORB, and exports an ior of the object
+registered under the poa of that ORB.
+Client runs the specified number of threads at specified priorities (see command
+line arguments description below), all concurrently invoking
+operations on the server object, but through different IORs. Each
+client thread uses an IOR exported by a server thread (i.e., ORB)
+running at the same corba priority as itself.
+
+See run-test.pl for a sample run. (Perl script starts a server, which
+has 5 low-priority orbs and one high priority orb, and
+then runs a client with 5 low-priority threads and one high-priority thread).
+
+Command Line Arguments
+**********************
+
+server
+
+-o <ior_output_file> Base name of the file where to store IOR of the server.
+
+-t <corba_priority> Specify a corba priority of a server
+ thread to run. This option can be used
+ multiple times in order to specify the
+ number of threads in the server and their
+ priorities. Each thread will have its own
+ ORB and will export its own ior.
+
+client
+
+-i <ior> IOR of the object to use for invocations.
+
+-n <number of iterations> Number of invocations each thread must
+ perform on the object.
+
+-p <period> Period with which invocations should be made.
+
+-t <corba_priority> Specify a corba priority of a a client
+ thread to run. This option can be used
+ multiple times in order to specify the
+ number of threads in the client and their
+ priorities. Each thread will use the ior
+ created by the server ORB of corresponding
+ priority.
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/client.conf b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/client.conf
new file mode 100644
index 00000000000..d7c92eab9e2
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/client.conf
@@ -0,0 +1,4 @@
+# $Id$
+#
+static Resource_Factory "-ORBSchedPolicy SCHED_FIFO -ORBPriorityMapping direct"
+static Client_Strategy_Factory "-ORBclientconnectionhandler RW"
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/client.cpp b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/client.cpp
new file mode 100644
index 00000000000..7530bbaf58c
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/client.cpp
@@ -0,0 +1,308 @@
+// $Id$
+
+#include "../testC.h"
+#include "tao/rtcorbafwd.h"
+#include "tao/Priority_Mapping.h"
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+#include "ace/Stats.h"
+#include "ace/High_Res_Timer.h"
+#include "ace/Sched_Params.h"
+
+ACE_RCSID(Latency, client, "$Id$")
+
+class Client : public ACE_Task_Base
+{
+ // = TITLE
+ // Run the client thread
+ //
+ // = DESCRIPTION
+ // Use the ACE_Task_Base class to run the client threads.
+ //
+public:
+ Client (void);
+ // ctor
+
+ void set (int niterations, int id, CORBA::ORB_ptr);
+ // Set the test attributes.
+
+ void accumulate_into (ACE_Throughput_Stats &throughput) const;
+ // Accumulate the throughput statistics into <throughput>
+
+ void dump_stats (const char* msg, ACE_UINT32 gsf);
+ // Accumulate the throughput statistics into <throughput>
+
+ // = The ACE_Task_Base methods....
+ virtual int svc (void);
+
+private:
+ CORBA::ORB_ptr orb_;
+
+ Test_var server_;
+ // The server.
+
+ int niterations_;
+ // The number of iterations on each client thread.
+
+ int id_;
+ // The application ID for this thread...
+
+ ACE_Throughput_Stats throughput_;
+ // Keep throughput statistics on a per-thread basis
+};
+
+// ****************************************************************
+
+const char *ior_base = "file://test.ior";
+int nthreads = 0;
+int niterations = 1000;
+int period = -1;
+const int MAX_THREADS = 128;
+Client client[MAX_THREADS];
+int priorities[MAX_THREADS];
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "i:t:n:p:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'i':
+ ior_base = get_opts.optarg;
+ break;
+ case 't':
+ if (nthreads < MAX_THREADS)
+ {
+ priorities[nthreads] = ACE_OS::atoi (get_opts.optarg);
+ nthreads++;
+ }
+ break;
+ case 'n':
+ niterations = ACE_OS::atoi (get_opts.optarg);
+ break;
+ case 'p':
+ period = ACE_OS::atoi (get_opts.optarg);
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-i <ior> "
+ "-t <priority> "
+ "-n <niterations> "
+ "-p <period> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int policy = ACE_SCHED_FIFO;
+ int flags = THR_SCHED_FIFO|THR_NEW_LWP|THR_JOINABLE;
+ int priority =
+ ACE_Sched_Params::priority_min (policy);
+
+ // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+ if (ACE_OS::sched_params (ACE_Sched_Params (policy,
+ priority,
+ ACE_SCOPE_PROCESS)) != 0)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "client (%P|%t): user is not superuser, "
+ "test runs in time-shared class\n"));
+ policy = ACE_SCHED_OTHER;
+ flags = THR_NEW_LWP|THR_JOINABLE;
+ }
+ else
+ ACE_ERROR ((LM_ERROR,
+ "server (%P|%t): sched_params failed\n"));
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
+
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ RTCORBA::PriorityMapping *pm =
+ orb->orb_core ()->priority_mapping ();
+
+ for (int i = 0; i != nthreads; ++i)
+ {
+ client[i].set (niterations, i, orb.in ());
+
+ CORBA::Short native_priority = 0;
+ pm->to_native (priorities[i], native_priority);
+
+ if (client[i].activate (flags,
+ 1, 1,
+ native_priority) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot activate client threads\n"),
+ 1);
+ }
+
+ ACE_Thread_Manager::instance ()->wait ();
+
+ ACE_DEBUG ((LM_DEBUG, "threads finished\n"));
+
+ ACE_Throughput_Stats throughput;
+
+ for (int j = 0; j != nthreads; ++j)
+ {
+ client[j].accumulate_into (throughput);
+
+ char buf[64];
+ ACE_OS::sprintf (buf, "Thread[index= %d]", j);
+ client[j].dump_stats (buf, gsf);
+ }
+
+ throughput.dump_results ("Aggregated", gsf);
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Catched exception in Orb per priority client:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+// ****************************************************************
+
+Client::Client (void)
+{
+}
+
+void
+Client::set (int niterations,
+ int id,
+ CORBA::ORB_ptr orb)
+{
+ this->niterations_ = niterations;
+ this->id_ = id;
+ orb_ = orb;
+}
+
+int
+Client::svc (void)
+{
+ ACE_hthread_t current;
+ ACE_Thread::self (current);
+ int native_priority;
+ ACE_Thread::getprio (current, native_priority);
+ ACE_DEBUG ((LM_DEBUG,
+ "Thread (%t): index = %d corba_priority = %d"
+ " actual native priority = %d\n",
+ this->id_,
+ priorities[this->id_],
+ native_priority));
+
+ ACE_TRY_NEW_ENV
+ {
+ char ior[100];
+ ACE_OS::sprintf (ior,
+ "%s_%d",
+ ior_base,
+ priorities[this->id_]);
+
+ CORBA::Object_var object =
+ orb_->string_to_object (ior, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ Test_var server =
+ Test::_narrow (object.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (server.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Object reference <%s> is nil\n",
+ ior),
+ 1);
+ }
+
+ // Try to make sure every thread gets its own connection.
+ for (int j = 0; j < 100; ++j)
+ {
+ CORBA::PolicyList_var pols;
+ server->_validate_connection (pols.out (),
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+
+ ACE_hrtime_t throughput_base = ACE_OS::gethrtime ();
+
+ for (int i = 0; i < this->niterations_; ++i)
+ {
+ // Record current time.
+ ACE_hrtime_t latency_base = ACE_OS::gethrtime ();
+
+ // Invoke method.
+ server->test_method (this->id_,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Grab timestamp again.
+ ACE_hrtime_t now = ACE_OS::gethrtime ();
+
+ if (period != -1)
+ {
+ ACE_Time_Value tv (0, period * 1000);
+ ACE_OS::sleep (tv);
+ }
+
+ // Skip the first sample (prime).
+ if (i != 0)
+ {
+ // Record statistics.
+ this->throughput_.sample (now - throughput_base,
+ now - latency_base);
+ }
+ else
+ throughput_base = ACE_OS::gethrtime ();
+ }
+
+ char orb_name[50];
+ ACE_OS::sprintf (orb_name, "%d", priorities[this->id_]);
+ server->shutdown (orb_name, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Orb per priority client: exception raised");
+ }
+ ACE_ENDTRY;
+ return 0;
+}
+
+void
+Client::accumulate_into (ACE_Throughput_Stats &throughput) const
+{
+ throughput.accumulate (this->throughput_);
+}
+
+void
+Client::dump_stats (const char* msg, ACE_UINT32 gsf)
+{
+ this->throughput_.dump_results (msg, gsf);
+}
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/run-test.pl b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/run-test.pl
new file mode 100755
index 00000000000..560ee536ca2
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/run-test.pl
@@ -0,0 +1,64 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+unshift @INC, '../../../../../bin';
+require ACEutils;
+
+$client_conf="client.conf";
+$server_conf="server.conf";
+$iorfile = "test.ior";
+
+print STDERR "================ ORB Per Priority Test\n";
+
+unlink $iorfile."_1";
+unlink $iorfile."_2";
+unlink $iorfile."_3";
+unlink $iorfile."_4";
+unlink $iorfile."_5";
+unlink $iorfile."_30";
+
+$SV = Process::Create ($EXEPREFIX."server$EXE_EXT ",
+ " -ORBSvcConf server.conf"
+ . " -t 1 -t 2 -t 3 -t 4 -t 5 -t 30 "
+ . " -o $iorfile");
+
+if (ACE::waitforfile_timed ($iorfile."_1", 5) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
+ " -ORBSvcConf client.conf "
+ . " -i file://$iorfile "
+ . " -t 30 -t 5 -t 4 -t 3 -t 2 -t 1 -n 10");
+
+$client = $CL->TimedWait (60);
+if ($client == -1) {
+ print STDERR "ERROR: client timedout\n";
+ $CL->Kill (); $CL->TimedWait (1);
+}
+
+$server = $SV->TimedWait (10);
+if ($server == -1) {
+ print STDERR "ERROR: server timedout\n";
+ $SV->Kill (); $SV->TimedWait (1);
+}
+
+unlink $iorfile."_1";
+unlink $iorfile."_2";
+unlink $iorfile."_3";
+unlink $iorfile."_4";
+unlink $iorfile."_5";
+unlink $iorfile."_30";
+
+
+if ($server != 0 || $client != 0) {
+ exit 1;
+}
+
+exit 0;
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/server.conf b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/server.conf
new file mode 100644
index 00000000000..e9fc4ff96f2
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/server.conf
@@ -0,0 +1,3 @@
+# $Id$
+#
+static Resource_Factory "-ORBSchedPolicy SCHED_FIFO -ORBPriorityMapping direct"
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/server.cpp b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/server.cpp
new file mode 100644
index 00000000000..aeb12f6fdd9
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Orb_Per_Priority/server.cpp
@@ -0,0 +1,263 @@
+// $Id$
+
+#include "../test_i.h"
+#include "tao/rtcorbafwd.h"
+#include "tao/Priority_Mapping.h"
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+#include "ace/Sched_Params.h"
+
+ACE_RCSID(TPP, server, "$Id$")
+
+class Server : public ACE_Task_Base
+{
+ // = TITLE
+ // Run the server thread, which will create its own orb.
+ //
+ // = DESCRIPTION
+ // Use the ACE_Task_Base class to run the server threads.
+ //
+public:
+ Server (void);
+ // ctor
+
+ void set (Test_i *server, int priority, int argc, char *argv[]);
+ // Set the test attributes.
+
+ // = The ACE_Task_Base methods....
+ virtual int svc (void);
+
+private:
+ Test_i *server_;
+
+ int priority_;
+ // Corba priority at which this thread is running. (This number is
+ // used for creating the name of the orb.)
+
+ int argc_;
+ char *argv_[20];
+};
+
+// ****************************************************************
+
+int nthreads = 0;
+const int MAX_THREADS = 128;
+Server servers[MAX_THREADS];
+int priorities[MAX_THREADS];
+const char *ior_output_file_base = "test.ior";
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "o:t:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file_base = get_opts.optarg;
+ break;
+ case 't':
+ if (nthreads < MAX_THREADS)
+ {
+ priorities[nthreads] = ACE_OS::atoi (get_opts.optarg);
+ nthreads++;
+ }
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile_base_name> "
+ "-t <priority>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int policy = ACE_SCHED_FIFO;
+ int flags = THR_NEW_LWP|THR_JOINABLE|THR_SCHED_FIFO;
+ int priority =
+ ACE_Sched_Params::priority_max (policy);
+
+ // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+ if (ACE_OS::sched_params (ACE_Sched_Params (policy,
+ priority,
+ ACE_SCOPE_PROCESS)) != 0)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "server (%P|%t): user is not superuser, "
+ "test runs in time-shared class\n"));
+ policy = ACE_SCHED_OTHER;
+ flags = THR_NEW_LWP|THR_JOINABLE|THR_SCHED_DEFAULT;
+ }
+ else
+ ACE_ERROR ((LM_ERROR,
+ "server (%P|%t): sched_params failed\n"));
+ }
+
+ // Create a servant.
+ Test_i server_impl;
+
+ // Create an ORB to obtain Priority Mapping functionality.
+ CORBA::ORB_var orb;
+ ACE_TRY_NEW_ENV
+ {
+ char *argv_[20];
+ int argc_ = argc;
+ for (int i = 0; i < argc; ++i)
+ argv_[i] = argv[i];
+ orb = CORBA::ORB_init (argc_, argv_, "", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Parse the arguments.
+ if (parse_args (argc_, argv_) != 0)
+ return 1;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Catched exception in Orb per priority server:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ RTCORBA::PriorityMapping *pm =
+ orb->orb_core ()->priority_mapping ();
+ for (int i = 0; i != nthreads; ++i)
+ {
+ CORBA::Short native_priority = 0;
+ pm->to_native (priorities[i], native_priority);
+
+ servers[i].set (&server_impl, native_priority, argc, argv);
+
+ if (servers[i].activate (flags,
+ 1, 1,
+ native_priority) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot activate server threads\n"),
+ 1);
+ }
+
+ ACE_Thread_Manager::instance ()->wait ();
+ ACE_DEBUG ((LM_DEBUG, "Threads finished\n"));
+
+ return 0;
+}
+
+// ****************************************************************
+
+Server::Server (void)
+{
+}
+
+void
+Server::set (Test_i *server,
+ int priority,
+ int argc,
+ char *argv[])
+{
+ server_ = server;
+ priority_ = priority;
+ argc_ = argc;
+ for (int i = 0; i < argc; ++i)
+ argv_[i] = argv[i];
+}
+
+int
+Server::svc (void)
+{
+ ACE_hthread_t current;
+ ACE_Thread::self (current);
+
+ int native_priority;
+ ACE_Thread::getprio (current, native_priority);
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Server orb thread (%t): corba_priority = %d"
+ " actual native priority = %d\n",
+ priority_,
+ native_priority));
+
+ ACE_TRY_NEW_ENV
+ {
+ char orb_name[64];
+ ACE_OS::sprintf (orb_name, "%d", this->priority_);
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc_, argv_, orb_name, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var poa_object =
+ orb->resolve_initial_references("RootPOA");
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ PortableServer::ObjectId_var oid =
+ root_poa->activate_object (this->server_, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var obj =
+ root_poa->id_to_reference (oid.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::String_var ior =
+ orb->object_to_string (obj.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ()));
+
+ // Get the file name to store the ior.
+ char file_name[100];
+ ACE_OS::sprintf (file_name,
+ "%s_%d",
+ ior_output_file_base,
+ this->priority_);
+
+ // Output the ior to a file.
+ FILE *output_file= ACE_OS::fopen (file_name, "w");
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file for writing IOR: %s",
+ file_name),
+ 1);
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+
+ // Start orb event loop.
+ poa_manager->activate (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ orb->run (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Event loop finished\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Catched exception in Orb per priority server:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/Makefile b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/Makefile
new file mode 100644
index 00000000000..3295ad96ddc
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/Makefile
@@ -0,0 +1,59 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+ifndef TAO_ROOT
+ TAO_ROOT = $(ACE_ROOT)/TAO
+endif # ! TAO_ROOT
+
+LDLIBS = -lTAO
+
+BIN = server client
+
+CLIENT_OBJS = client.o \
+ testC.o
+SERVER_OBJS = server.o \
+ test_i.o \
+ testC.o \
+ testS.o
+
+vpath test% ..
+
+BUILD = $(BIN)
+VLDLIBS = $(LDLIBS:%=%$(VAR))
+VBIN = $(BIN:%=%$(VAR))
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(TAO_ROOT)/rules.tao.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+include $(TAO_ROOT)/taoconfig.mk
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+server: $(addprefix $(VDIR),$(SERVER_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+client: $(addprefix $(VDIR),$(CLIENT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+realclean: clean
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/README b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/README
new file mode 100644
index 00000000000..df000702a39
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/README
@@ -0,0 +1,35 @@
+// $Id$
+
+This directory contains programs for measuring performance/priority
+inversions for the single server endpoint scenario (described below).
+
+Server, which has a single endpoint,
+creates a Test object and exports its ior. Client runs the specified
+number of threads at specified priorities (see command line arguments
+description below), with the threads concurrently invoking an
+operation on an ior exported by the server.
+
+See run-test.pl for a sample run. (Perl script starts a server, and
+then runs a client with 5 low-priority threads and one high-priority thread).
+
+
+Command Line Arguments
+**********************
+
+server
+
+-o <ior_output_file> Name of the file where to store IOR of the server.
+
+client
+
+-i <ior> IOR of the object to use for invocations.
+
+-n <number of iterations> Number of invocations each thread must
+ perform on the object.
+
+-p <period> Period with which invocations should be made.
+
+-t <corba_priority> Specify a corba priority of a a client
+ thread to run. This option can be used
+ multiple times in order to specify the
+ number of threads in the client and their priorities.
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/client.conf b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/client.conf
new file mode 100644
index 00000000000..d7c92eab9e2
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/client.conf
@@ -0,0 +1,4 @@
+# $Id$
+#
+static Resource_Factory "-ORBSchedPolicy SCHED_FIFO -ORBPriorityMapping direct"
+static Client_Strategy_Factory "-ORBclientconnectionhandler RW"
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/client.cpp b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/client.cpp
new file mode 100644
index 00000000000..56cbb825c04
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/client.cpp
@@ -0,0 +1,304 @@
+// $Id$
+
+#include "../testC.h"
+#include "tao/rtcorbafwd.h"
+#include "tao/Priority_Mapping.h"
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+#include "ace/Stats.h"
+#include "ace/High_Res_Timer.h"
+#include "ace/Sched_Params.h"
+
+ACE_RCSID(Latency, client, "$Id$")
+
+class Client : public ACE_Task_Base
+{
+ // = TITLE
+ // Run the client thread
+ //
+ // = DESCRIPTION
+ // Use the ACE_Task_Base class to run the client threads.
+ //
+public:
+ Client (void);
+ // ctor
+
+ void set (Test_ptr server, int niterations, int id, CORBA::ORB_ptr);
+ // Set the test attributes.
+
+ void accumulate_into (ACE_Throughput_Stats &throughput) const;
+ // Accumulate the throughput statistics into <throughput>
+
+ void dump_stats (const char* msg, ACE_UINT32 gsf);
+ // Output the accumulated statistics.
+
+ // = The ACE_Task_Base methods....
+ virtual int svc (void);
+
+private:
+ CORBA::ORB_ptr orb_;
+
+ Test_var server_;
+ // The server.
+
+ int niterations_;
+ // The number of iterations on each client thread.
+
+ int id_;
+ // The index into array for this thread.
+
+ ACE_Throughput_Stats throughput_;
+ // Keep throughput statistics on a per-thread basis
+};
+
+// ****************************************************************
+
+const char *ior = "file://test.ior";
+int nthreads = 0;
+int niterations = 1000;
+int period = -1;
+const int MAX_THREADS = 128;
+Client client[MAX_THREADS];
+int priorities[MAX_THREADS];
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "i:t:n:p:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'i':
+ ior = get_opts.optarg;
+ break;
+ case 't':
+ if (nthreads < MAX_THREADS)
+ {
+ priorities[nthreads] = ACE_OS::atoi (get_opts.optarg);
+ nthreads++;
+ }
+ break;
+ case 'n':
+ niterations = ACE_OS::atoi (get_opts.optarg);
+ break;
+ case 'p':
+ period = ACE_OS::atoi (get_opts.optarg);
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-i <ior> "
+ "-t <priority> "
+ "-n <niterations> "
+ "-p <period>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int policy = ACE_SCHED_FIFO;
+ int flags = THR_SCHED_FIFO|THR_NEW_LWP|THR_JOINABLE;
+ int priority =
+ ACE_Sched_Params::priority_min (policy);
+
+ // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+ if (ACE_OS::sched_params (ACE_Sched_Params (policy,
+ priority,
+ ACE_SCOPE_PROCESS)) != 0)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "client (%P|%t): user is not superuser, "
+ "test runs in time-shared class\n"));
+ policy = ACE_SCHED_OTHER;
+ flags = THR_NEW_LWP|THR_JOINABLE;
+ }
+ else
+ ACE_ERROR ((LM_ERROR,
+ "server (%P|%t): sched_params failed\n"));
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
+
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var object =
+ orb->string_to_object (ior, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ Test_var server =
+ Test::_narrow (object.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (server.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Object reference <%s> is nil\n",
+ ior),
+ 1);
+ }
+
+ RTCORBA::PriorityMapping *pm =
+ orb->orb_core ()->priority_mapping ();
+ for (int i = 0; i != nthreads; ++i)
+ {
+ client[i].set (server.in (), niterations, i, orb.in ());
+
+ CORBA::Short native_priority = 0;
+ pm->to_native (priorities[i], native_priority);
+
+ if (client[i].activate (flags,
+ 1, 1,
+ native_priority) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot activate client threads\n"),
+ 1);
+ }
+
+ ACE_Thread_Manager::instance ()->wait ();
+
+ ACE_DEBUG ((LM_DEBUG, "Threads finished\n"));
+
+ ACE_Throughput_Stats throughput;
+
+ for (int j = 0; j != nthreads; ++j)
+ {
+ client[j].accumulate_into (throughput);
+
+ char buf[64];
+ ACE_OS::sprintf (buf, "Thread (index= %d)", j);
+ client[j].dump_stats (buf, gsf);
+ }
+ throughput.dump_results ("Aggregated", gsf);
+
+ server->shutdown ("", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Catched exception:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+// ****************************************************************
+
+Client::Client (void)
+{
+}
+
+void
+Client::set (Test_ptr server,
+ int niterations,
+ int id,
+ CORBA::ORB_ptr orb)
+{
+ this->server_ = Test::_duplicate (server);
+ this->niterations_ = niterations;
+ this->id_ = id;
+ orb_ = orb;
+}
+
+int
+Client::svc (void)
+{
+ ACE_hthread_t current;
+ ACE_Thread::self (current);
+
+ int native_priority;
+ ACE_Thread::getprio (current, native_priority);
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Thread (%t): index = %d corba_priority = %d"
+ " actual native priority = %d\n",
+ this->id_,
+ priorities[this->id_],
+ native_priority));
+
+ ACE_TRY_NEW_ENV
+ {
+ // Try to make sure every thread gets its own connection.
+ for (int j = 0; j < 100; ++j)
+ {
+ CORBA::PolicyList_var pols;
+ server_->_validate_connection (pols.out (),
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "Validated connection\n"));
+
+ ACE_hrtime_t throughput_base = ACE_OS::gethrtime ();
+
+ for (int i = 0; i < this->niterations_; ++i)
+ {
+ // Record current time.
+ ACE_hrtime_t latency_base = ACE_OS::gethrtime ();
+
+ // Invoke method.
+ server_->test_method (this->id_,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Grab timestamp again.
+ ACE_hrtime_t now = ACE_OS::gethrtime ();
+
+ if (period != -1)
+ {
+ ACE_Time_Value tv (0, period * 1000);
+ ACE_OS::sleep (tv);
+ }
+
+ // Skip the first sample (prime).
+ if (i != 0)
+ {
+ // Record statistics.
+ this->throughput_.sample (now - throughput_base,
+ now - latency_base);
+ }
+ else
+ throughput_base = ACE_OS::gethrtime ();
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Single_Endpoint::client: exception raised");
+ }
+ ACE_ENDTRY;
+ return 0;
+}
+
+void
+Client::accumulate_into (ACE_Throughput_Stats &throughput) const
+{
+ throughput.accumulate (this->throughput_);
+}
+
+void
+Client::dump_stats (const char* msg, ACE_UINT32 gsf)
+{
+ this->throughput_.dump_results (msg, gsf);
+}
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/run-test.pl b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/run-test.pl
new file mode 100755
index 00000000000..9570a5234c7
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/run-test.pl
@@ -0,0 +1,55 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+unshift @INC, '../../../../../bin';
+require ACEutils;
+
+$client_conf="client.conf";
+$server_conf="server.conf";
+$iorfile="test.ior";
+
+print STDERR "================ Single Endpoint Test\n";
+
+unlink $iorfile;
+
+$SV = Process::Create ($EXEPREFIX."server$EXE_EXT ",
+ " -ORBSvcConf server.conf"
+ . " -o $iorfile");
+
+if (ACE::waitforfile_timed ($iorfile, 5) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+# Run client with 5 threads of low priority and 1 thread of high priority.
+
+$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
+ " -ORBSvcConf client.conf "
+ . " -i file://$iorfile "
+ . " -n 1000 "
+ . " -t 1 -t 2 -t 3 -t 4 -t 5 -t 30");
+
+$client = $CL->TimedWait (60);
+if ($client == -1) {
+ print STDERR "ERROR: client timedout\n";
+ $CL->Kill (); $CL->TimedWait (1);
+}
+
+$server = $SV->TimedWait (10);
+if ($server == -1) {
+ print STDERR "ERROR: server timedout\n";
+ $SV->Kill (); $SV->TimedWait (1);
+}
+
+unlink $iorfile;
+
+if ($server != 0 || $client != 0) {
+ exit 1;
+}
+
+exit 0;
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/server.conf b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/server.conf
new file mode 100644
index 00000000000..a4cf0019c57
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/server.conf
@@ -0,0 +1,3 @@
+# $Id$
+#
+static Server_Strategy_Factory "-ORBConcurrency thread-per-connection" \ No newline at end of file
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/server.cpp b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/server.cpp
new file mode 100644
index 00000000000..21153471d6b
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/Single_Endpoint/server.cpp
@@ -0,0 +1,125 @@
+// $Id$
+
+#include "../test_i.h"
+#include "ace/Get_Opt.h"
+#include "ace/Sched_Params.h"
+
+const char *ior_output_file = "test.ior";
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "o:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.optarg;
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int policy = ACE_SCHED_FIFO;
+ int priority =
+ (ACE_Sched_Params::priority_max (policy));
+
+ // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+ if (ACE_OS::sched_params (ACE_Sched_Params (policy,
+ priority,
+ ACE_SCOPE_PROCESS)) != 0)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "server (%P|%t): user is not superuser, "
+ "test runs in time-shared class\n"));
+ policy = ACE_SCHED_OTHER;
+ }
+ else
+ ACE_ERROR ((LM_ERROR,
+ "server (%P|%t): sched_params failed\n"));
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var poa_object =
+ orb->resolve_initial_references("RootPOA");
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ Test_i server_impl;
+
+ Test_var server =
+ server_impl._this (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::String_var ior =
+ orb->object_to_string (server.in (), ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ()));
+
+ // If the ior_output_file exists, output the ior to it
+ if (ior_output_file != 0)
+ {
+ FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file for writing IOR: %s",
+ ior_output_file),
+ 1);
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+ }
+
+ poa_manager->activate (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ orb->run (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "event loop finished\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Catched exception:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/test.idl b/TAO/performance-tests/RTCorba/Multiple_Endpoints/test.idl
new file mode 100644
index 00000000000..5f1fb02aaa8
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/test.idl
@@ -0,0 +1,10 @@
+//
+// $Id$
+//
+
+interface Test
+{
+ void test_method (in long id);
+
+ void shutdown (in string orb_id);
+};
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.cpp b/TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.cpp
new file mode 100644
index 00000000000..21e7d38a3b5
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.cpp
@@ -0,0 +1,37 @@
+// $Id$
+
+#include "test_i.h"
+#include "tao/debug.h"
+#include "ace/ACE.h"
+
+#if !defined(__ACE_INLINE__)
+#include "test_i.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(Latency, test_i, "$Id$")
+
+void
+Test_i::test_method (CORBA::Long id,
+ CORBA::Environment&) ACE_THROW_SPEC (())
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "Receiving request from thread <%d> in <%t>\n",
+ id));
+}
+
+void
+Test_i::shutdown (const char *orb_id,
+ CORBA::Environment& ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ int argc = 0;
+ CORBA::ORB_var orb = CORBA::ORB_init (argc,
+ 0,
+ orb_id,
+ ACE_TRY_ENV);
+ ACE_CHECK;
+
+ orb->shutdown (0, ACE_TRY_ENV);
+ ACE_CHECK;
+}
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.h b/TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.h
new file mode 100644
index 00000000000..525d67d8edc
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.h
@@ -0,0 +1,47 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/TPP
+//
+// = FILENAME
+// test_i.h
+//
+// = AUTHOR
+// Carlos O'Ryan
+//
+// ============================================================================
+
+#ifndef TAO_TPP_TEST_I_H
+#define TAO_TPP_TEST_I_H
+
+#include "testS.h"
+
+class Test_i : public POA_Test
+{
+ // = TITLE
+ // An implementation for the Test interface
+ //
+ // = DESCRIPTION
+ // Implements the Test interface in test.idl
+ //
+public:
+ Test_i (void);
+ // ctor
+
+ // = The Test methods.
+ void test_method (CORBA::Long id,
+ CORBA::Environment&)
+ ACE_THROW_SPEC (());
+
+ void shutdown (const char *orb_id,
+ CORBA::Environment&)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+};
+
+#if defined(__ACE_INLINE__)
+#include "test_i.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_LATENCY_TEST_I_H */
diff --git a/TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.i b/TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.i
new file mode 100644
index 00000000000..673f315b7ca
--- /dev/null
+++ b/TAO/performance-tests/RTCorba/Multiple_Endpoints/test_i.i
@@ -0,0 +1,6 @@
+// $Id$
+
+ACE_INLINE
+Test_i::Test_i (void)
+{
+}