diff options
author | alex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-17 15:55:03 +0000 |
---|---|---|
committer | alex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-17 15:55:03 +0000 |
commit | b27e27a7d6cb1afefde16518394c3cd32ac90253 (patch) | |
tree | f5eee1700d3d3f746f89a566b0a75082251c94fe | |
parent | ec00e737d4ccf26a2f09d58539bad2c369e88054 (diff) | |
download | ATCD-b27e27a7d6cb1afefde16518394c3cd32ac90253.tar.gz |
ChangeLogTag : Sat Jul 17 10:53:49 1999 Alexander Babu Arulanthu <alex@cs.wustl.edu>
-rw-r--r-- | TAO/performance-tests/Latency/Makefile | 95 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/ami-latency-client.cpp | 318 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/client-st-muxed.conf | 2 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/client.cpp | 25 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/client.exclusive.conf | 2 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/test.idl | 4 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/test_i.cpp | 6 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/test_i.h | 4 |
8 files changed, 424 insertions, 32 deletions
diff --git a/TAO/performance-tests/Latency/Makefile b/TAO/performance-tests/Latency/Makefile index 66d39c55495..8f6ec70c673 100644 --- a/TAO/performance-tests/Latency/Makefile +++ b/TAO/performance-tests/Latency/Makefile @@ -17,16 +17,28 @@ LDLIBS = -lTAO IDLFILES = testC testS BIN = client server +ifdef AMI +BIN += ami-latency-client +endif # AMI + SRC = $(addsuffix .cpp, $(BIN) $(IDLFILES) test_i) CLIENT_OBJS = client.o testC.o SERVER_OBJS = server.o test_i.o $(addsuffix .o, $(IDLFILES)) +ifdef AMI +AMI_LATENCY_CLIENT_OBJS = ami-latency-client.o testC.o +endif # AMI + BUILD = $(BIN) VLDLIBS = $(LDLIBS:%=%$(VAR)) VBIN = $(BIN:%=%$(VAR)) TAO_IDLFLAGS += -Ge 1 +ifdef AMI +TAO_IDLFLAGS += -GC +endif # AMI + #---------------------------------------------------------------------------- # Include macros and targets #---------------------------------------------------------------------------- @@ -51,6 +63,11 @@ server: $(addprefix $(VDIR),$(SERVER_OBJS)) client: $(addprefix $(VDIR),$(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) +endif # AMI + realclean: clean -$(RM) $(foreach ext, $(IDL_EXT), test$(ext)) @@ -62,6 +79,7 @@ realclean: clean $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -182,8 +200,7 @@ realclean: clean $(ACE_ROOT)/ace/High_Res_Timer.h \ $(ACE_ROOT)/ace/High_Res_Timer.i \ $(ACE_ROOT)/ace/Sched_Params.h \ - $(ACE_ROOT)/ace/Sched_Params.i \ - testC.h \ + $(ACE_ROOT)/ace/Sched_Params.i testC.h \ $(TAO_ROOT)/tao/corba.h \ $(TAO_ROOT)/tao/corbafwd.h \ $(ACE_ROOT)/ace/CDR_Stream.h \ @@ -206,10 +223,13 @@ realclean: clean $(TAO_ROOT)/tao/Sequence_T.h \ $(TAO_ROOT)/tao/Sequence_T.i \ $(TAO_ROOT)/tao/Sequence_T.cpp \ - $(TAO_ROOT)/tao/Services.i \ - $(TAO_ROOT)/tao/IORManipulation.h \ + $(TAO_ROOT)/tao/varout.h \ $(TAO_ROOT)/tao/Object.h \ $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/varout.i \ + $(TAO_ROOT)/tao/varout.cpp \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/IORManipulation.h \ $(TAO_ROOT)/tao/IORS.h \ $(TAO_ROOT)/tao/IORC.h \ $(TAO_ROOT)/tao/CDR.h \ @@ -243,9 +263,6 @@ realclean: clean $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/Server_Request.i \ - $(TAO_ROOT)/tao/varout.h \ - $(TAO_ROOT)/tao/varout.i \ - $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Marshal.h \ $(TAO_ROOT)/tao/Marshal.i \ $(TAO_ROOT)/tao/singletons.h \ @@ -282,6 +299,8 @@ realclean: clean $(TAO_ROOT)/tao/DynAnyC.i \ $(TAO_ROOT)/tao/DomainC.h \ $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/PollableC.h \ + $(TAO_ROOT)/tao/PollableC.i \ $(TAO_ROOT)/tao/POAS.i \ $(TAO_ROOT)/tao/Active_Object_Map.h \ $(TAO_ROOT)/tao/Active_Object_Map.i \ @@ -334,11 +353,14 @@ realclean: clean $(TAO_ROOT)/tao/ObjectIDList.h \ $(TAO_ROOT)/tao/ObjectIDList.i \ $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/Asynch_Invocation.h \ + $(TAO_ROOT)/tao/Asynch_Invocation.i \ testC.i .obj/server.o .obj/server.so .shobj/server.o .shobj/server.so: server.cpp test_i.h testS.h testC.h \ $(TAO_ROOT)/tao/corba.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -443,10 +465,13 @@ realclean: clean $(TAO_ROOT)/tao/Sequence_T.h \ $(TAO_ROOT)/tao/Sequence_T.i \ $(TAO_ROOT)/tao/Sequence_T.cpp \ - $(TAO_ROOT)/tao/Services.i \ - $(TAO_ROOT)/tao/IORManipulation.h \ + $(TAO_ROOT)/tao/varout.h \ $(TAO_ROOT)/tao/Object.h \ $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/varout.i \ + $(TAO_ROOT)/tao/varout.cpp \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/IORManipulation.h \ $(TAO_ROOT)/tao/IORS.h \ $(TAO_ROOT)/tao/IORC.h \ $(TAO_ROOT)/tao/CDR.h \ @@ -480,9 +505,6 @@ realclean: clean $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/Server_Request.i \ - $(TAO_ROOT)/tao/varout.h \ - $(TAO_ROOT)/tao/varout.i \ - $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Marshal.h \ $(TAO_ROOT)/tao/Marshal.i \ $(TAO_ROOT)/tao/singletons.h \ @@ -519,6 +541,8 @@ realclean: clean $(TAO_ROOT)/tao/DynAnyC.i \ $(TAO_ROOT)/tao/DomainC.h \ $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/PollableC.h \ + $(TAO_ROOT)/tao/PollableC.i \ $(TAO_ROOT)/tao/POAS.i \ $(TAO_ROOT)/tao/Active_Object_Map.h \ $(TAO_ROOT)/tao/Active_Object_Map.i \ @@ -592,6 +616,8 @@ realclean: clean $(TAO_ROOT)/tao/ObjectIDList.h \ $(TAO_ROOT)/tao/ObjectIDList.i \ $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/Asynch_Invocation.h \ + $(TAO_ROOT)/tao/Asynch_Invocation.i \ testC.i testS_T.h testS_T.i testS_T.cpp testS.i test_i.i \ $(ACE_ROOT)/ace/Get_Opt.h \ $(ACE_ROOT)/ace/Get_Opt.i \ @@ -612,6 +638,7 @@ realclean: clean $(TAO_ROOT)/tao/corba.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -716,10 +743,13 @@ realclean: clean $(TAO_ROOT)/tao/Sequence_T.h \ $(TAO_ROOT)/tao/Sequence_T.i \ $(TAO_ROOT)/tao/Sequence_T.cpp \ - $(TAO_ROOT)/tao/Services.i \ - $(TAO_ROOT)/tao/IORManipulation.h \ + $(TAO_ROOT)/tao/varout.h \ $(TAO_ROOT)/tao/Object.h \ $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/varout.i \ + $(TAO_ROOT)/tao/varout.cpp \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/IORManipulation.h \ $(TAO_ROOT)/tao/IORS.h \ $(TAO_ROOT)/tao/IORC.h \ $(TAO_ROOT)/tao/CDR.h \ @@ -753,9 +783,6 @@ realclean: clean $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/Server_Request.i \ - $(TAO_ROOT)/tao/varout.h \ - $(TAO_ROOT)/tao/varout.i \ - $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Marshal.h \ $(TAO_ROOT)/tao/Marshal.i \ $(TAO_ROOT)/tao/singletons.h \ @@ -792,6 +819,8 @@ realclean: clean $(TAO_ROOT)/tao/DynAnyC.i \ $(TAO_ROOT)/tao/DomainC.h \ $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/PollableC.h \ + $(TAO_ROOT)/tao/PollableC.i \ $(TAO_ROOT)/tao/POAS.i \ $(TAO_ROOT)/tao/Active_Object_Map.h \ $(TAO_ROOT)/tao/Active_Object_Map.i \ @@ -865,11 +894,14 @@ realclean: clean $(TAO_ROOT)/tao/ObjectIDList.h \ $(TAO_ROOT)/tao/ObjectIDList.i \ $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/Asynch_Invocation.h \ + $(TAO_ROOT)/tao/Asynch_Invocation.i \ testC.i .obj/testS.o .obj/testS.so .shobj/testS.o .shobj/testS.so: testS.cpp testS.h testC.h \ $(TAO_ROOT)/tao/corba.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -974,10 +1006,13 @@ realclean: clean $(TAO_ROOT)/tao/Sequence_T.h \ $(TAO_ROOT)/tao/Sequence_T.i \ $(TAO_ROOT)/tao/Sequence_T.cpp \ - $(TAO_ROOT)/tao/Services.i \ - $(TAO_ROOT)/tao/IORManipulation.h \ + $(TAO_ROOT)/tao/varout.h \ $(TAO_ROOT)/tao/Object.h \ $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/varout.i \ + $(TAO_ROOT)/tao/varout.cpp \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/IORManipulation.h \ $(TAO_ROOT)/tao/IORS.h \ $(TAO_ROOT)/tao/IORC.h \ $(TAO_ROOT)/tao/CDR.h \ @@ -1011,9 +1046,6 @@ realclean: clean $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/Server_Request.i \ - $(TAO_ROOT)/tao/varout.h \ - $(TAO_ROOT)/tao/varout.i \ - $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Marshal.h \ $(TAO_ROOT)/tao/Marshal.i \ $(TAO_ROOT)/tao/singletons.h \ @@ -1050,6 +1082,8 @@ realclean: clean $(TAO_ROOT)/tao/DynAnyC.i \ $(TAO_ROOT)/tao/DomainC.h \ $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/PollableC.h \ + $(TAO_ROOT)/tao/PollableC.i \ $(TAO_ROOT)/tao/POAS.i \ $(TAO_ROOT)/tao/Active_Object_Map.h \ $(TAO_ROOT)/tao/Active_Object_Map.i \ @@ -1123,11 +1157,14 @@ realclean: clean $(TAO_ROOT)/tao/ObjectIDList.h \ $(TAO_ROOT)/tao/ObjectIDList.i \ $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/Asynch_Invocation.h \ + $(TAO_ROOT)/tao/Asynch_Invocation.i \ testC.i testS_T.h testS_T.i testS_T.cpp testS.i .obj/test_i.o .obj/test_i.so .shobj/test_i.o .shobj/test_i.so: test_i.cpp test_i.h testS.h testC.h \ $(TAO_ROOT)/tao/corba.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config-sunos5.5.h \ $(ACE_ROOT)/ace/streams.h \ $(ACE_ROOT)/ace/Basic_Types.h \ $(ACE_ROOT)/ace/Basic_Types.i \ @@ -1232,10 +1269,13 @@ realclean: clean $(TAO_ROOT)/tao/Sequence_T.h \ $(TAO_ROOT)/tao/Sequence_T.i \ $(TAO_ROOT)/tao/Sequence_T.cpp \ - $(TAO_ROOT)/tao/Services.i \ - $(TAO_ROOT)/tao/IORManipulation.h \ + $(TAO_ROOT)/tao/varout.h \ $(TAO_ROOT)/tao/Object.h \ $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/varout.i \ + $(TAO_ROOT)/tao/varout.cpp \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/IORManipulation.h \ $(TAO_ROOT)/tao/IORS.h \ $(TAO_ROOT)/tao/IORC.h \ $(TAO_ROOT)/tao/CDR.h \ @@ -1269,9 +1309,6 @@ realclean: clean $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/Server_Request.i \ - $(TAO_ROOT)/tao/varout.h \ - $(TAO_ROOT)/tao/varout.i \ - $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Marshal.h \ $(TAO_ROOT)/tao/Marshal.i \ $(TAO_ROOT)/tao/singletons.h \ @@ -1308,6 +1345,8 @@ realclean: clean $(TAO_ROOT)/tao/DynAnyC.i \ $(TAO_ROOT)/tao/DomainC.h \ $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/PollableC.h \ + $(TAO_ROOT)/tao/PollableC.i \ $(TAO_ROOT)/tao/POAS.i \ $(TAO_ROOT)/tao/Active_Object_Map.h \ $(TAO_ROOT)/tao/Active_Object_Map.i \ @@ -1381,6 +1420,8 @@ realclean: clean $(TAO_ROOT)/tao/ObjectIDList.h \ $(TAO_ROOT)/tao/ObjectIDList.i \ $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/Asynch_Invocation.h \ + $(TAO_ROOT)/tao/Asynch_Invocation.i \ testC.i testS_T.h testS_T.i testS_T.cpp testS.i test_i.i # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/performance-tests/Latency/ami-latency-client.cpp b/TAO/performance-tests/Latency/ami-latency-client.cpp new file mode 100644 index 00000000000..b98c7fba9c9 --- /dev/null +++ b/TAO/performance-tests/Latency/ami-latency-client.cpp @@ -0,0 +1,318 @@ +// $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 "testS.h" + +ACE_RCSID(Latency, client, "$Id$") + +const char *ior = "file://test.ior"; +int nthreads = 1; +int niterations = 5; + +ACE_hrtime_t latency_base; + +ACE_hrtime_t throughput_base; + +ACE_Throughput_Stats throughput_stats; +// Global throughput statistics. + +ACE_Time_Value sleep_time (0, 10000); + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "k:n:i:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.optarg; + break; + // case 'n': + // nthreads = ACE_OS::atoi (get_opts.optarg); + // break; + case 'i': + niterations = ACE_OS::atoi (get_opts.optarg); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + // "-n <nthreads> " + "-i <niterations> " + "-v " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +class Handler : public POA_AMI_Test_Handler +{ +public: + Handler (void) {}; + + void test_method (CORBA::Environment&) + { + 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); + }; + + ~Handler (void) {}; +}; + +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, + CORBA::ORB_ptr orb, + AMI_Test_Handler_ptr reply_handler); + // 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. + + CORBA::ORB_ptr orb_; + // Cache the ORB pointer. + + AMI_Test_Handler_ptr reply_handler_; + // ReplyHandler object. +}; + +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); + } + + // ReplyHandler object. + Handler handler; + AMI_Test_Handler_var reply_handler = handler._this (ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Activate POA to handle the call back. + + 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; + + poa_manager->activate (ACE_TRY_ENV); + ACE_TRY_CHECK; + + // Create <nthreads> number of ACE_Task objects. + Client *clients; + ACE_NEW_RETURN (clients, Client[nthreads], 1); + for (int i = 0; i != nthreads; ++i) + { + // Init the client objects. + clients[i].set (server.in (), + niterations, + orb, + reply_handler.in ()); + + // Activate the Tasks. + if (clients[i].activate (THR_NEW_LWP | THR_JOINABLE) != 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; + char buf[64]; + + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + for (int j = 0; j != nthreads; ++j) + { + clients[j].accumulate_into (throughput); + + ACE_OS::sprintf (buf, "Thread[%d]", j); + clients[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) + : niterations_ (0), + orb_ (0), + reply_handler_ (0) +{ +} + +void +Client::set (Test_ptr server, + int niterations, + CORBA::ORB_ptr orb, + AMI_Test_Handler_ptr reply_handler) +{ + this->server_ = Test::_duplicate (server); + this->niterations_ = niterations; + this->orb_ = orb; + this->reply_handler_ = reply_handler; +} + +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; + } + + // Init global throughput base. + throughput_base = ACE_OS::gethrtime (); + + for (size_t i = 0; i < this->niterations_; ++i) + { + // Get timestamp. + latency_base = ACE_OS::gethrtime (); + + // Invoke asynchronous operation. + server_->sendc_test_method (this->reply_handler_, + ACE_TRY_ENV); + + // Spend 10 msecs running the ORB. + this->orb_->run (sleep_time); + + ACE_TRY_CHECK; + + 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 &t) const +{ + t.accumulate (throughput_stats); +} + +void +Client::dump_stats (const char* msg, ACE_UINT32 gsf) +{ + throughput_stats.dump_results (msg, gsf); +} diff --git a/TAO/performance-tests/Latency/client-st-muxed.conf b/TAO/performance-tests/Latency/client-st-muxed.conf new file mode 100644 index 00000000000..2f4a9aac71a --- /dev/null +++ b/TAO/performance-tests/Latency/client-st-muxed.conf @@ -0,0 +1,2 @@ +# $Id$ +static Client_Strategy_Factory "-ORBClientConnectionHandler ST -ORBTransportMuxStrategy MUXED" diff --git a/TAO/performance-tests/Latency/client.cpp b/TAO/performance-tests/Latency/client.cpp index 9190bbdaca6..b00e82c03b3 100644 --- a/TAO/performance-tests/Latency/client.cpp +++ b/TAO/performance-tests/Latency/client.cpp @@ -13,10 +13,14 @@ const char *ior = "file://test.ior"; int nthreads = 5; 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:"); + ACE_Get_Opt get_opts (argc, argv, "k:n:i:s"); int c; while ((c = get_opts ()) != -1) @@ -31,6 +35,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, @@ -161,8 +168,8 @@ main (int argc, char *argv[]) } throughput.dump_results ("Aggregated", gsf); - server->shutdown (ACE_TRY_ENV); - ACE_TRY_CHECK; + // server->shutdown (ACE_TRY_ENV); + // ACE_TRY_CHECK; } ACE_CATCHANY { @@ -204,12 +211,22 @@ Client::svc (void) 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); diff --git a/TAO/performance-tests/Latency/client.exclusive.conf b/TAO/performance-tests/Latency/client.exclusive.conf new file mode 100644 index 00000000000..2a75162271c --- /dev/null +++ b/TAO/performance-tests/Latency/client.exclusive.conf @@ -0,0 +1,2 @@ +# $Id$ +static Client_Strategy_Factory "-ORBclientconnectionhandler MT" diff --git a/TAO/performance-tests/Latency/test.idl b/TAO/performance-tests/Latency/test.idl index fb5e94ff048..7a34665377a 100644 --- a/TAO/performance-tests/Latency/test.idl +++ b/TAO/performance-tests/Latency/test.idl @@ -6,5 +6,7 @@ interface Test { void test_method (); - oneway void shutdown (); + // void time_stamp (inout unsigned long index); + + // oneway void shutdown (); }; diff --git a/TAO/performance-tests/Latency/test_i.cpp b/TAO/performance-tests/Latency/test_i.cpp index c95525d7e0a..45bf053db87 100644 --- a/TAO/performance-tests/Latency/test_i.cpp +++ b/TAO/performance-tests/Latency/test_i.cpp @@ -22,6 +22,12 @@ Test_i::test_method (CORBA::Environment&) ACE_THROW_SPEC (()) } void +Test_i::time_stamp (CORBA::ULong &, CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void Test_i::shutdown (CORBA::Environment& ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { diff --git a/TAO/performance-tests/Latency/test_i.h b/TAO/performance-tests/Latency/test_i.h index a98ff85285b..a57c9e88785 100644 --- a/TAO/performance-tests/Latency/test_i.h +++ b/TAO/performance-tests/Latency/test_i.h @@ -34,6 +34,10 @@ public: void test_method (CORBA::Environment&) ACE_THROW_SPEC (()); + void time_stamp (CORBA::ULong & index, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)); + void shutdown (CORBA::Environment&) ACE_THROW_SPEC ((CORBA::SystemException)); |