summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-19 01:42:37 +0000
committeralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-19 01:42:37 +0000
commitb552b8f5fe164c9be2e263171ec8f9ed319d1b4f (patch)
tree63ae1d3f2ed5c35fc168a6aff260fc1949e4addc
parentf502ea8561fb06d90da4137149e9718bb6ec0534 (diff)
downloadATCD-b552b8f5fe164c9be2e263171ec8f9ed319d1b4f.tar.gz
ChangeLogTag : Sun Jul 18 20:33:55 1999 Alexander Babu Arulanthu <alex@cs.wustl.edu>
-rw-r--r--TAO/performance-tests/Latency/Makefile8
-rw-r--r--TAO/performance-tests/Latency/ami-latency-client.cpp26
-rw-r--r--TAO/performance-tests/Latency/client-mt-exclusive.conf2
-rw-r--r--TAO/performance-tests/Latency/client-st-exclusive.conf2
-rw-r--r--TAO/performance-tests/Latency/st-client.cpp242
-rw-r--r--TAO/tao/Invocation.cpp12
-rw-r--r--TAO/tao/Pluggable.cpp22
-rw-r--r--TAO/tao/Pluggable.h4
-rw-r--r--TAO/tao/Transport_Mux_Strategy.cpp146
-rw-r--r--TAO/tao/Transport_Mux_Strategy.h14
10 files changed, 385 insertions, 93 deletions
diff --git a/TAO/performance-tests/Latency/Makefile b/TAO/performance-tests/Latency/Makefile
index 8f6ec70c673..319e64b63b7 100644
--- a/TAO/performance-tests/Latency/Makefile
+++ b/TAO/performance-tests/Latency/Makefile
@@ -15,7 +15,7 @@ endif # ! TAO_ROOT
LDLIBS = -lTAO
IDLFILES = testC testS
-BIN = client server
+BIN = client server st-client
ifdef AMI
BIN += ami-latency-client
@@ -24,6 +24,7 @@ endif # AMI
SRC = $(addsuffix .cpp, $(BIN) $(IDLFILES) test_i)
CLIENT_OBJS = client.o testC.o
+ST_CLIENT_OBJS = st-client.o testC.o
SERVER_OBJS = server.o test_i.o $(addsuffix .o, $(IDLFILES))
ifdef AMI
@@ -33,7 +34,7 @@ endif # AMI
BUILD = $(BIN)
VLDLIBS = $(LDLIBS:%=%$(VAR))
VBIN = $(BIN:%=%$(VAR))
-TAO_IDLFLAGS += -Ge 1
+TAO_IDLFLAGS += -Ge 1
ifdef AMI
TAO_IDLFLAGS += -GC
@@ -63,6 +64,9 @@ server: $(addprefix $(VDIR),$(SERVER_OBJS))
client: $(addprefix $(VDIR),$(CLIENT_OBJS))
$(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+st-client: $(addprefix $(VDIR),$(ST_CLIENT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
ifdef AMI
ami-latency-client: $(addprefix $(VDIR),$(AMI_LATENCY_CLIENT_OBJS))
$(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
diff --git a/TAO/performance-tests/Latency/ami-latency-client.cpp b/TAO/performance-tests/Latency/ami-latency-client.cpp
index b98c7fba9c9..5f4ebdc57ba 100644
--- a/TAO/performance-tests/Latency/ami-latency-client.cpp
+++ b/TAO/performance-tests/Latency/ami-latency-client.cpp
@@ -13,6 +13,8 @@ const char *ior = "file://test.ior";
int nthreads = 1;
int niterations = 5;
+int sleep_flag = 1;
+
ACE_hrtime_t latency_base;
ACE_hrtime_t throughput_base;
@@ -22,10 +24,13 @@ ACE_Throughput_Stats throughput_stats;
ACE_Time_Value sleep_time (0, 10000);
+int done = 0;
+
+
int
parse_args (int argc, char *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, "k:n:i:");
+ ACE_Get_Opt get_opts (argc, argv, "k:n:i:s");
int c;
while ((c = get_opts ()) != -1)
@@ -40,6 +45,9 @@ parse_args (int argc, char *argv[])
case 'i':
niterations = ACE_OS::atoi (get_opts.optarg);
break;
+ case 's':
+ sleep_flag = 1;
+ break;
case '?':
default:
ACE_ERROR_RETURN ((LM_ERROR,
@@ -63,13 +71,15 @@ public:
void test_method (CORBA::Environment&)
{
- if (TAO_debug_level >= 0)
+ if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"(%P | %t) : Callback method called\n"));
ACE_hrtime_t now = ACE_OS::gethrtime ();
throughput_stats.sample (now - throughput_base,
now - latency_base);
+
+ done = 1;
};
~Handler (void) {};
@@ -287,13 +297,19 @@ Client::svc (void)
server_->sendc_test_method (this->reply_handler_,
ACE_TRY_ENV);
- // Spend 10 msecs running the ORB.
- this->orb_->run (sleep_time);
-
+ if (sleep_flag)
+ // Spend 10 msecs running the ORB.
+ this->orb_->run (sleep_time);
+ else
+ while (!done)
+ this->orb_->perform_work ();
+
ACE_TRY_CHECK;
if (TAO_debug_level > 0 && i % 100 == 0)
ACE_DEBUG ((LM_DEBUG, "(%P|%t) iteration = %d\n", i));
+
+ done = 0;
}
}
ACE_CATCHANY
diff --git a/TAO/performance-tests/Latency/client-mt-exclusive.conf b/TAO/performance-tests/Latency/client-mt-exclusive.conf
new file mode 100644
index 00000000000..2a75162271c
--- /dev/null
+++ b/TAO/performance-tests/Latency/client-mt-exclusive.conf
@@ -0,0 +1,2 @@
+# $Id$
+static Client_Strategy_Factory "-ORBclientconnectionhandler MT"
diff --git a/TAO/performance-tests/Latency/client-st-exclusive.conf b/TAO/performance-tests/Latency/client-st-exclusive.conf
new file mode 100644
index 00000000000..cd88de887e2
--- /dev/null
+++ b/TAO/performance-tests/Latency/client-st-exclusive.conf
@@ -0,0 +1,2 @@
+# $Id$
+static Client_Strategy_Factory "-ORBclientconnectionhandler ST"
diff --git a/TAO/performance-tests/Latency/st-client.cpp b/TAO/performance-tests/Latency/st-client.cpp
new file mode 100644
index 00000000000..d59e64bef06
--- /dev/null
+++ b/TAO/performance-tests/Latency/st-client.cpp
@@ -0,0 +1,242 @@
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+#include "ace/Stats.h"
+#include "ace/High_Res_Timer.h"
+#include "ace/Sched_Params.h"
+#include "testC.h"
+
+ACE_RCSID(Latency, client, "$Id$")
+
+const char *ior = "file://test.ior";
+int niterations = 5;
+
+int sleep_flag = 0;
+
+ACE_Time_Value sleep_time (0, 10000);
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "k:n:i:s");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.optarg;
+ break;
+ case 'i':
+ niterations = ACE_OS::atoi (get_opts.optarg);
+ break;
+ case 's':
+ sleep_flag = 1;
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "-n <nthreads> "
+ "-i <niterations> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+class Client
+{
+ // = 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);
+ // 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:
+ Test_var server_;
+ // The server.
+
+ int niterations_;
+ // The number of iterations on each client thread.
+
+ ACE_Throughput_Stats throughput_;
+ // Keep throughput statistics on a per-thread basis
+};
+
+int
+main (int argc, char *argv[])
+{
+ int priority =
+ (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO)
+ + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2;
+ // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+
+ if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,
+ 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"));
+ }
+ else
+ ACE_ERROR ((LM_ERROR,
+ "server (%P|%t): sched_params failed\n"));
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ ACE_DEBUG ((LM_DEBUG, "High res. timer calibration...."));
+ ACE_High_Res_Timer::calibrate ();
+ ACE_DEBUG ((LM_DEBUG, "done\n"));
+
+ 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);
+ }
+
+ Client client;
+
+ client.set (server.in (), niterations);
+
+ client.svc ();
+
+ ACE_Throughput_Stats throughput;
+
+ ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
+
+ client.accumulate_into (throughput);
+
+ char buf[64];
+ ACE_OS::sprintf (buf, "Thread[%d]", 1);
+ client.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)
+{
+ this->server_ = Test::_duplicate (server);
+ this->niterations_ = niterations;
+}
+
+int
+Client::svc (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+ // @@ We should use "validate_connection" for this
+ for (int j = 0; j < 100; ++j)
+ {
+ server_->_is_a ("IDL:Test:1.0", 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 (ACE_TRY_ENV);
+
+ // Sleep for 10 msecs.
+ if (sleep_flag)
+ ACE_OS::sleep (sleep_time);
+
+ // Grab timestamp again.
+ ACE_hrtime_t now = ACE_OS::gethrtime ();
+
+ ACE_TRY_CHECK;
+
+ // Record statistics.
+ this->throughput_.sample (now - throughput_base,
+ now - latency_base);
+
+ if (TAO_debug_level > 0 && i % 100 == 0)
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) iteration = %d\n", i));
+ }
+ }
+ 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/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index a0b2cd32232..73e01cdf404 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -393,8 +393,8 @@ TAO_GIOP_Invocation::location_forward (TAO_InputCDR &inp_stream,
TAO_GIOP_Twoway_Invocation::~TAO_GIOP_Twoway_Invocation (void)
{
- if (this->transport_ != 0)
- this->transport_->idle_after_reply ();
+ if (this->transport_ != 0)
+ this->transport_->idle ();
}
void
@@ -774,8 +774,8 @@ TAO_GIOP_Twoway_Invocation::invoke_i (CORBA::Environment &ACE_TRY_ENV)
TAO_GIOP_Oneway_Invocation::~TAO_GIOP_Oneway_Invocation (void)
{
- if (this->transport_ != 0)
- this->transport_->idle_after_reply ();
+ if (this->transport_ != 0)
+ this->transport_->idle ();
}
void
@@ -798,8 +798,8 @@ TAO_GIOP_Oneway_Invocation::start (CORBA::Environment &ACE_TRY_ENV)
TAO_GIOP_Locate_Request_Invocation::~TAO_GIOP_Locate_Request_Invocation (void)
{
- if (this->transport_ != 0)
- this->transport_->idle_after_reply ();
+ if (this->transport_ != 0)
+ this->transport_->idle ();
}
// Send request, block until any reply comes back.
diff --git a/TAO/tao/Pluggable.cpp b/TAO/tao/Pluggable.cpp
index 8ea29d60bb1..5bec9e99c84 100644
--- a/TAO/tao/Pluggable.cpp
+++ b/TAO/tao/Pluggable.cpp
@@ -246,17 +246,17 @@ TAO_Transport::idle_after_send (void)
return this->tms ()->idle_after_send ();
}
-int
-TAO_Transport::idle_after_reply (void)
-{
- return this->tms ()->idle_after_reply ();
-}
-
-int
-TAO_Transport::reply_received (const CORBA::ULong request_id)
-{
- return this->tms ()->reply_received (request_id);
-}
+// int
+// TAO_Transport::idle_after_reply (void)
+// {
+// return this->tms ()->idle_after_reply ();
+// }
+
+// int
+// TAO_Transport::reply_received (const CORBA::ULong request_id)
+// {
+// return this->tms ()->reply_received (request_id);
+// }
ACE_SYNCH_CONDITION *
TAO_Transport::leader_follower_condition_variable (void)
diff --git a/TAO/tao/Pluggable.h b/TAO/tao/Pluggable.h
index 64eb1068dbf..543db14630e 100644
--- a/TAO/tao/Pluggable.h
+++ b/TAO/tao/Pluggable.h
@@ -191,11 +191,11 @@ public:
// Request has been just sent, but the reply is not received. Idle
// the transport now.
- virtual int idle_after_reply (void);
+ // virtual int idle_after_reply (void);
// Request is sent and the reply is received. Idle the transport
// now.
- virtual int reply_received (const CORBA::ULong request_id);
+ // virtual int reply_received (const CORBA::ULong request_id);
// Check with the TMS whether the reply has been receieved for the
// request with <request_id>.
diff --git a/TAO/tao/Transport_Mux_Strategy.cpp b/TAO/tao/Transport_Mux_Strategy.cpp
index 88623d0fdb5..143b15becc0 100644
--- a/TAO/tao/Transport_Mux_Strategy.cpp
+++ b/TAO/tao/Transport_Mux_Strategy.cpp
@@ -95,10 +95,33 @@ TAO_Exclusive_TMS::dispatch_reply (CORBA::ULong request_id,
this->request_id_ = 0xdeadbeef; // @@ What is a good value???
this->rd_ = 0;
- return rd->dispatch_reply (reply_status,
- version,
- reply_ctx,
- message_state);
+ // Dispatch the reply.
+ int result = rd->dispatch_reply (reply_status,
+ version,
+ reply_ctx,
+ message_state);
+
+ // Idle the transport now.
+ // if (this->transport_ != 0)
+ // this->transport_->idle ();
+ // @@ Carlos : We can do this, in the Muxed Leader Follower
+ // implementation. In the older implementation, since the state
+ // variables are in the Transport, and since we are in the
+ // handle_input right now, we cannot idle the Transport. This
+ // means that I cannot use asynchronous requests with Exclusive
+ // Transport&Old Leader Follower implementation , because I dont
+ // know when to idle the Transport.
+ // So I am moving this <idle> call to the destructors of
+ // synchronous invocations and for asynchronous invocations
+ // idle'ing is not at all called after the reply is
+ // received.
+ // We can enable <idle> out here, once we get rid of the old
+ // Leader Follower implementation. Then we can get rid of the
+ // destructors in the Invocation classes and they dont have to
+ // call <idle>.
+ // Do I make sense? (Alex).
+
+ return result;
}
TAO_GIOP_Message_State *
@@ -123,41 +146,41 @@ TAO_Exclusive_TMS::idle_after_send (void)
return 0;
}
-int
-TAO_Exclusive_TMS::idle_after_reply (void)
-{
- if (this->transport_ != 0)
- return this->transport_->idle ();
-
- return 0;
-}
-
-int
-TAO_Exclusive_TMS::reply_received (const CORBA::ULong request_id)
-{
- if (this->rd_ == 0)
- {
- // Reply should have been dispatched already.
- return 1;
- }
- else if (this->request_id_ == request_id)
- {
- // Reply dispatcher is still here.
- return 0;
- }
- else
- {
- // Error. Request id is not matching.
-
- if (TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- "(%P | %t):TAO_Exclusive_TMS::reply_received:"
- "Invalid request_id \n"));
- }
- return -1;
- }
-}
+// int
+// TAO_Exclusive_TMS::idle_after_reply (void)
+// {
+// if (this->transport_ != 0)
+// return this->transport_->idle ();
+//
+// return 0;
+// }
+
+// int
+// TAO_Exclusive_TMS::reply_received (const CORBA::ULong request_id)
+// {
+// if (this->rd_ == 0)
+// {
+// // Reply should have been dispatched already.
+// return 1;
+// }
+// else if (this->request_id_ == request_id)
+// {
+// // Reply dispatcher is still here.
+// return 0;
+// }
+// else
+// {
+// // Error. Request id is not matching.
+//
+// if (TAO_debug_level > 0)
+// {
+// ACE_DEBUG ((LM_DEBUG,
+// "(%P | %t):TAO_Exclusive_TMS::reply_received:"
+// "Invalid request_id \n"));
+// }
+// return -1;
+// }
+// }
// *********************************************************************
@@ -237,7 +260,7 @@ TAO_Muxed_TMS::dispatch_reply (CORBA::ULong request_id,
return -1;
}
- // @@ Carlos : We could save the <messagee_state> somehow and then
+ // @@ Carlos : We could save the <message_state> somehow and then
// signal some other thread to go ahead read the incoming message
// if any. Is this what you were telling me before? (Alex).
@@ -246,6 +269,9 @@ TAO_Muxed_TMS::dispatch_reply (CORBA::ULong request_id,
version,
reply_ctx,
message_state);
+
+ // No need for idling Transport, it would have got idle'd soon after
+ // sending the request.
}
TAO_GIOP_Message_State *
@@ -279,26 +305,26 @@ TAO_Muxed_TMS::idle_after_send (void)
return 0;
}
-int
-TAO_Muxed_TMS::idle_after_reply (void)
-{
- return 0;
-}
-
-int
-TAO_Muxed_TMS::reply_received (const CORBA::ULong request_id)
-{
- if (this->dispatcher_table_.find (request_id) == -1)
- {
- // Reply should have been dispatched already.
- return 1;
- }
- else
- {
- // Reply dispatcher is still here.
- return 0;
- }
-}
+// int
+// TAO_Muxed_TMS::idle_after_reply (void)
+// {
+// return 0;
+// }
+
+// int
+// TAO_Muxed_TMS::reply_received (const CORBA::ULong request_id)
+// {
+// if (this->dispatcher_table_.find (request_id) == -1)
+// {
+// // Reply should have been dispatched already.
+// return 1;
+// }
+// else
+// {
+// // Reply dispatcher is still here.
+// return 0;
+// }
+// }
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Hash_Map_Manager_Ex <CORBA::ULong,
diff --git a/TAO/tao/Transport_Mux_Strategy.h b/TAO/tao/Transport_Mux_Strategy.h
index 0c9d2b3f150..ee06d1b9349 100644
--- a/TAO/tao/Transport_Mux_Strategy.h
+++ b/TAO/tao/Transport_Mux_Strategy.h
@@ -78,16 +78,16 @@ public:
virtual void destroy_message_state (TAO_GIOP_Message_State *) = 0;
// Destroy a CDR stream.
-
+
virtual int idle_after_send (void) = 0;
// Request has been just sent, but the reply is not received. Idle
// the transport now.
- virtual int idle_after_reply (void) = 0;
+ // virtual int idle_after_reply (void) = 0;
// Request is sent and the reply is received. Idle the transport
// now.
- virtual int reply_received (const CORBA::ULong request_id) = 0;
+ // virtual int reply_received (const CORBA::ULong request_id) = 0;
// Check whether the reply has been receieved for the request with
// <request_id>. Return 0 if no, 1 on yes and -1 if the request_id
// is invalid or there are some errors.
@@ -141,11 +141,11 @@ public:
// Request has been just sent, but the reply is not received. Idle
// the transport now.
- virtual int idle_after_reply (void);
+ // virtual int idle_after_reply (void);
// Request is sent and the reply is received. Idle the transport
// now.
- virtual int reply_received (const CORBA::ULong request_id);
+ // virtual int reply_received (const CORBA::ULong request_id);
// Check whether the reply has been receieved for the request with
// <request_id>. Return 0 if no, 1 on yes and -1 if the request_id
// is invalid or there are errors.
@@ -209,11 +209,11 @@ public:
// Request has been just sent, but the reply is not received. Idle
// the transport now.
- virtual int idle_after_reply (void);
+ // virtual int idle_after_reply (void);
// Request is sent and the reply is received. Idle the transport
// now.
- virtual int reply_received (const CORBA::ULong request_id);
+ // virtual int reply_received (const CORBA::ULong request_id);
// Check whether the reply has been receieved for the request with
// <request_id>. Return 0 if no, 1 on yes and -1 if the request_id
// is invalid or there are errors.