diff options
Diffstat (limited to 'modules/CIAO/performance-tests')
100 files changed, 6061 insertions, 0 deletions
diff --git a/modules/CIAO/performance-tests/Benchmark/Benchmark.idl b/modules/CIAO/performance-tests/Benchmark/Benchmark.idl new file mode 100644 index 00000000000..d363628c891 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Benchmark.idl @@ -0,0 +1,48 @@ +// $Id$ +//============================================================================= +/** + * @file Benchmark.idl + * + * Definition of test interfaces used in the Benchmark module. + * + * @author Diego, Arvind <arvindk@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_BENCHMARK_IDL +#define CIAO_BENCHMARK_IDL + + +module Benchmark +{ + + /** + * @interface RoundTrip + * + * This Latency test provides operations to measure the round-trip + * latency of the ORB. The interface is same as that of + * $TAO_ROOT/performance-tests/Latency/Single_Threaded + */ + + /// Measure roundtrip delay + interface LatencyTest + { + /// A simple method to measure roundtrip delays + long makeCall (in long send_time); + + }; + + /** + * @interface Controller + * + * This interface is used to start the tests. + */ + interface Controller + { + /// Start the test + void start (); + }; + +}; + +#endif /*CIAO_BENCHMARK_IDL*/ diff --git a/modules/CIAO/performance-tests/Benchmark/Benchmark.mpc b/modules/CIAO/performance-tests/Benchmark/Benchmark.mpc new file mode 100644 index 00000000000..59cb34c414d --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Benchmark.mpc @@ -0,0 +1,49 @@ +// $Id$ + +project(Benchmark_stub): ciao_client_dnc { + avoids += ace_for_tao + sharedname = Benchmark_stub + idlflags += -Wb,stub_export_macro=BENCHMARK_STUB_Export -Wb,stub_export_include=Benchmark_stub_export.h -Wb,skel_export_macro=BENCHMARK_SVNT_Export -Wb,skel_export_include=Benchmark_svnt_export.h + dynamicflags = BENCHMARK_STUB_BUILD_DLL + + IDL_Files { + Benchmark.idl + } + + Source_Files { + BenchmarkC.cpp + } +} + +project(Benchmark_svnt) : ciao_component_dnc { + avoids += ace_for_tao + after += Benchmark_stub + sharedname = Benchmark_svnt + libs += Benchmark_stub + + idlflags += -Wb,export_macro=BENCHMARK_SVNT_Export -Wb,export_include=Benchmark_svnt_export.h + dynamicflags = BENCHMARK_SVNT_BUILD_DLL + IDL_Files { + } + + Source_Files { + BenchmarkS.cpp + } +} + +project (*server) : taoserver, strategies,ciao_component_dnc { + avoids += ace_for_tao + after += Benchmark_svnt + libs += Benchmark_svnt Benchmark_stub + + Source_Files { + server.cpp + LatencyTest.cpp + BenchmarkEC.cpp + BenchmarkES.cpp + } + + IDL_Files { + BenchmarkE.idl + } +} diff --git a/modules/CIAO/performance-tests/Benchmark/BenchmarkE.idl b/modules/CIAO/performance-tests/Benchmark/BenchmarkE.idl new file mode 100644 index 00000000000..1886b02c12a --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/BenchmarkE.idl @@ -0,0 +1,33 @@ +// $Id$ + +//============================================================================= +/** + * @file BenchmarkE.idl + * + * @author Diego, Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_BENCHMARKE_IDL +#define CIAO_BENCHMARKE_IDL + +#include "Benchmark.idl" + +module Benchmark +{ + + /** + * @interface CCM_RoundTrip + * + * Executor interface mapping for provides interfaces. + * + */ + local interface CCM_RoundTrip + { + long makeCall(in long data); + }; + + +}; + +#endif /* CIAO_BENCHMARKE_IDL */ diff --git a/modules/CIAO/performance-tests/Benchmark/Benchmark_stub_export.h b/modules/CIAO/performance-tests/Benchmark/Benchmark_stub_export.h new file mode 100644 index 00000000000..d522c90f830 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Benchmark_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BENCHMARK_STUB +// ------------------------------ +#ifndef BENCHMARK_STUB_EXPORT_H +#define BENCHMARK_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BENCHMARK_STUB_HAS_DLL) +# define BENCHMARK_STUB_HAS_DLL 1 +#endif /* ! BENCHMARK_STUB_HAS_DLL */ + +#if defined (BENCHMARK_STUB_HAS_DLL) && (BENCHMARK_STUB_HAS_DLL == 1) +# if defined (BENCHMARK_STUB_BUILD_DLL) +# define BENCHMARK_STUB_Export ACE_Proper_Export_Flag +# define BENCHMARK_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BENCHMARK_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BENCHMARK_STUB_BUILD_DLL */ +# define BENCHMARK_STUB_Export ACE_Proper_Import_Flag +# define BENCHMARK_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BENCHMARK_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BENCHMARK_STUB_BUILD_DLL */ +#else /* BENCHMARK_STUB_HAS_DLL == 1 */ +# define BENCHMARK_STUB_Export +# define BENCHMARK_STUB_SINGLETON_DECLARATION(T) +# define BENCHMARK_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BENCHMARK_STUB_HAS_DLL == 1 */ + +// Set BENCHMARK_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BENCHMARK_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define BENCHMARK_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BENCHMARK_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BENCHMARK_STUB_NTRACE */ + +#if (BENCHMARK_STUB_NTRACE == 1) +# define BENCHMARK_STUB_TRACE(X) +#else /* (BENCHMARK_STUB_NTRACE == 1) */ +# define BENCHMARK_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BENCHMARK_STUB_NTRACE == 1) */ + +#endif /* BENCHMARK_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Benchmark/Benchmark_svnt_export.h b/modules/CIAO/performance-tests/Benchmark/Benchmark_svnt_export.h new file mode 100644 index 00000000000..8b2ab3b803a --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Benchmark_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BENCHMARK_SVNT +// ------------------------------ +#ifndef BENCHMARK_SVNT_EXPORT_H +#define BENCHMARK_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BENCHMARK_SVNT_HAS_DLL) +# define BENCHMARK_SVNT_HAS_DLL 1 +#endif /* ! BENCHMARK_SVNT_HAS_DLL */ + +#if defined (BENCHMARK_SVNT_HAS_DLL) && (BENCHMARK_SVNT_HAS_DLL == 1) +# if defined (BENCHMARK_SVNT_BUILD_DLL) +# define BENCHMARK_SVNT_Export ACE_Proper_Export_Flag +# define BENCHMARK_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BENCHMARK_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BENCHMARK_SVNT_BUILD_DLL */ +# define BENCHMARK_SVNT_Export ACE_Proper_Import_Flag +# define BENCHMARK_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BENCHMARK_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BENCHMARK_SVNT_BUILD_DLL */ +#else /* BENCHMARK_SVNT_HAS_DLL == 1 */ +# define BENCHMARK_SVNT_Export +# define BENCHMARK_SVNT_SINGLETON_DECLARATION(T) +# define BENCHMARK_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BENCHMARK_SVNT_HAS_DLL == 1 */ + +// Set BENCHMARK_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BENCHMARK_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define BENCHMARK_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BENCHMARK_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BENCHMARK_SVNT_NTRACE */ + +#if (BENCHMARK_SVNT_NTRACE == 1) +# define BENCHMARK_SVNT_TRACE(X) +#else /* (BENCHMARK_SVNT_NTRACE == 1) */ +# define BENCHMARK_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BENCHMARK_SVNT_NTRACE == 1) */ + +#endif /* BENCHMARK_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Benchmark/LatencyTest.cpp b/modules/CIAO/performance-tests/Benchmark/LatencyTest.cpp new file mode 100644 index 00000000000..443506298bb --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/LatencyTest.cpp @@ -0,0 +1,24 @@ +// +// $Id$ +// +#include "LatencyTest.h" + +LatencyTest::LatencyTest (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + + +CORBA::Long +LatencyTest::makeCall (CORBA::Long send_time) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return send_time; +} + +void +LatencyTest::shutdown () + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->orb_->shutdown (0); +} diff --git a/modules/CIAO/performance-tests/Benchmark/LatencyTest.h b/modules/CIAO/performance-tests/Benchmark/LatencyTest.h new file mode 100644 index 00000000000..7bd3de194bf --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/LatencyTest.h @@ -0,0 +1,33 @@ +// +// $Id$ +// + +#ifndef LATENCYTEST_H +#define LATENCYTEST_H +#include /**/ "ace/pre.h" + +#include "BenchmarkS.h" + +/// Implement the Test::LatencyTest interface +class LatencyTest +: public virtual POA_Benchmark::LatencyTest +{ + public: + /// Constructor + LatencyTest (CORBA::ORB_ptr orb); + + // = The skeleton methods + virtual CORBA::Long makeCall (CORBA::Long send_time) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void shutdown () + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; +}; + +#include /**/ "ace/post.h" +#endif /* LATENCYTEST_H */ diff --git a/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/Client_Task.cpp b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/Client_Task.cpp new file mode 100644 index 00000000000..a6d8d9d8202 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/Client_Task.cpp @@ -0,0 +1,30 @@ +// +// $Id$ +// + +#include "Client_Task.h" + +Client_Task::Client_Task (Benchmark::RoundTripClient_ptr roundtrip) + : roundtrip_(Benchmark::RoundTripClient::_duplicate(roundtrip)) +{ +} + +int +Client_Task::svc (void) +{ + //Creat the Controller + Benchmark::Controller_var controller = this->roundtrip_->provide_controller(); + + //check if controller is non nil + if (CORBA::is_nil (controller.in ())) + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Benchmark::Controller reference \n"), + 1); + + ACE_DEBUG ((LM_DEBUG, "Sending Trigger\n")); + + //send out the trigger message + controller->start(); + + return 0; +} diff --git a/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/Client_Task.h b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/Client_Task.h new file mode 100644 index 00000000000..e3330a76307 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/Client_Task.h @@ -0,0 +1,29 @@ +// +// $Id$ +// + +#ifndef CLIENT_TASK_H +#define CLIENT_TASK_H +#include /**/ "ace/pre.h" + +#include "RoundTripClientC.h" +#include "ace/Task.h" + +/// Implement the Test::Client_Task interface +class Client_Task : public ACE_Task_Base +{ +public: + /// Constructor + Client_Task (Benchmark::RoundTripClient_ptr roundtrip); + + /// The service method + virtual int svc (void); + +private: + + /// The object reference used for this test + Benchmark::RoundTripClient_var roundtrip_; +}; + +#include /**/ "ace/post.h" +#endif /* CLIENT_TASK_H */ diff --git a/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/Multi_Threaded.mpc b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/Multi_Threaded.mpc new file mode 100644 index 00000000000..40927889016 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/Multi_Threaded.mpc @@ -0,0 +1,18 @@ +// $Id$ + +project (Multi_Threaded_client) : ciao_client_dnc, valuetype , strategies { + exename = client + after += RoundTripClient_stub + libs += RoundTripClient_stub Benchmark_stub + libpaths += .. + includes += ../RoundTripClient + avoids += ace_for_tao + + IDL_Files { + } + + Source_Files { + client.cpp + Client_Task.cpp + } +} diff --git a/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/NOTE.txt b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/NOTE.txt new file mode 100644 index 00000000000..a0ae140a0ee --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/NOTE.txt @@ -0,0 +1,15 @@ +$Id$ + +PRE Condition: +============= +This test assumes that there is an appropriate svc.conf file present in +$CIAO_ROOOT/tools/ComponentServer. Moreover, the Component Server does not +curerntly expose interfaces to configure multi-threading. Hence, this +experiment, will produce the desired results *only* when this feature has been +added in CIAO. Till then, the server will run in single-threaded mode. + +Similarly, the client also requires the svc.conf file that enables +multi-threading. This file is present in this directory. + +The svc.conf file required for this experiment can be obtained from +$TAO_ROOT/performance-tests/Latency/Thread_Pool diff --git a/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/README b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/README new file mode 100644 index 00000000000..0cadcfc8e51 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/README @@ -0,0 +1,12 @@ +/** + +@page Multi_Threaded README File + + This black box experiment measures "multi-threading" support present in CIAO. +In this test, a client component spawns four threads that concurrently invoke operations +on the server. The latency, throughput and jitter for each thread is printed out. The +motivation of this test is to observe scalability when a ComponentServer receives +multiple requests from parallel clients. A sister test, ../Multi_Process documents +behavior as parallel clients (separate processes) invoke requests on the server. + +*/ diff --git a/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/client.cpp b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/client.cpp new file mode 100644 index 00000000000..92bf6aecd2d --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/client.cpp @@ -0,0 +1,93 @@ +// +// $Id$ +// + +//============================================================== +/** + * @file client.cpp + * + * This is a client program that also acts as an Event Trigger. Four client tasks simultaneously + * send out trigger to the ClientRoundTrip component to start the latency measurements in + * parallel. This test is used to test scalability as the number of client components increase + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + */ +//=============================================================== + +#include "Client_Task.h" +#include "tao/Strategies/advanced_resource.h" + +//IOR of the components +const char *ior1 = "file://comp1.ior"; +const char *ior2 = "file://comp2.ior"; +const char *ior3 = "file://comp3.ior"; +const char *ior4 = "file://comp4.ior"; + + +int +main (int argc, char *argv[]) +{ + try + { + + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv, + ""); + + // Resolve HomeFinder interface + CORBA::Object_var obj1 + = orb->string_to_object (ior1); + + CORBA::Object_var obj2 + = orb->string_to_object (ior2); + + CORBA::Object_var obj3 + = orb->string_to_object (ior3); + + CORBA::Object_var obj4 + = orb->string_to_object (ior4); + + if (CORBA::is_nil (obj1.in ()) || + CORBA::is_nil (obj2.in ()) || + CORBA::is_nil (obj3.in ()) || + CORBA::is_nil (obj4.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Nil Benchmark::RoundtripClient reference \n"), + 1); + } + + //Narrow to appropriate interfaces + Benchmark::RoundTripClient_var client1= + Benchmark::RoundTripClient::_narrow (obj1.in()); + + Benchmark::RoundTripClient_var client2= + Benchmark::RoundTripClient::_narrow (obj1.in()); + + Benchmark::RoundTripClient_var client3= + Benchmark::RoundTripClient::_narrow (obj1.in()); + + Benchmark::RoundTripClient_var client4= + Benchmark::RoundTripClient::_narrow (obj1.in()); + + //Create Tasks + Client_Task task1(client1.in()); + Client_Task task2(client2.in()); + Client_Task task3(client3.in()); + Client_Task task4(client4.in()); + + task1.activate(THR_NEW_LWP | THR_JOINABLE); + task2.activate(THR_NEW_LWP | THR_JOINABLE); + task3.activate(THR_NEW_LWP | THR_JOINABLE); + task4.activate(THR_NEW_LWP | THR_JOINABLE); + + task1.thr_mgr()->wait(); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception Caught:"); + return 1; + } + return 0; +} diff --git a/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/run_test.pl b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/run_test.pl new file mode 100755 index 00000000000..fe52b35d6a2 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/run_test.pl @@ -0,0 +1,87 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +# +# @@ Run this script from ../descriptors/ instead. +# + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$status = 0; +$daemon_ior = PerlACE::LocalFile ("daemon.ior"); +$am_ior = PerlACE::LocalFile ("am.ior"); + +$ACE_ROOT=$ENV{'ACE_ROOT'}; +$CIAO_ROOT=$ENV{'CIAO_ROOT'}; + +unlink $daemon_ior; +unlink $am_ior; + +# CIAO Daemon command line arguments +$daemon_args = "-c $CIAO_ROOT/tools/ComponentServer/svc.conf -ORBEndpoint iiop://localhost:10000 -o $daemon_ior -i CIAO_Installation_Data.ini -n $CIAO_ROOT/tools/ComponentServer/ComponentServer"; + +# CIAO Daemon command line arguments +$daemon_args2 = "-c $CIAO_ROOT/tools/ComponentServer/svc.conf -ORBEndpoint iiop://localhost:12000 -o $daemon_ior -i CIAO_Installation_Data.ini -n $CIAO_ROOT/tools/ComponentServer/ComponentServer"; + +$assembly_manager_args = "-o $am_ior -c test.dat"; + +$ad_args = " -k file://$am_ior -a Multi_Threaded.cad"; + +# CIAO daemon process definition +$DS = new PerlACE::Process ("$CIAO_ROOT/tools/Daemon/CIAO_Daemon", + "$daemon_args"); + +## Starting up the CIAO daemon +$DS->Spawn (); +if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) { + print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n"; + $DS->Kill (); + exit 1; +} + +# CIAO daemon process definition +$DS2 = new PerlACE::Process ("$CIAO_ROOT/tools/Daemon/CIAO_Daemon", + "$daemon_args2"); + +## Starting up the CIAO daemon +$DS2->Spawn (); +if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) { + print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n"; + $DS->Kill (); + exit 1; +} + +$AM = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Manager", + $assembly_manager_args); +$AM->Spawn (); +if (PerlACE::waitforfile_timed ($am_ior, 15) == -1) { + print STDERR "ERROR: Could not find assembly ior file <$am_ior>\n"; + $AM->Kill (); + exit 1; +} + +$AD = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Deployer", + $ad_args); +$AD->Spawn (); + +sleep (5); + +#Start the client to send the trigger message +$CL = new PerlACE::Process ("../Multi_Threaded/client", ""); +$CL->SpawnWaitKill(60); + +$AM->Kill (); +$AD->Kill (); +$DS->Kill (); +$CL->Kill (); +$DS2->Kill (); + +unlink $daemon_ior; +unlink $am_ior; + +exit $status; diff --git a/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/svc.conf b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/svc.conf new file mode 100644 index 00000000000..46ff5409fdf --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/Multi_Threaded/svc.conf @@ -0,0 +1,5 @@ +# +# $Id$ +# +static Advanced_Resource_Factory "-ORBReactorMaskSignals 0 -ORBFlushingStrategy blocking" +static Client_Strategy_Factory "-ORBTransportMuxStrategy EXCLUSIVE -ORBClientConnectionHandler RW" diff --git a/modules/CIAO/performance-tests/Benchmark/README b/modules/CIAO/performance-tests/Benchmark/README new file mode 100644 index 00000000000..ec8463d2aae --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/README @@ -0,0 +1,32 @@ +/** + +@page BasicSP README File + + The most basic of the Boeing scenarios that form part of the +OEP. This is done to illustrate how the OEP can be implemented using +CIAO. + + This example does not yet use MPC to generate MSVC +projects/workspaces/solutions or makefiles - we are still +working on getting the execution of the CIDL compiler +integrated into MPC. The CIDL compiler execution has +been added to MSVC projects, which for now are checked +into the CVS repository. CIDL compiler execution is not yet +integrated with makefiles. The CIDL compiler can be executed by +hand before starting the build for either this example or the +example in ACE_ROOT/TAO/CIAO/examples/OEP/Display. + + Compilation of the CIDL compiler source code requires the +Boost library, which is not included in this distribution of +ACE+TAO+CIAO. The Boost library is available at + +http://www.boost.org + + Alternatively, a binary executable of the CIAO +CIDL compiler can be downloaded from + +http://www.dre.vanderbilt.edu/CIAO/CIDL.html + +Versions are available at the above site for Linux and Windows. + +*/ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/README b/modules/CIAO/performance-tests/Benchmark/RoundTrip/README new file mode 100644 index 00000000000..8bd003eaf72 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/README @@ -0,0 +1,9 @@ +/** + +@page RoundTrip README File + + The RoundTrip component. This component measures the round-trip +latency for single-threaded case. This test adapted from +$TAO_ROOT/performance-tests/Latency/Single_Threaded + +*/ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.cidl b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.cidl new file mode 100644 index 00000000000..724789ac42d --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.cidl @@ -0,0 +1,19 @@ +// $Id$ + +#ifndef ROUNDTRIP_CIDL +#define ROUNDTRIP_CIDL + +#include "RoundTrip.idl" + +composition session RoundTrip_Impl +{ + + home executor RoundTripHome_Exec + { + implements Benchmark::RoundTripHome; + manages RoundTrip_Exec; + }; + +}; + +#endif /* ROUNDTRIP_CIDL */ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.idl b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.idl new file mode 100644 index 00000000000..73a00422297 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.idl @@ -0,0 +1,29 @@ +// $Id$ +//============================================================================= +/** + * @file RoundTrip.idl + * + * Definition of the Component that provides the LatencyTest interface + * + */ +//============================================================================= + +#ifndef CIAO_ROUNDTRIP_IDL +#define CIAO_ROUNDTRIP_IDL + +#include "../Benchmark.idl" +#include <Components.idl> + +module Benchmark +{ + component RoundTrip + { + provides LatencyTest latency; + }; + + home RoundTripHome manages RoundTrip + { + }; +}; + +#endif /* CIAO_ROUNDTRIP_IDL*/ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.mpc b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.mpc new file mode 100644 index 00000000000..3a6e310d8ae --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.mpc @@ -0,0 +1,95 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p Benchmark -i -c RoundTrip" + +project(RoundTrip_stub): ciao_client_dnc { + avoids += ace_for_tao + after += Benchmark_stub + sharedname = RoundTrip_stub + + libs += Benchmark_stub + + idlflags += -Wb,stub_export_macro=ROUNDTRIP_STUB_Export + idlflags += -Wb,stub_export_include=RoundTrip_stub_export.h + idlflags += -Wb,skel_export_macro=ROUNDTRIP_SVNT_Export + idlflags += -Wb,skel_export_include=RoundTrip_svnt_export.h + + dynamicflags = ROUNDTRIP_STUB_BUILD_DLL + + IDL_Files { + RoundTrip.idl + } + + Source_Files { + RoundTripC.cpp + } +} + +project(RoundTrip_svnt) : ciao_servant_dnc { + avoids += ace_for_tao + after += Benchmark_svnt RoundTrip_stub + sharedname = RoundTrip_svnt + + libs += RoundTrip_stub Benchmark_stub Benchmark_svnt + + libpaths += .. + + idlflags += -Wb,export_macro=ROUNDTRIP_SVNT_Export + idlflags += -Wb,export_include=RoundTrip_svnt_export.h + + dynamicflags = ROUNDTRIP_SVNT_BUILD_DLL + + CIDL_Files { + RoundTrip.cidl + } + + IDL_Files { + RoundTripE.idl + } + + Source_Files { + RoundTripEC.cpp + RoundTripS.cpp + RoundTrip_svnt.cpp + } +} + + +project(RoundTrip_exec) : ciao_component_dnc { + avoids += ace_for_tao + after += RoundTrip_svnt + sharedname = RoundTrip_exec + + libs += RoundTrip_stub Benchmark_stub Benchmark_svnt RoundTrip_svnt + libpaths += .. + + idlflags += -Wb,export_macro=ROUNDTRIP_EXEC_Export + idlflags += -Wb,export_include=RoundTrip_exec_export.h + + dynamicflags = ROUNDTRIP_EXEC_BUILD_DLL + + IDL_Files { + RoundTripEI.idl + } + + Source_Files { + RoundTripEIC.cpp + RoundTrip_exec.cpp + } +} + + + +project (RoundTrip_client) : ciao_client_dnc, valuetype, strategies{ + avoids += ace_for_tao + exename = client + after += RoundTrip_stub + libs += RoundTrip_stub Benchmark_stub + libpaths += .. + + IDL_Files { + } + + Source_Files { + client.cpp + } +} diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTripEI.idl b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTripEI.idl new file mode 100644 index 00000000000..a28de5948d2 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTripEI.idl @@ -0,0 +1,33 @@ +// $Id$ + +//============================================================================= +/** + * @file RoundTripEI.idl + * + * + * @author + */ +//============================================================================= + +#ifndef CIAO_ROUNDTRIPEI_IDL +#define CIAO_ROUNDTRIPEI_IDL + +#include "RoundTripE.idl" + +module Benchmark +{ + /** + * @interface RoundTrip_Exec + * + * The actually Test executor need to support + * Components::SessionComponent interface. Therefore, we need to + * define the component executor interface explicitly here. + */ + local interface RoundTrip_Exec : CCM_RoundTrip, CCM_LatencyTest, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_TESTEI_IDL */ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.cpp b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.cpp new file mode 100644 index 00000000000..07dd8d48095 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.cpp @@ -0,0 +1,151 @@ +// $Id$ + +#include "RoundTrip_exec.h" +#include "CIAO_common.h" + +//-- ACE Scheduling Params +#include "ace/Sched_Params.h" + +#include "ace/OS_NS_errno.h" + +//================================================================= + +void +set_priority () +{ + 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, + "client (%P|%t): user is not superuser, " + "test runs in time-shared class\n")); + } + else + ACE_ERROR ((LM_ERROR, + "client (%P|%t): sched_params failed\n")); + } +} + + + +MyImpl::RoundTrip_exec_i::RoundTrip_exec_i () +{ + +} + +MyImpl::RoundTrip_exec_i::~RoundTrip_exec_i () +{ +} + +::Benchmark::CCM_LatencyTest * +MyImpl::RoundTrip_exec_i::get_latency () + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return ::Benchmark::CCM_LatencyTest::_duplicate (this); +} + +/* Main method that invokes the octet_sequence */ +CORBA::Long +MyImpl::RoundTrip_exec_i::makeCall (CORBA::Long data) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return data * data * data; +} + +// Operations from Components::SessionComponent +void +MyImpl::RoundTrip_exec_i::set_session_context ( + Components::SessionContext_ptr ctx) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::RoundTrip_exec_i::set_session_context\n")); + //cout << "MyImpl::RoundTrip_exec_i::set_session_context\n" << endl; + + this->context_ = + Benchmark::CCM_RoundTrip_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + throw CORBA::INTERNAL (); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::RoundTrip_exec_i::ciao_preactivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::RoundTrip_exec_i::ccm_activate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::RoundTrip_exec_i::ccm_activate\n")); + //cout << "MyImpl::RoundTrip_exec_i::ccm_activate\n"; + + // Starting method! + //set_priority(); +} + +void +MyImpl::RoundTrip_exec_i::ciao_postactivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + +} + +void +MyImpl::RoundTrip_exec_i::ccm_passivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::RoundTrip_exec_i::ccm_passivate\n")); +} + +void +MyImpl::RoundTrip_exec_i::ccm_remove () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::RoundTrip_exec_i::ccm_remove\n")); +} + + +MyImpl::RoundTripHome_exec_i::RoundTripHome_exec_i () +{ +} + +MyImpl::RoundTripHome_exec_i::~RoundTripHome_exec_i () +{ +} + +::Components::EnterpriseComponent_ptr +MyImpl::RoundTripHome_exec_i::create () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::RoundTrip_exec_i; +} + + +extern "C" ROUNDTRIP_EXEC_Export ::Components::HomeExecutorBase_ptr +createRoundTripHome_Impl (void) +{ + //cout << "Creating Round_trip impl" << endl; + return new MyImpl::RoundTripHome_exec_i (); +} diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.h b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.h new file mode 100644 index 00000000000..e2262581bd7 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.h @@ -0,0 +1,121 @@ +// -*- C++ -*- + +//============================================================ +/** + * @file RoundTrip_exec.h + * + * Header file for the Executor implementation. + * + * $Id$ + * + * @author Diego Sevilla <dsevilla@um.es> + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + */ +//============================================================ + +#ifndef ROUNDTRIP_EXEC_H +#define ROUNDTRIP_EXEC_H + +#include "RoundTripEIC.h" +#include "tao/LocalObject.h" +#include "ace/Thread_Manager.h" +#include "ace/Task.h" + +namespace MyImpl +{ + + /** + * @class RoundTrip_exec_i + * + * RoundTrip executor implementation class. + */ + + class ROUNDTRIP_EXEC_Export RoundTrip_exec_i : + public virtual Benchmark::RoundTrip_Exec, + public virtual TAO_Local_RefCounted_Object + { + + public: + /// Default constructor. + RoundTrip_exec_i (); + + /// Operation to test the data + virtual CORBA::Long makeCall (CORBA::Long data) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Benchmark::CCM_LatencyTest* + get_latency () + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + virtual void set_session_context (Components::SessionContext_ptr ctx) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ciao_preactivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_activate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ciao_postactivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_passivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_remove () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + /// Helper function to be called back by timeout_Handler + void pulse (void); + + protected: + + /// Destructor. + ~RoundTrip_exec_i (); + + protected: + /// Copmponent specific context + Benchmark::CCM_RoundTrip_Context_var context_; + + }; + + /** + * @class RoundTripHome_exec_i + * + * RoundTrip home executor implementation class. + */ + class ROUNDTRIP_EXEC_Export RoundTripHome_exec_i : + public virtual Benchmark::CCM_RoundTripHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + RoundTripHome_exec_i (); + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + protected: + + /// Destructor. + ~RoundTripHome_exec_i (); + + }; + +} + +extern "C" ROUNDTRIP_EXEC_Export ::Components::HomeExecutorBase_ptr +createRoundTripHome_Impl (void); + +#endif /* ROUNDTRIP_EXEC_H */ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec_export.h b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec_export.h new file mode 100644 index 00000000000..41abae47f67 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl ROUNDTRIP_EXEC +// ------------------------------ +#ifndef ROUNDTRIP_EXEC_EXPORT_H +#define ROUNDTRIP_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (ROUNDTRIP_EXEC_HAS_DLL) +# define ROUNDTRIP_EXEC_HAS_DLL 1 +#endif /* ! ROUNDTRIP_EXEC_HAS_DLL */ + +#if defined (ROUNDTRIP_EXEC_HAS_DLL) && (ROUNDTRIP_EXEC_HAS_DLL == 1) +# if defined (ROUNDTRIP_EXEC_BUILD_DLL) +# define ROUNDTRIP_EXEC_Export ACE_Proper_Export_Flag +# define ROUNDTRIP_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIP_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ROUNDTRIP_EXEC_BUILD_DLL */ +# define ROUNDTRIP_EXEC_Export ACE_Proper_Import_Flag +# define ROUNDTRIP_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIP_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ROUNDTRIP_EXEC_BUILD_DLL */ +#else /* ROUNDTRIP_EXEC_HAS_DLL == 1 */ +# define ROUNDTRIP_EXEC_Export +# define ROUNDTRIP_EXEC_SINGLETON_DECLARATION(T) +# define ROUNDTRIP_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ROUNDTRIP_EXEC_HAS_DLL == 1 */ + +// Set ROUNDTRIP_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ROUNDTRIP_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define ROUNDTRIP_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ROUNDTRIP_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ROUNDTRIP_EXEC_NTRACE */ + +#if (ROUNDTRIP_EXEC_NTRACE == 1) +# define ROUNDTRIP_EXEC_TRACE(X) +#else /* (ROUNDTRIP_EXEC_NTRACE == 1) */ +# define ROUNDTRIP_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (ROUNDTRIP_EXEC_NTRACE == 1) */ + +#endif /* ROUNDTRIP_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_stub_export.h b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_stub_export.h new file mode 100644 index 00000000000..3300c0a8b9d --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl ROUNDTRIP_STUB +// ------------------------------ +#ifndef ROUNDTRIP_STUB_EXPORT_H +#define ROUNDTRIP_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (ROUNDTRIP_STUB_HAS_DLL) +# define ROUNDTRIP_STUB_HAS_DLL 1 +#endif /* ! ROUNDTRIP_STUB_HAS_DLL */ + +#if defined (ROUNDTRIP_STUB_HAS_DLL) && (ROUNDTRIP_STUB_HAS_DLL == 1) +# if defined (ROUNDTRIP_STUB_BUILD_DLL) +# define ROUNDTRIP_STUB_Export ACE_Proper_Export_Flag +# define ROUNDTRIP_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIP_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ROUNDTRIP_STUB_BUILD_DLL */ +# define ROUNDTRIP_STUB_Export ACE_Proper_Import_Flag +# define ROUNDTRIP_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIP_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ROUNDTRIP_STUB_BUILD_DLL */ +#else /* ROUNDTRIP_STUB_HAS_DLL == 1 */ +# define ROUNDTRIP_STUB_Export +# define ROUNDTRIP_STUB_SINGLETON_DECLARATION(T) +# define ROUNDTRIP_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ROUNDTRIP_STUB_HAS_DLL == 1 */ + +// Set ROUNDTRIP_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ROUNDTRIP_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define ROUNDTRIP_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ROUNDTRIP_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ROUNDTRIP_STUB_NTRACE */ + +#if (ROUNDTRIP_STUB_NTRACE == 1) +# define ROUNDTRIP_STUB_TRACE(X) +#else /* (ROUNDTRIP_STUB_NTRACE == 1) */ +# define ROUNDTRIP_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (ROUNDTRIP_STUB_NTRACE == 1) */ + +#endif /* ROUNDTRIP_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_svnt_export.h b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_svnt_export.h new file mode 100644 index 00000000000..9db7ca9eaa3 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl ROUNDTRIP_SVNT +// ------------------------------ +#ifndef ROUNDTRIP_SVNT_EXPORT_H +#define ROUNDTRIP_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (ROUNDTRIP_SVNT_HAS_DLL) +# define ROUNDTRIP_SVNT_HAS_DLL 1 +#endif /* ! ROUNDTRIP_SVNT_HAS_DLL */ + +#if defined (ROUNDTRIP_SVNT_HAS_DLL) && (ROUNDTRIP_SVNT_HAS_DLL == 1) +# if defined (ROUNDTRIP_SVNT_BUILD_DLL) +# define ROUNDTRIP_SVNT_Export ACE_Proper_Export_Flag +# define ROUNDTRIP_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIP_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ROUNDTRIP_SVNT_BUILD_DLL */ +# define ROUNDTRIP_SVNT_Export ACE_Proper_Import_Flag +# define ROUNDTRIP_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIP_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ROUNDTRIP_SVNT_BUILD_DLL */ +#else /* ROUNDTRIP_SVNT_HAS_DLL == 1 */ +# define ROUNDTRIP_SVNT_Export +# define ROUNDTRIP_SVNT_SINGLETON_DECLARATION(T) +# define ROUNDTRIP_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ROUNDTRIP_SVNT_HAS_DLL == 1 */ + +// Set ROUNDTRIP_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ROUNDTRIP_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define ROUNDTRIP_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ROUNDTRIP_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ROUNDTRIP_SVNT_NTRACE */ + +#if (ROUNDTRIP_SVNT_NTRACE == 1) +# define ROUNDTRIP_SVNT_TRACE(X) +#else /* (ROUNDTRIP_SVNT_NTRACE == 1) */ +# define ROUNDTRIP_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (ROUNDTRIP_SVNT_NTRACE == 1) */ + +#endif /* ROUNDTRIP_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/client.cpp b/modules/CIAO/performance-tests/Benchmark/RoundTrip/client.cpp new file mode 100644 index 00000000000..9de1cb46a2d --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/client.cpp @@ -0,0 +1,174 @@ +// $Id$ + +//============================================================== +/** + * @file client.cpp + * + * This is a simple client test program that interact with the RoundTrip + * component implementation. The single threaded client issues + * two-way operations, the total latency (response time) is measured + * NOTE: this client implementation has been adapted from the + * $TAO_ROOT/performance-results/Latency/Single_Threaded/ + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + */ +//============================================================== +#include "RoundTripC.h" +#include "tao/Strategies/advanced_resource.h" +#include "ace/Get_Opt.h" +#include "ace/High_Res_Timer.h" +#include "ace/Sched_Params.h" +#include "ace/Stats.h" +#include "ace/Sample_History.h" +#include "ace/OS_NS_errno.h" + +const char *ior = "file://test.ior"; +int niterations = 100; +int do_dump_history = 0; + +int +parse_args (int argc, char *argv[]) +{ + //parse arguments + ACE_Get_Opt get_opts (argc, argv, "hxk:i:"); + char c; + while ((c = get_opts ()) != -1) + switch (c) + { + case 'h': + do_dump_history = 1; + break; + + case 'k': + ior = get_opts.opt_arg (); + break; + + case 'i': + niterations = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case '?': + default: + /* Could be any other parameter like -ORBSvcConf file so ignore */ + break; + } + // Indicates sucessful parsing of the command line + return 0; +} + +void +set_priority () +{ + 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, + "client (%P|%t): user is not superuser, " + "test runs in time-shared class\n")); + } + else + ACE_ERROR ((LM_ERROR, + "client (%P|%t): sched_params failed\n")); + } + +} + + +int +main (int argc, char *argv[]) +{ + try + { + //set priority on the platform + set_priority(); + + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv, + ""); + + if (parse_args(argc, argv) == -1) + { + ACE_DEBUG ((LM_DEBUG, "Error parsing Arguments\n")); + return -1; + } + + // Resolve HomeFinder interface + CORBA::Object_var obj + = orb->string_to_object (ior); + + Benchmark::RoundTripHome_var home + = Benchmark::RoundTripHome::_narrow (obj.in ()); + + if (CORBA::is_nil (home.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire TestHome objref\n"), -1); + + Benchmark::RoundTrip_var test + = home->create (); + + //Get the RoundTrip reference + Benchmark::LatencyTest_var round_trip = test->provide_latency (); + + //Warmup the System by making some empty calls + long start = 0L; + for (int j = 0; j < 100; ++j) + { + round_trip->makeCall (start); + } + + ///// Start Test //////////////////////////////////////////// + ACE_Sample_History history (niterations); + + ACE_hrtime_t test_start = ACE_OS::gethrtime (); + for (int i = 0; i < niterations; ++i) + { + ACE_hrtime_t start = ACE_OS::gethrtime (); + + //Test value to be sent to the server + long test = 0; + + (void) round_trip->makeCall (test); + + ACE_hrtime_t now = ACE_OS::gethrtime (); + history.sample (now - start); + } + + ACE_hrtime_t test_end = ACE_OS::gethrtime (); + + ACE_DEBUG ((LM_DEBUG, "test finished\n")); + + ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + ACE_DEBUG ((LM_DEBUG, "done\n")); + + if (do_dump_history) + { + history.dump_samples ("HISTORY", gsf); + } + + ACE_Basic_Stats stats; + history.collect_basic_stats (stats); + stats.dump_results ("Total", gsf); + + ACE_Throughput_Stats::dump_throughput ("Total", gsf, + test_end - test_start, + stats.samples_count ()); + + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception Handled:"); + return 1; + } + + + return 0; +} diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/run_test.pl b/modules/CIAO/performance-tests/Benchmark/RoundTrip/run_test.pl new file mode 100755 index 00000000000..584351da998 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/run_test.pl @@ -0,0 +1,115 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +# +# @@ Run this script from ../descriptors/ instead. +# + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$status = 0; +$daemon_ior = PerlACE::LocalFile ("daemon.ior"); +$svr_ior = PerlACE::LocalFile ("server.ior"); +$home_ior = PerlACE::LocalFile ("test.ior"); + +$ACE_ROOT=$ENV{'ACE_ROOT'}; +$CIAO_ROOT=$ENV{'CIAO_ROOT'}; + +unlink $daemon_ior; +unlink $svr_ior; +unlink $home_ior; + +# CIAO Daemon command line arguments +$daemon_args = "-c ../RoundTrip/svc.conf -o $daemon_ior -i CIAO_Installation_Data.ini -n $CIAO_ROOT/tools/ComponentServer/ComponentServer"; + +# CIAO Daemon Controller location: +$controller = "$CIAO_ROOT/tools/Daemon/DaemonController"; + +# Daemon controller common command line arguments +$common_args = "-ORBInitRef CIAODaemon=file://$daemon_ior"; + +# Daemon controller start_home command +$start_args = "start_home -s RoundTrip.csd -m $home_ior -c $svr_ior"; + +# Daemon controller end_home command +$end_args = "end_home -c file://$svr_ior"; + +# Daemon controller shutdown command +$shutdown_args = "shutdown"; + +# Client program command line arguments +$cl_args = "-ORBSvcConf ../RoundTrip/svc.conf -i 300000"; + +# CIAO daemon process definition +$DS = new PerlACE::Process ("$CIAO_ROOT/tools/Daemon/CIAO_Daemon", + "$daemon_args"); + +# Client process definition +$CL = new PerlACE::Process ("../RoundTrip/client", + $cl_args); + +## Starting up the CIAO daemon +$DS->Spawn (); +if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) { + print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n"; + $DS->Kill (); + exit 1; +} + +## Starting up a ComponentServer running the Roundtrip home. +$DC = new PerlACE::Process ("$controller", + "$common_args $start_args"); + +$DC->SpawnWaitKill (60); +if (PerlACE::waitforfile_timed ($home_ior, 15) == -1) { + print STDERR "ERROR: Could not find home ior file <$home_ior>\n"; + $DS->Kill (); + exit 1; +} + +$client = $CL->SpawnWaitKill (60); + +if ($client != 0) { + print STDERR "ERROR: client returned $client\n"; + $status = 1; +} + +## Terminating the ComponentServer running. +$DC = new PerlACE::Process ("$controller", + "$common_args $end_args"); + +$ctrl = $DC->SpawnWaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: Fail to end component server\n"; + $DC->Kill (); + exit 1; +} + +## Terminating the ComponentServer running the RateGen home. +$DC = new PerlACE::Process ("$controller", + "$common_args $shutdown_args"); + +$ctrl = $DC->SpawnWaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: Fail to shutdown CIAODaemon\n"; + $DS->Kill (); + exit 1; +} + +$ctrl = $DS->WaitKill (60); +if ($ctrl != 0) { + print STDERR "ERROR: CIAODaemon didn't shutdown gracefully $ctrl\n"; + $DS->Kill (); + exit 1; +} + +unlink $daemon_ior; +unlink $svr_ior; +unlink $home_ior; + +exit $status; diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTrip/svc.conf b/modules/CIAO/performance-tests/Benchmark/RoundTrip/svc.conf new file mode 100644 index 00000000000..e1706aae4e5 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTrip/svc.conf @@ -0,0 +1,6 @@ +# +# $Id$ +# +dynamic Advanced_Resource_Factory Service_Object * TAO_Strategies:_make_TAO_Advanced_Resource_Factory () "-ORBReactorMaskSignals 0 -ORBInputCDRAllocator null -ORBReactorType select_st -ORBConnectionCacheLock null" +static Server_Strategy_Factory "-ORBPOALock null -ORBAllowReactivationOfSystemids 0" +static Client_Strategy_Factory "-ORBTransportMuxStrategy EXCLUSIVE -ORBProfileLock null -ORBClientConnectionHandler RW" diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient.cidl b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient.cidl new file mode 100644 index 00000000000..febcbed08df --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient.cidl @@ -0,0 +1,19 @@ +// $Id$ + +#ifndef ROUNDTRIPCLIENT_CIDL +#define ROUNDTRIPCLIENT_CIDL + +#include "RoundTripClient.idl" + +composition session RoundTripClient_Impl +{ + + home executor RoundTripClientHome_Exec + { + implements Benchmark::RoundTripClientHome; + manages RoundTripClient_Exec; + }; + +}; + +#endif /* ROUNDTRIPCLIENT_CIDL */ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient.idl b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient.idl new file mode 100644 index 00000000000..3f891ce00d3 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient.idl @@ -0,0 +1,30 @@ +// $Id$ +//============================================================================= +/** + * @file RoundTripClient.idl + * + * Definition of the Component that uses the LatencyTest interface + * provided by RoundTrip component + */ +//============================================================================= + +#ifndef CIAO_ROUNDTRIPCLIENT_IDL +#define CIAO_ROUNDTRIPCLIENT_IDL + +#include <Components.idl> +#include "../Benchmark.idl" + +module Benchmark +{ + component RoundTripClient + { + uses LatencyTest latency; + provides Controller controller; + }; + + home RoundTripClientHome manages RoundTripClient + { + }; +}; + +#endif /* CIAO_ROUNDTRIPCLIENT_IDL*/ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient.mpc b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient.mpc new file mode 100644 index 00000000000..6ccc38cc06b --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient.mpc @@ -0,0 +1,109 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p Benchmark -i -c RoundTripClient" + +project(RoundTripClient_stub): ciao_client_dnc { + avoids += ace_for_tao + after += Benchmark_stub + sharedname = RoundTripClient_stub + + libs += Benchmark_stub + + idlflags += -Wb,stub_export_macro=ROUNDTRIPCLIENT_STUB_Export + idlflags += -Wb,stub_export_include=RoundTripClient_stub_export.h + idlflags += -Wb,skel_export_macro=ROUNDTRIPCLIENT_SVNT_Export + idlflags += -Wb,skel_export_include=RoundTripClient_svnt_export.h + + dynamicflags = ROUNDTRIPCLIENT_STUB_BUILD_DLL + + IDL_Files { + RoundTripClient.idl + } + + Source_Files { + RoundTripClientC.cpp + } +} + +project(RoundTripClient_svnt) : ciao_servant_dnc { + avoids += ace_for_tao + after += Benchmark_svnt RoundTripClient_stub + sharedname = RoundTripClient_svnt + libs += RoundTripClient_stub Benchmark_stub Benchmark_svnt + libpaths += .. + + idlflags += -Wb,export_macro=ROUNDTRIPCLIENT_SVNT_Export + idlflags +=-Wb,export_include=RoundTripClient_svnt_export.h + + dynamicflags = ROUNDTRIPCLIENT_SVNT_BUILD_DLL + + CIDL_Files { + RoundTripClient.cidl + } + + IDL_Files { + RoundTripClientE.idl + } + + Source_Files { + RoundTripClientEC.cpp + RoundTripClientS.cpp + RoundTripClient_svnt.cpp + } +} + + +project(RoundTripClient_exec) : ciao_component_dnc { + avoids += ace_for_tao + after += RoundTripClient_svnt + + sharedname = RoundTripClient_exec + + libs += RoundTripClient_stub Benchmark_stub Benchmark_svnt RoundTripClient_svnt + + libpaths += .. + + idlflags += -Wb,export_macro=ROUNDTRIPCLIENT_EXEC_Export + idlflags += -Wb,export_include=RoundTripClient_exec_export.h + + dynamicflags = ROUNDTRIPCLIENT_EXEC_BUILD_DLL + + IDL_Files { + RoundTripClientEI.idl + } + + Source_Files { + RoundTripClientEIC.cpp + RoundTripClient_exec.cpp + } +} + + +project (*client) : ciao_client_dnc { + avoids += ace_for_tao + exename = client + after += RoundTripClient_stub + libs += RoundTripClient_stub Benchmark_stub + libpaths += .. + + IDL_Files { + } + + Source_Files { + client.cpp + } +} + + +//project (RoundTripClient_controller) : ciao_client_dnc { +// exename = controller +// after += RoundTripClient_stub +// libs += RoundTripClient_stub Benchmark_stub +// libpaths += .. +// +// IDL_Files { +// } +// +// Source_Files { +// controller.cpp +// } +//} diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClientEI.idl b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClientEI.idl new file mode 100644 index 00000000000..d9009c56e8a --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClientEI.idl @@ -0,0 +1,34 @@ +// $Id$ + +//============================================================================= +/** + * @file RoundTripClientEI.idl + * + * + * @author + */ +//============================================================================= + +#ifndef CIAO_ROUNDTRIPCLIENTEI_IDL +#define CIAO_ROUNDTRIPCLIENTEI_IDL + +#include "RoundTripClientE.idl" + +module Benchmark +{ + /** + * @interface RoundTripClient_Exec + * + * The actually Test executor need to support + * Components::SessionComponent interface. Therefore, we need to + * define the component executor interface explicitly here. + */ + local interface RoundTripClient_Exec : CCM_RoundTripClient, + Components::SessionComponent, + CCM_Controller //Monolithic + { + }; + +}; + +#endif /* CIAO_ROUNDTRIPCLIENTEI_IDL */ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec.cpp b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec.cpp new file mode 100644 index 00000000000..ab8ede89b50 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec.cpp @@ -0,0 +1,183 @@ +// $Id$ + +#include "ace/Stats.h" +#include "ace/Sample_History.h" +#include "ace/High_Res_Timer.h" +#include "CIAO_common.h" +#include "ace/Env_Value_T.h" + +#include "RoundTripClient_exec.h" + +const int niterations = 100000; //Default no of iterations +//================================================================= + +MyImpl::RoundTripClient_exec_i::RoundTripClient_exec_i () +{ + +} + +MyImpl::RoundTripClient_exec_i::~RoundTripClient_exec_i () +{ +} + +// Operations from Components::SessionComponent +void +MyImpl::RoundTripClient_exec_i::set_session_context ( + Components::SessionContext_ptr ctx) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + "MyImpl::RoundTripClient_exec_i::set_session_context\n")); + + //Since this is in collocated mode; The server-component will change the + //scheduling strategy to real-time scheduling + + this->context_ = + Benchmark::CCM_RoundTripClient_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + throw CORBA::INTERNAL (); + + // Urm, we actually discard exceptions thrown from this operation. +} + +//Start the collocated test here +void +MyImpl::RoundTripClient_exec_i::ciao_preactivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::RoundTripClient_exec_i::ccm_activate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::RoundTripClient_exec_i::ccm_activate\n")); +} + +void +MyImpl::RoundTripClient_exec_i::ciao_postactivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::RoundTripClient_exec_i::start () + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ///////////// Start test ///////////////////////////////////////// + + // Let's try to start tests from here... + Benchmark::LatencyTest_var lt = + context_->get_connection_latency (); + + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + "MyImpl::RoundTripClient_exec::start obtain obj ref\n")); + + CORBA::Long test_data = 0L; + + //Warm up the system + int i = 0; + for (i=0; i < 100; i++) + lt->makeCall (test_data); + + ACE_DEBUG ((LM_DEBUG, "MyImpl::start: warmed up the system\n")); + + ACE_Sample_History history (niterations); + + ACE_hrtime_t test_start = ACE_OS::gethrtime (); + for (i = 0; i < niterations; ++i) + { + ACE_hrtime_t start = ACE_OS::gethrtime (); + + //Test value to be sent to the server + long test = 0; + + (void) lt->makeCall (test); + + ACE_hrtime_t now = ACE_OS::gethrtime (); + history.sample (now - start); + } + + ACE_hrtime_t test_end = ACE_OS::gethrtime (); + + ACE_DEBUG ((LM_DEBUG, "test finished\n")); + + ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + ACE_DEBUG ((LM_DEBUG, "done\n")); + + ACE_Env_Value<int> envar ("CIAO_DUMP_SAMPLE_HISTORY", 0); + if (envar != 0) + { + history.dump_samples ("HISTORY", gsf); + } + + ACE_Basic_Stats stats; + history.collect_basic_stats (stats); + stats.dump_results ("Total", gsf); + + ACE_Throughput_Stats::dump_throughput ("Total", gsf, + test_end - test_start, + stats.samples_count ()); + +} + +::Benchmark::CCM_Controller_ptr +MyImpl::RoundTripClient_exec_i::get_controller () + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return ::Benchmark::CCM_Controller::_duplicate (this); +} + + +void +MyImpl::RoundTripClient_exec_i::ccm_passivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::RoundTripClient_exec_i::ccm_passivate\n")); +} + +void +MyImpl::RoundTripClient_exec_i::ccm_remove () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::RoundTripClient_exec_i::ccm_remove\n")); +} + + +MyImpl::RoundTripClientHome_exec_i::RoundTripClientHome_exec_i () +{ +} + +MyImpl::RoundTripClientHome_exec_i::~RoundTripClientHome_exec_i () +{ +} + +::Components::EnterpriseComponent_ptr +MyImpl::RoundTripClientHome_exec_i::create () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::RoundTripClient_exec_i; +} + + +extern "C" ROUNDTRIPCLIENT_EXEC_Export ::Components::HomeExecutorBase_ptr +createRoundTripClientHome_Impl (void) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "Creating RoundTrip_client impl \n")); + return new MyImpl::RoundTripClientHome_exec_i (); +} diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec.h b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec.h new file mode 100644 index 00000000000..127684294f4 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec.h @@ -0,0 +1,110 @@ +// $Id$ + +//============================================================ +/** + * @file RoundTripClient_exec.h + * + * Header file for the Executor implementation. + * + * @author Diego <dsevilla@um.es> + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + */ +//============================================================ + +#ifndef BENCHMARK_ROUNDTRIPCLIENT_EXEC_H +#define BENCHMARK_ROUNDTRIPCLIENT_EXEC_H + +#include "RoundTripClientEIC.h" +#include "tao/LocalObject.h" + + +namespace MyImpl +{ + + /** + * @class RoundTripClient_exec_i + * + * RoundTripClient executor implementation class. + */ + + class ROUNDTRIPCLIENT_EXEC_Export RoundTripClient_exec_i : + public virtual Benchmark::RoundTripClient_Exec, + public virtual TAO_Local_RefCounted_Object + { + + public: + /// Default constructor. + RoundTripClient_exec_i (); + + /// Default destructor. + ~RoundTripClient_exec_i (); + + // Operations from Components::SessionComponent + virtual void set_session_context (Components::SessionContext_ptr ctx) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ciao_preactivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_activate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ciao_postactivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_passivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_remove () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual ::Benchmark::CCM_Controller_ptr + get_controller () + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void start () + ACE_THROW_SPEC ((CORBA::SystemException)); + + + protected: + /// Copmponent specific context + Benchmark::CCM_RoundTripClient_Context_var context_; + + }; + + /** + * @class RoundTripClientHome_exec_i + * + * RoundTripClient home executor implementation class. + */ + class ROUNDTRIPCLIENT_EXEC_Export RoundTripClientHome_exec_i : + public virtual Benchmark::CCM_RoundTripClientHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + RoundTripClientHome_exec_i (); + + /// Default dtor. + ~RoundTripClientHome_exec_i (); + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +extern "C" ROUNDTRIPCLIENT_EXEC_Export ::Components::HomeExecutorBase_ptr +createRoundTripClientHome_Impl (void); + +#endif /* CIAO_ROUNDTRIPCLIENTGEN_EXEC_H */ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec_export.h b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec_export.h new file mode 100644 index 00000000000..4a9827a8cbc --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl ROUNDTRIPCLIENT_EXEC +// ------------------------------ +#ifndef ROUNDTRIPCLIENT_EXEC_EXPORT_H +#define ROUNDTRIPCLIENT_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (ROUNDTRIPCLIENT_EXEC_HAS_DLL) +# define ROUNDTRIPCLIENT_EXEC_HAS_DLL 1 +#endif /* ! ROUNDTRIPCLIENT_EXEC_HAS_DLL */ + +#if defined (ROUNDTRIPCLIENT_EXEC_HAS_DLL) && (ROUNDTRIPCLIENT_EXEC_HAS_DLL == 1) +# if defined (ROUNDTRIPCLIENT_EXEC_BUILD_DLL) +# define ROUNDTRIPCLIENT_EXEC_Export ACE_Proper_Export_Flag +# define ROUNDTRIPCLIENT_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIPCLIENT_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ROUNDTRIPCLIENT_EXEC_BUILD_DLL */ +# define ROUNDTRIPCLIENT_EXEC_Export ACE_Proper_Import_Flag +# define ROUNDTRIPCLIENT_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIPCLIENT_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ROUNDTRIPCLIENT_EXEC_BUILD_DLL */ +#else /* ROUNDTRIPCLIENT_EXEC_HAS_DLL == 1 */ +# define ROUNDTRIPCLIENT_EXEC_Export +# define ROUNDTRIPCLIENT_EXEC_SINGLETON_DECLARATION(T) +# define ROUNDTRIPCLIENT_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ROUNDTRIPCLIENT_EXEC_HAS_DLL == 1 */ + +// Set ROUNDTRIPCLIENT_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ROUNDTRIPCLIENT_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define ROUNDTRIPCLIENT_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ROUNDTRIPCLIENT_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ROUNDTRIPCLIENT_EXEC_NTRACE */ + +#if (ROUNDTRIPCLIENT_EXEC_NTRACE == 1) +# define ROUNDTRIPCLIENT_EXEC_TRACE(X) +#else /* (ROUNDTRIPCLIENT_EXEC_NTRACE == 1) */ +# define ROUNDTRIPCLIENT_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (ROUNDTRIPCLIENT_EXEC_NTRACE == 1) */ + +#endif /* ROUNDTRIPCLIENT_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_stub_export.h b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_stub_export.h new file mode 100644 index 00000000000..1020507fdff --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_stub_export.h @@ -0,0 +1,49 @@ +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl ROUNDTRIPCLIENT_STUB +// ------------------------------ +#ifndef ROUNDTRIPCLIENT_STUB_EXPORT_H +#define ROUNDTRIPCLIENT_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (ROUNDTRIPCLIENT_STUB_HAS_DLL) +# define ROUNDTRIPCLIENT_STUB_HAS_DLL 1 +#endif /* ! ROUNDTRIPCLIENT_STUB_HAS_DLL */ + +#if defined (ROUNDTRIPCLIENT_STUB_HAS_DLL) && (ROUNDTRIPCLIENT_STUB_HAS_DLL == 1) +# if defined (ROUNDTRIPCLIENT_STUB_BUILD_DLL) +# define ROUNDTRIPCLIENT_STUB_Export ACE_Proper_Export_Flag +# define ROUNDTRIPCLIENT_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIPCLIENT_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ROUNDTRIPCLIENT_STUB_BUILD_DLL */ +# define ROUNDTRIPCLIENT_STUB_Export ACE_Proper_Import_Flag +# define ROUNDTRIPCLIENT_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIPCLIENT_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ROUNDTRIPCLIENT_STUB_BUILD_DLL */ +#else /* ROUNDTRIPCLIENT_STUB_HAS_DLL == 1 */ +# define ROUNDTRIPCLIENT_STUB_Export +# define ROUNDTRIPCLIENT_STUB_SINGLETON_DECLARATION(T) +# define ROUNDTRIPCLIENT_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ROUNDTRIPCLIENT_STUB_HAS_DLL == 1 */ + +// Set ROUNDTRIPCLIENT_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ROUNDTRIPCLIENT_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define ROUNDTRIPCLIENT_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ROUNDTRIPCLIENT_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ROUNDTRIPCLIENT_STUB_NTRACE */ + +#if (ROUNDTRIPCLIENT_STUB_NTRACE == 1) +# define ROUNDTRIPCLIENT_STUB_TRACE(X) +#else /* (ROUNDTRIPCLIENT_STUB_NTRACE == 1) */ +# define ROUNDTRIPCLIENT_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (ROUNDTRIPCLIENT_STUB_NTRACE == 1) */ + +#endif /* ROUNDTRIPCLIENT_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_svnt_export.h b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_svnt_export.h new file mode 100644 index 00000000000..a760c548604 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_svnt_export.h @@ -0,0 +1,49 @@ +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl ROUNDTRIPCLIENT_SVNT +// ------------------------------ +#ifndef ROUNDTRIPCLIENT_SVNT_EXPORT_H +#define ROUNDTRIPCLIENT_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (ROUNDTRIPCLIENT_SVNT_HAS_DLL) +# define ROUNDTRIPCLIENT_SVNT_HAS_DLL 1 +#endif /* ! ROUNDTRIPCLIENT_SVNT_HAS_DLL */ + +#if defined (ROUNDTRIPCLIENT_SVNT_HAS_DLL) && (ROUNDTRIPCLIENT_SVNT_HAS_DLL == 1) +# if defined (ROUNDTRIPCLIENT_SVNT_BUILD_DLL) +# define ROUNDTRIPCLIENT_SVNT_Export ACE_Proper_Export_Flag +# define ROUNDTRIPCLIENT_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIPCLIENT_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ROUNDTRIPCLIENT_SVNT_BUILD_DLL */ +# define ROUNDTRIPCLIENT_SVNT_Export ACE_Proper_Import_Flag +# define ROUNDTRIPCLIENT_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ROUNDTRIPCLIENT_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ROUNDTRIPCLIENT_SVNT_BUILD_DLL */ +#else /* ROUNDTRIPCLIENT_SVNT_HAS_DLL == 1 */ +# define ROUNDTRIPCLIENT_SVNT_Export +# define ROUNDTRIPCLIENT_SVNT_SINGLETON_DECLARATION(T) +# define ROUNDTRIPCLIENT_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ROUNDTRIPCLIENT_SVNT_HAS_DLL == 1 */ + +// Set ROUNDTRIPCLIENT_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ROUNDTRIPCLIENT_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define ROUNDTRIPCLIENT_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ROUNDTRIPCLIENT_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ROUNDTRIPCLIENT_SVNT_NTRACE */ + +#if (ROUNDTRIPCLIENT_SVNT_NTRACE == 1) +# define ROUNDTRIPCLIENT_SVNT_TRACE(X) +#else /* (ROUNDTRIPCLIENT_SVNT_NTRACE == 1) */ +# define ROUNDTRIPCLIENT_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (ROUNDTRIPCLIENT_SVNT_NTRACE == 1) */ + +#endif /* ROUNDTRIPCLIENT_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/client.cpp b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/client.cpp new file mode 100644 index 00000000000..23b58d9cece --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/client.cpp @@ -0,0 +1,51 @@ +// $Id$ + +//============================================================== +/** + * @file client.cpp + * + * This is a simple client test program that interact with the RoundTrip + * component implementation. The single threaded client issues + * two-way operations, the total latency (response time) is measured + * NOTE: this client implementation has been adapted from the + * $TAO_ROOT/performance-results/Latency/Single_Threaded/ + * + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + */ +//============================================================== +#include "RoundTripClientC.h" + +const char *ior = "file://test.ior"; + +int +main (int argc, char *argv[]) +{ + try + { + + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv, + ""); + + // Resolve HomeFinder interface + CORBA::Object_var obj + = orb->string_to_object (ior); + Benchmark::RoundTripClient_var test = + Benchmark::RoundTripClient::_narrow(obj.in()); + //Get the RoundTrip reference + Benchmark::Controller_var trigger = test->provide_controller (); + + //Send a trigger to start the test + trigger->start(); + + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception Handled:"); + return 1; + } + + + return 0; +} diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/run_test.pl b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/run_test.pl new file mode 100755 index 00000000000..e26d55c1a66 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/run_test.pl @@ -0,0 +1,103 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +# +# @@ Run this script from ../descriptors/ instead. +# + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$status = 0; +$daemon_ior = PerlACE::LocalFile ("daemon.ior"); +$am_ior = PerlACE::LocalFile ("am.ior"); + +$ACE_ROOT=$ENV{'ACE_ROOT'}; +$CIAO_ROOT=$ENV{'CIAO_ROOT'}; + +if ($CIAO_ROOT eq "") { + $CIAO_ROOT="$ACE_ROOT/TAO/CIAO"; +} + +unlink $daemon_ior; +unlink $am_ior; + + +# CIAO Daemon command line arguments +$daemon_args1 = "-ORBEndpoint iiop://localhost:10000 -o $daemon_ior -i CIAO_Installation_Data.ini -n $CIAO_ROOT/tools/ComponentServer/ComponentServer"; + +#CIAO Daemond Remote command line arguments +$daemon_args2 = "-ORBEndpoint iiop://localhost:12000 -o $daemon_ior -i CIAO_Installation_Data.ini -n $CIAO_ROOT/tools/ComponentServer/ComponentServer"; + +$assembly_manager_args = "-o $am_ior -c test.dat"; + +$ad_args = " -k file://$am_ior -a RoundTripClient.cad"; + +# CIAO daemon process definition +$DS = new PerlACE::Process ("$CIAO_ROOT/tools/Daemon/CIAO_Daemon", + "$daemon_args1"); + +## Starting up the CIAO daemon +$DS->Spawn (); +if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) { + print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n"; + $DS->Kill (); + exit 1; +} + +# CIAO daemon process definition +$DS2 = new PerlACE::Process ("$CIAO_ROOT/tools/Daemon/CIAO_Daemon", + "$daemon_args2"); + +## Starting up the CIAO daemon +$DS2->Spawn (); +if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) { + print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n"; + $DS->Kill (); + exit 1; +} + +$AM = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Manager", + $assembly_manager_args); +$AM->Spawn (); +if (PerlACE::waitforfile_timed ($am_ior, 15) == -1) { + print STDERR "ERROR: Could not find assembly ior file <$am_ior>\n"; + $AM->Kill (); + exit 1; +} + +$AD = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Deployer", + $ad_args); +$AD->Spawn (); + +sleep (5); + +#Start the client to send the trigger message +$CL = new PerlACE::Process ("../RoundTripClient/client", ""); +$CL->SpawnWaitKill(60); + +#$ctrl = $DS->WaitKill (5); +#$AM->WaitKill(5); +#$AD->WaitKill(5); + +$AM->Kill (); +$AD->Kill (); +$DS->Kill (); +$DS2->Kill(); + +#if ($ctrl != 0) { +# print STDERR "ERROR: CIAODaemon didn't shutdown gracefully $ctrl\n"; +# $DS->Kill (); +# exit 1; +#} + +$CL->Kill (); + +unlink $daemon_ior; +unlink $am_ior; + +exit $status; diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripClient/run_test_ior_cad.pl b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/run_test_ior_cad.pl new file mode 100755 index 00000000000..bb665cc499a --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/run_test_ior_cad.pl @@ -0,0 +1,78 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +# +# @@ Run this script from ../descriptors/ instead. +# + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$status = 0; +$daemon_ior = PerlACE::LocalFile ("daemon.ior"); +$am_ior = PerlACE::LocalFile ("am.ior"); + +$ACE_ROOT=$ENV{'ACE_ROOT'}; +$CIAO_ROOT=$ENV{'CIAO_ROOT'}; + +if ($CIAO_ROOT eq "") { + $CIAO_ROOT="$ACE_ROOT/TAO/CIAO"; +} + +unlink $daemon_ior; +unlink $am_ior; + + +# CIAO Daemon command line arguments +$daemon_args = "-c $CIAO_ROOT/performance-tests/Benchmark/RoundTrip/svc.conf -ORBEndpoint iiop://localhost:10000 -o $daemon_ior -i CIAO_Installation_Data.ini -n $CIAO_ROOT/tools/ComponentServer/ComponentServer"; + +$assembly_manager_args = "-o $am_ior -c test.dat"; + +$ad_args = " -k file://$am_ior -a Test-IOR.cad"; + +# CIAO daemon process definition +$DS = new PerlACE::Process ("$CIAO_ROOT/tools/Daemon/CIAO_Daemon", + "$daemon_args"); + +## Starting up the CIAO daemon +$DS->Spawn (); +if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) { + print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n"; + $DS->Kill (); + exit 1; +} + + +$AM = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Manager", + $assembly_manager_args); +$AM->Spawn (); +if (PerlACE::waitforfile_timed ($am_ior, 15) == -1) { + print STDERR "ERROR: Could not find assembly ior file <$am_ior>\n"; + $AM->Kill (); + exit 1; +} + +$AD = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Deployer", + $ad_args); +$AD->Spawn (); + +sleep (5); + +#Start the client to send the trigger message +$CL = new PerlACE::Process ("../RoundTripClient/client", ""); +$CL->SpawnWaitKill(60); + +$AM->Kill (); +$AD->Kill (); +$DS->Kill (); +#$CL->Kill (); + +#unlink $daemon_ior; +#unlink $am_ior; +unlink rtserver.ior; + +exit $status; diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripServer/LatencyTest.cpp b/modules/CIAO/performance-tests/Benchmark/RoundTripServer/LatencyTest.cpp new file mode 100644 index 00000000000..a1e3ed4f588 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripServer/LatencyTest.cpp @@ -0,0 +1,28 @@ +// +// $Id$ +// +#include "LatencyTest.h" +#include "CIAO_common.h" + +LatencyTest_Impl::LatencyTest_Impl (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + + +CORBA::Long +LatencyTest_Impl::makeCall (CORBA::Long send_time) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "Sending Time back \n")); + + return send_time; +} + +void +LatencyTest_Impl::shutdown () + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->orb_->shutdown (0); +} diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripServer/LatencyTest.h b/modules/CIAO/performance-tests/Benchmark/RoundTripServer/LatencyTest.h new file mode 100644 index 00000000000..9a13823eefe --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripServer/LatencyTest.h @@ -0,0 +1,42 @@ +// +// $Id$ +// + +#ifndef LATENCYTEST_H +#define LATENCYTEST_H +#include /**/ "ace/pre.h" + +#include "../BenchmarkS.h" + +#if defined (_MSC_VER) +# pragma warning(push) +# pragma warning (disable:4250) +#endif /* _MSC_VER */ + +/// Implement the Test::LatencyTest interface +class LatencyTest_Impl : + public virtual POA_Benchmark::LatencyTest +{ +public: + /// Constructor + LatencyTest_Impl (CORBA::ORB_ptr orb); + + // = The skeleton methods + virtual CORBA::Long makeCall (CORBA::Long send_time) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void shutdown () + ACE_THROW_SPEC ((CORBA::SystemException)); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; +}; + +#if defined(_MSC_VER) +# pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" +#endif /* LATENCYTEST_H */ diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripServer/RoundTripServer.mpc b/modules/CIAO/performance-tests/Benchmark/RoundTripServer/RoundTripServer.mpc new file mode 100644 index 00000000000..35a3dbed71b --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripServer/RoundTripServer.mpc @@ -0,0 +1,14 @@ +// $Id$ +project (RoundTripServer) : strategies, ciao_component_dnc { + after += Benchmark_svnt + libs += Benchmark_stub Benchmark_svnt + libpaths += .. + + IDL_Files { + } + + Source_Files { + server.cpp + LatencyTest.cpp + } +} diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripServer/Test.idl b/modules/CIAO/performance-tests/Benchmark/RoundTripServer/Test.idl new file mode 100644 index 00000000000..b7f83dbedd8 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripServer/Test.idl @@ -0,0 +1,16 @@ +// +// $Id$ +// + +/// Measure roundtrip delay +interface LatencyTest +{ + /// A simple method to measure roundtrip delays + /** + * The operation simply returns its argument, this is used in AMI + * and deferred synchronous tests to measure the roundtrip delay + * without the need for a different reply handler for each + * request. + */ + long makeCall (in long send_time); +}; diff --git a/modules/CIAO/performance-tests/Benchmark/RoundTripServer/server.cpp b/modules/CIAO/performance-tests/Benchmark/RoundTripServer/server.cpp new file mode 100644 index 00000000000..7259a966207 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripServer/server.cpp @@ -0,0 +1,96 @@ +// $Id$ + +#include "LatencyTest.h" +#include "ace/Sched_Params.h" +#include "ace/OS_NS_errno.h" + +#include "tao/Strategies/advanced_resource.h" + +const char *ior_output_file = "rtserver.ior"; + +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; + priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, + priority); + // 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")); + } + + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, ""); + + 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 ()); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + LatencyTest_Impl *roundtrip_impl; + ACE_NEW_RETURN (roundtrip_impl, + LatencyTest_Impl (orb.in ()), + 1); + PortableServer::ServantBase_var owner_transfer(roundtrip_impl); + + Benchmark::LatencyTest_var roundtrip = + roundtrip_impl->_this (); + + CORBA::String_var ior = + orb->object_to_string (roundtrip.in ()); + + // If the ior_output_file exists, output the ior to it + 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); + + ACE_DEBUG ((LM_DEBUG, "%s", ior.in ())); + + poa_manager->activate (); + + orb->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + + root_poa->destroy (1, 1); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/Benchmark.cad b/modules/CIAO/performance-tests/Benchmark/descriptors/Benchmark.cad new file mode 100644 index 00000000000..6ab0dd70aa0 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/Benchmark.cad @@ -0,0 +1,34 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE componentassembly SYSTEM "http://www.dre.vanderbilt.edu/CIAO/DTD/componentassembly.dtd"> + +<componentassembly id="Single-process Basic assembly"> + <componentfiles> + <componentfile id="com-RoundTrip"> + <fileinarchive name="RoundTrip.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_RoundTripHome"> + <componentfileref idref="com-RoundTrip"/> + <componentinstantiation id="a_RoundTrip"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="test.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + </partitioning> + + <!-- + <connections> + </connections> + --> + +</componentassembly> diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/CIAO_Installation_Data.ini b/modules/CIAO/performance-tests/Benchmark/descriptors/CIAO_Installation_Data.ini new file mode 100644 index 00000000000..ffe36ca3422 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/CIAO_Installation_Data.ini @@ -0,0 +1,5 @@ +[ComponentInstallation] +DCE:cf88cb97-b5a8-4522-9fa3-e626c75c5470=RoundTripClient_svnt +DCE:568a3872-f7bb-4b3f-baba-44c6824d966d=RoundTripClient_exec +DCE:2498aa68-09aa-478c-8ae1-30ed67924f82=RoundTrip_exec +DCE:88c14bff-5158-4f48-9b22-8a1120e87f76=RoundTrip_svnt diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/Multi_Threaded.cad b/modules/CIAO/performance-tests/Benchmark/descriptors/Multi_Threaded.cad new file mode 100644 index 00000000000..0c0be0cb71c --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/Multi_Threaded.cad @@ -0,0 +1,112 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE componentassembly SYSTEM "http://www.dre.vanderbilt.edu/CIAO/DTD/componentassembly.dtd"> +<componentassembly id="Multi-client Component Scalability test"> + <componentfiles> + <componentfile id="com-RoundTrip"> + <fileinarchive name="RoundTrip.csd"/> + </componentfile> + <componentfile id="com-RoundTripClient"> + <fileinarchive name="RoundTripClient.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <homeplacement id="a_RoundTripHome"> + <componentfileref idref="com-RoundTrip"/> + <componentinstantiation id="a_RoundTrip"/> + </homeplacement> + + <processcollocation> + <homeplacement id="a_RoundTripClientHome"> + <componentfileref idref="com-RoundTripClient"/> + <componentinstantiation id="a_RoundTripClient"> + <registercomponent> + <writeiortofile name="comp1.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + + <homeplacement id="b_RoundTripClientHome"> + <componentfileref idref="com-RoundTripClient"/> + <componentinstantiation id="b_RoundTripClient"> + <registercomponent> + <writeiortofile name="comp2.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="c_RoundTripClientHome"> + <componentfileref idref="com-RoundTripClient"/> + <componentinstantiation id="c_RoundTripClient"> + <registercomponent> + <writeiortofile name="comp3.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + + <homeplacement id="d_RoundTripClientHome"> + <componentfileref idref="com-RoundTripClient"/> + <componentinstantiation id="d_RoundTripClient"> + <registercomponent> + <writeiortofile name="comp4.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + <destination>Remote</destination> + </processcollocation> + + </partitioning> + + + <connections> + <connectinterface> + <usesport> + <usesidentifier>latency</usesidentifier> + <componentinstantiationref idref="a_RoundTripClient"/> + </usesport> + <providesport> + <providesidentifier>latency</providesidentifier> + <componentinstantiationref idref="a_RoundTrip"/> + </providesport> + </connectinterface> + + <connectinterface> + <usesport> + <usesidentifier>latency</usesidentifier> + <componentinstantiationref idref="b_RoundTripClient"/> + </usesport> + <providesport> + <providesidentifier>latency</providesidentifier> + <componentinstantiationref idref="a_RoundTrip"/> + </providesport> + </connectinterface> + + <connectinterface> + <usesport> + <usesidentifier>latency</usesidentifier> + <componentinstantiationref idref="c_RoundTripClient"/> + </usesport> + <providesport> + <providesidentifier>latency</providesidentifier> + <componentinstantiationref idref="a_RoundTrip"/> + </providesport> + </connectinterface> + + <connectinterface> + <usesport> + <usesidentifier>latency</usesidentifier> + <componentinstantiationref idref="d_RoundTripClient"/> + </usesport> + <providesport> + <providesidentifier>latency</providesidentifier> + <componentinstantiationref idref="a_RoundTrip"/> + </providesport> + </connectinterface> + </connections> +</componentassembly> diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/NOTE.txt b/modules/CIAO/performance-tests/Benchmark/descriptors/NOTE.txt new file mode 100644 index 00000000000..7bcd2fbfade --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/NOTE.txt @@ -0,0 +1,65 @@ +This directory contains various XML descriptors and configuration +files required to run benchmarking experiments using CIAO in +different ways. Let's go over a few important files first: + +test.dat: +--------- + + This file describes the deployment daemons CIAO's Assembly_Manager + will contact to instantiate ComponentServer's, home's, and component + instances. Each line specify the name of a installation + "destination" (I used this to specify <processcollocation> + destination in various *.cad files) and the corresponding IOR for + the CIAO_Daemon. The first entry is the "default" destination the + deployment framework will use. + + For example, test.dat now contains: + + Default corbaloc:iiop:localhost:10000/ServerActivator + Remote corbaloc:iiop:localhost:12000/ServerActivator + + You can copy and modify the copy to deploy the components in various + different locations to let the application truely "distributed". + For example, changing the remote ServerActivator to: + corbaloc:iiop:deuce.doc.wustl.edu:13000/ServerActivator + + Remember to start up the Assembly_Manager in Step 2 using the + revised "test.dat" you created, and start up the CIAO_Daemon's in + Step 1 according to the specification. + +*.cad: +------ + + These files specify how an application should be composed. The + specification includes, where to install a component, what + implementation to use, and how to connect components together. + Currently, we have: + + Benchmark.cad: Plain vanilla assembly descriptor. This file installs + the RoundTrip component on the location given in test.dat. + RoundTripClient.cad : A descriptor file for the client component + RoundTripClient that uses the interface provided by + RoundTrip. + Test-IOR.cad: This cad file should be used to for testing a CORBA server + with a CIAO client. The IOR of the server should added in + this file. + +There are automated perl scripts that can run the tests to generate the +required results. These are located in the individual component directories +Round Trip and RoundTripClient. The descriptors directory has the required +.cad files that specify the component configuration used in the various +experiments. + +To run a simple CORBA component with a normal client: + cd descriptors; + ../Roundtrip/run_test.pl + + cd descritors; + ../RoundTripClient/run_test.pl + Script that runs two components one acts as a client and the other as the + server. Statistics are printed for RoundTrip latency jitter etc + + cd descritors; + ../RoundTripClient/run_test_ior_cad.pl + Script runs a CORBA server and a CIAO component that acts as a client. + Similar statistics are printed. diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTrip.csd b/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTrip.csd new file mode 100644 index 00000000000..ebf8c4e1e15 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTrip.csd @@ -0,0 +1,46 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> + +<!DOCTYPE softpkg SYSTEM "http://www.dre.vanderbilt.edu/CIAO/DTD/softpkg.dtd"> + +<!-- RoundTrip's Software Package Descriptor --> +<!-- This file describes various RoundTrip executor --> +<!-- implementations. --> + +<softpkg name="CIAO-TEST" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>RoundTrip</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.dre.vanderbilt.edu/"/> + </author> + <description>A RoundTrip component.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:Benchmark/RoundTrip:1.0" homeid="IDL:Benchmark/RoundTripHome:1.0"> + <fileinarchive name="RoundTrip.idl"/> + </idl> + <descriptor type="CORBA Component"> + <fileinarchive name="RoundTrip.ccd"/> + </descriptor> + <implementation id="DCE:2498aa68-09aa-478c-8ae1-30ed67924f82"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="RoundTrip.ssd"/> + <implref idref="DCE:88c14bff-5158-4f48-9b22-8a1120e87f76"/> + </softpkgref> + </dependency> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="RoundTrip_exec"/> + <entrypoint>createRoundTripHome_Impl</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTrip.ssd b/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTrip.ssd new file mode 100644 index 00000000000..b9720b9f2f1 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTrip.ssd @@ -0,0 +1,43 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> + +<!DOCTYPE softpkg SYSTEM "http://www.dre.vanderbilt.edu/CIAO/DTD/softpkg.dtd"> + +<!-- RoundTrip's Servant Software Descriptor --> +<!-- This file describes various RoundTrip servant --> +<!-- implementations. --> + +<softpkg name="CIAO-RoundTrip-Servant" version="1.0"> + <pkgtype>CIAO Servant</pkgtype> + <title>Benchmark::RoundTrip Servants</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.dre.vanderbilt.edu/"/> + </author> + <description>Single-Threaded Latency test component for benchmarking.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:Benchmark/RoundTrip:1.0" homeid="IDL:Benchmark/RoundTripHome:1.0"> + <fileinarchive name="RoundTrip.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="RoundTrip.ccd"/> + </descriptor> + + <implementation id="DCE:88c14bff-5158-4f48-9b22-8a1120e87f76"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="RoundTrip_svnt"/> + <entrypoint>createRoundTripHome_Servant</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTripClient.cad b/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTripClient.cad new file mode 100644 index 00000000000..d53416195a2 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTripClient.cad @@ -0,0 +1,49 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE componentassembly SYSTEM "http://www.dre.vanderbilt.edu/CIAO/DTD/componentassembly.dtd"> +<componentassembly id="Collocated Round-Trip test"> + <componentfiles> + <componentfile id="com-RoundTrip"> + <fileinarchive name="RoundTrip.csd"/> + </componentfile> + <componentfile id="com-RoundTripClient"> + <fileinarchive name="RoundTripClient.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + +<homeplacement id="a_RoundTripHome"> + <componentfileref idref="com-RoundTrip"/> + <componentinstantiation id="a_RoundTrip"/> + </homeplacement> + +<homeplacement id="a_RoundTripClientHome"> + <componentfileref idref="com-RoundTripClient"/> + <componentinstantiation id="a_RoundTripClient"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="test.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + + </partitioning> + + <connections> + <connectinterface> + <usesport> + <usesidentifier>latency</usesidentifier> + <componentinstantiationref idref="a_RoundTripClient"/> + </usesport> + <providesport> + <providesidentifier>latency</providesidentifier> + <componentinstantiationref idref="a_RoundTrip"/> + </providesport> + </connectinterface> + </connections> + +</componentassembly> diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTripClient.csd b/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTripClient.csd new file mode 100644 index 00000000000..c52288e3207 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTripClient.csd @@ -0,0 +1,44 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "http://www.dre.vanderbilt.edu/CIAO/DTD/softpkg.dtd"> +<!-- RoundTripClient's Software Package Descriptor --> +<!-- This file describes various RoundTripClient executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-TEST" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>RoundTripClient</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.dre.vanderbilt.edu/"/> + </author> + <description>A RoundTripClient component.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:Benchmark/RoundTripClient:1.0" homeid="IDL:Benchmark/RoundTripClientHome:1.0"> + <fileinarchive name="RoundTripClient.idl"/> + </idl> + <descriptor type="CORBA Component"> + <fileinarchive name="RoundTripClient.ccd"/> + </descriptor> + <implementation id="DCE:568a3872-f7bb-4b3f-baba-44c6824d966d"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="RoundTripClient.ssd"/> + <implref idref="DCE:cf88cb97-b5a8-4522-9fa3-e626c75c5470"/> + </softpkgref> + </dependency> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="RoundTripClient_exec"/> + <entrypoint>createRoundTripClientHome_Impl</entrypoint> + </code> + </implementation> + +</softpkg> diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTripClient.ssd b/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTripClient.ssd new file mode 100644 index 00000000000..86397731ed2 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/RoundTripClient.ssd @@ -0,0 +1,39 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "http://www.dre.vanderbilt.edu/CIAO/DTD/softpkg.dtd"> +<!-- RoundTripClient's Servant Software Descriptor --> +<!-- This file describes various RoundTripClient servant --> +<!-- implementations. --> + +<softpkg name="CIAO-RoundTripClient-Servant" version="1.0"> + <pkgtype>CIAO Servant</pkgtype> + <title>Benchmark::RoundTripClient Servants</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.dre.vanderbilt.edu/"/> + </author> + <description>Single-Threaded Latency test component for benchmarking.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:Benchmark/RoundTripClient:1.0" homeid="IDL:Benchmark/RoundTripClientHome:1.0"> + <fileinarchive name="RoundTripClient.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="RoundTripClient.ccd"/> + </descriptor> + + <implementation id="DCE:cf88cb97-b5a8-4522-9fa3-e626c75c5470"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="RoundTripClient_svnt"/> + <entrypoint>createRoundTripClientHome_Servant</entrypoint> + </code> + </implementation> +</softpkg> diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/Test-IOR.cad b/modules/CIAO/performance-tests/Benchmark/descriptors/Test-IOR.cad new file mode 100644 index 00000000000..a917affec85 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/Test-IOR.cad @@ -0,0 +1,41 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE componentassembly SYSTEM "http://www.dre.vanderbilt.edu/CIAO/DTD/componentassembly.dtd"> + +<componentassembly id="Single-process Basic assembly"> + <componentfiles> + <componentfile id="com-RoundTripClient"> + <fileinarchive name="RoundTripClient.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + <homeplacement id="a_RoundTripClientHome"> + <componentfileref idref="com-RoundTripClient"/> + <componentinstantiation id="a_RoundTripClient"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="test.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + </partitioning> + +<connections> + <connectinterface> + <usesport> + <usesidentifier>latency</usesidentifier> + <componentinstantiationref idref="a_RoundTripClient"/> + </usesport> + <existinginterface> + <findby> + <!-- One needs to add the correct IOR of the server here --> + <stringifiedobjectref>file://rtserver.ior</stringifiedobjectref> + </findby> + </existinginterface> + </connectinterface> +</connections> + +</componentassembly> diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/test-multi-process.dat b/modules/CIAO/performance-tests/Benchmark/descriptors/test-multi-process.dat new file mode 100644 index 00000000000..014fb02c9bc --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/test-multi-process.dat @@ -0,0 +1,5 @@ +Default corbaloc:iiop:localhost:10000/ServerActivator +Remote1 corbaloc:iiop:localhost:12000/ServerActivator +Remote2 corbaloc:iiop:localhost:13000/ServerActivator +Remote3 corbaloc:iiop:localhost:14000/ServerActivator +Remote4 corbaloc:iiop:localhost:15000/ServerActivator diff --git a/modules/CIAO/performance-tests/Benchmark/descriptors/test.dat b/modules/CIAO/performance-tests/Benchmark/descriptors/test.dat new file mode 100644 index 00000000000..d355abc779a --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/descriptors/test.dat @@ -0,0 +1,2 @@ +Default corbaloc:iiop:localhost:10000/ServerActivator +Remote corbaloc:iiop:localhost:12000/ServerActivator diff --git a/modules/CIAO/performance-tests/Benchmark/server.cpp b/modules/CIAO/performance-tests/Benchmark/server.cpp new file mode 100644 index 00000000000..c7f39d42809 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/server.cpp @@ -0,0 +1,89 @@ +// $Id$ + +#include "LatencyTest.h" + +#include "ace/Sched_Params.h" +#include "ace/OS_NS_errno.h" + +#include "tao/Strategies/advanced_resource.h" + +const char *ior_output_file = "test.ior"; + +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; + priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, + priority); + // 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")); + } + + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, ""); + + 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 ()); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + LatencyTest *roundtrip_impl; + ACE_NEW_RETURN (roundtrip_impl, + LatencyTest (orb.in ()), + 1); + PortableServer::ServantBase_var owner_transfer(roundtrip_impl); + + //Get the RoundTrip reference + Benchmark::LatencyTest_var roundtrip = + roundtrip_impl->_this (); + + CORBA::String_var ior = + orb->object_to_string (roundtrip.in ()); + + // If the ior_output_file exists, output the ior to it + ACE_DEBUG ((LM_DEBUG, "%s", ior.in ())); + + poa_manager->activate (); + + orb->run (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + + root_poa->destroy (1, 1); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return 1; + } + + return 0; +} diff --git a/modules/CIAO/performance-tests/Benchmark/svc.conf b/modules/CIAO/performance-tests/Benchmark/svc.conf new file mode 100644 index 00000000000..7b8129f5667 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/svc.conf @@ -0,0 +1,6 @@ +# +# $Id$ +# +static Advanced_Resource_Factory "-ORBReactorMaskSignals 0 -ORBInputCDRAllocator null -ORBReactorType select_st -ORBConnectionCacheLock null" +static Server_Strategy_Factory "-ORBPOALock null -ORBAllowReactivationOfSystemids 0" +static Client_Strategy_Factory "-ORBTransportMuxStrategy EXCLUSIVE -ORBProfileLock null -ORBClientConnectionHandler RW" diff --git a/modules/CIAO/performance-tests/Protocols/Controller/Controller.cpp b/modules/CIAO/performance-tests/Protocols/Controller/Controller.cpp new file mode 100644 index 00000000000..2ea3c57a1c3 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Controller/Controller.cpp @@ -0,0 +1,229 @@ +// $Id$ + +#include "SenderC.h" +#include "ReceiverC.h" +#include "tao/ORB_Constants.h" +#include "ace/Get_Opt.h" +#include "ace/OS_NS_string.h" + + +static const char *sender_ior = "file://sender.ior"; +static const char *distributor_ior = "file://distributor.ior"; +static const char *receiver_ior = "file://receiver.ior"; +static int shutdown_sender = 0; +static int shutdown_distributor = 0; +static int shutdown_receiver = 0; +static CORBA::ULong iterations = 5; +static CORBA::ULong invocation_rate = 5; +static int count_missed_end_deadlines = 0; +static int do_dump_history = 0; +static int print_missed_invocations = 0; +static CORBA::ULong message_size = 100; +static const char *test_protocol = "IIOP"; +static int print_statistics = 1; +static int number_of_connection_attempts = 20; +static int enable_diffserv_code_points = 0; +static int corba_priority = 0; +static const char *test_type = "PACED"; + +static int +parse_args (int argc, char **argv) +{ + ACE_Get_Opt get_opts (argc, argv, "a:b:c:d:e:i:m:p:r:s:t:u:v:w:x:y:z:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'a': + test_type = get_opts.opt_arg (); + break; + + case 'b': + enable_diffserv_code_points = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'c': + corba_priority = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'd': + do_dump_history = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'e': + count_missed_end_deadlines = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'i': + iterations = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'm': + print_missed_invocations = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'p': + test_protocol = get_opts.opt_arg (); + break; + + case 'r': + invocation_rate = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 's': + message_size = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 't': + print_statistics = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'u': + sender_ior = get_opts.opt_arg (); + break; + + case 'v': + distributor_ior = get_opts.opt_arg (); + break; + + case 'w': + receiver_ior = get_opts.opt_arg (); + break; + + case 'x': + shutdown_sender = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'y': + shutdown_distributor = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'z': + shutdown_receiver = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "\t-a <test type> (defaults to %s [valid values are PACED, THROUGHPUT, and LATENCY)\n" + "\t-b <enable diffserv code points> (defaults to %d)\n" + "\t-c <corba priority> (defaults to %d)\n" + "\t-d <show history> (defaults to %d)\n" + "\t-e <count missed end deadlines> (defaults to %d)\n" + "\t-h <help: shows options menu>\n" + "\t-i <iterations> (defaults to %d)\n" + "\t-m <print missed invocations for paced workers> (defaults to %d)\n" + "\t-p <test protocol> (defaults to %s [valid values are IIOP, DIOP, and SCIOP])\n" + "\t-r <invocation rate> (defaults to %d)\n" + "\t-s <message size> (defaults to %d)\n" + "\t-t <print stats> (defaults to %d)\n" + "\t-u <sender ior> (defaults to %s)\n" + "\t-v <distributor ior> (defaults to %s)\n" + "\t-w <receiver ior> (defaults to %s)\n" + "\t-x <shutdown sender> (defaults to %d)\n" + "\t-y <shutdown distributor> (defaults to %d)\n" + "\t-z <shutdown receiver> (defaults to %d)\n" + "\n", + argv[0], + test_type, + enable_diffserv_code_points, + corba_priority, + do_dump_history, + count_missed_end_deadlines, + iterations, + print_missed_invocations, + test_protocol, + invocation_rate, + message_size, + print_statistics, + sender_ior, + distributor_ior, + receiver_ior, + shutdown_sender, + shutdown_distributor, + shutdown_receiver), + -1); + } + + return 0; +} + +int +main (int argc, char *argv[]) +{ + try + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, ""); + + int result = + parse_args (argc, argv); + if (result != 0) + return result; + + CORBA::Object_var object = + orb->string_to_object (sender_ior); + + Protocols::Sender_var sender = + Protocols::Sender::_narrow (object.in ()); + + object = + orb->string_to_object (receiver_ior); + + CORBA::ULong test_protocol_tag = IOP::TAG_INTERNET_IOP; + if (ACE_OS::strcmp (test_protocol, "DIOP") == 0) + test_protocol_tag = TAO_TAG_DIOP_PROFILE; + else if (ACE_OS::strcmp (test_protocol, "SCIOP") == 0) + test_protocol_tag = TAO_TAG_SCIOP_PROFILE; + + Protocols::Sender_Controller::Test_Type test_type_tag = Protocols::Sender_Controller::PACED; + if (ACE_OS::strcmp (test_type, "THROUGHPUT") == 0) + test_type_tag = Protocols::Sender_Controller::THROUGHPUT; + else if (ACE_OS::strcmp (test_type, "LATENCY") == 0) + test_type_tag = Protocols::Sender_Controller::LATENCY; + + sender->start (iterations, + invocation_rate, + count_missed_end_deadlines, + do_dump_history, + print_missed_invocations, + message_size, + test_protocol_tag, + print_statistics, + number_of_connection_attempts, + enable_diffserv_code_points, + corba_priority, + test_type_tag); + + if (shutdown_sender) + sender->shutdown (); + + if (shutdown_distributor) + { + Protocols::Receiver_var distributor = + Protocols::Receiver::_narrow (object.in ()); + + distributor->shutdown (); + } + + if (shutdown_receiver) + { + Protocols::Receiver_var receiver = + Protocols::Receiver::_narrow (object.in ()); + + receiver->shutdown (); + } + + return 0; + } + catch (CORBA::Exception &exception) + { + ACE_ERROR ((LM_ERROR, + "Unexpected exception caught by client: %s (%s)\n", + exception._name (), + exception._rep_id ())); + + return -1; + } +} diff --git a/modules/CIAO/performance-tests/Protocols/Controller/Controller.mpc b/modules/CIAO/performance-tests/Protocols/Controller/Controller.mpc new file mode 100644 index 00000000000..b857bb7481b --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Controller/Controller.mpc @@ -0,0 +1,9 @@ +// $Id$ + +project (perf*) : ciao_client_dnc, rtcorba { + avoids += ace_for_tao + after += Protocols_Sender_stub Protocols_Receiver_stub + includes += ../Sender + includes += ../Receiver + libs += Protocols_Receiver_stub Protocols_Sender_stub Protocols_stub +} diff --git a/modules/CIAO/performance-tests/Protocols/Receiver/Receiver.cidl b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver.cidl new file mode 100644 index 00000000000..c69fc91d864 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver.cidl @@ -0,0 +1,13 @@ +// $Id$ + +#include "Receiver.idl" + +composition session ReceiverImpl +{ + home executor ReceiverHomeExec + { + implements Protocols::ReceiverHome; + manages ReceiverExec; + }; +}; + diff --git a/modules/CIAO/performance-tests/Protocols/Receiver/Receiver.idl b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver.idl new file mode 100644 index 00000000000..ca2ed444513 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver.idl @@ -0,0 +1,21 @@ +// $Id$ + +#include <Components.idl> +#include "../common/Protocols.idl" + +module Protocols +{ + interface Receiver_Controller + { + void shutdown (); + }; + + component Receiver supports Receiver_Controller + { + provides test writer; + }; + + home ReceiverHome manages Receiver + { + }; +}; diff --git a/modules/CIAO/performance-tests/Protocols/Receiver/Receiver.mpc b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver.mpc new file mode 100644 index 00000000000..a87f99d602f --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver.mpc @@ -0,0 +1,81 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Protocols Receiver" + +project(Protocols_Receiver_stub): ciao_client_dnc { + avoids += ace_for_tao + libs += Protocols_stub + after += Protocols_stub + sharedname = Protocols_Receiver_stub + idlflags -= -GT + idlflags += -St \ + -Wb,stub_export_macro=RECEIVER_STUB_Export \ + -Wb,stub_export_include=Receiver_stub_export.h \ + -Wb,skel_export_macro=RECEIVER_SVNT_Export \ + -Wb,skel_export_include=Receiver_svnt_export.h + dynamicflags = RECEIVER_STUB_BUILD_DLL + + IDL_Files { + Receiver.idl + } + + Source_Files { + ReceiverC.cpp + } + + Header_Files { + Receiver_stub_export.h + } +} + +project(Protocols_Receiver_svnt) : ciao_servant_dnc { + avoids += ace_for_tao + after += Protocols_skel Protocols_Receiver_stub + sharedname = Protocols_Receiver_svnt + libs += Protocols_Receiver_stub Protocols_stub Protocols_skel + idlflags -= -GT + idlflags += -SS -St \ + -Wb,export_macro=RECEIVER_SVNT_Export \ + -Wb,export_include=Receiver_svnt_export.h + dynamicflags = RECEIVER_SVNT_BUILD_DLL + + CIDL_Files { + Receiver.cidl + } + + IDL_Files { + ReceiverE.idl + } + + Source_Files { + ReceiverEC.cpp + ReceiverS.cpp + Receiver_svnt.cpp + } + + Header_Files { + Receiver_svnt_export.h + } +} + + +project(Protocols_Receiver_exec) : ciao_component_dnc { + avoids += ace_for_tao + after += Protocols_Receiver_svnt + sharedname = Protocols_Receiver_exec + libs += Protocols_Receiver_stub Protocols_Receiver_svnt Protocols_stub Protocols_skel + dynamicflags = RECEIVER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Receiver_exec.cpp + } + + Header_Files { + Receiver_exec_export.h + } +} + + + diff --git a/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec.cpp b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec.cpp new file mode 100644 index 00000000000..4ca39d6f56d --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec.cpp @@ -0,0 +1,318 @@ +// $Id$ + +#include "Receiver_exec.h" +#include "ace/Stats.h" +#include "tao/debug.h" + +static int do_dump_history = 0; +static int print_missed_invocations = 0; +static ACE_UINT32 gsf = 0; + +namespace CIDL_ReceiverImpl +{ + test_i::test_i (void) + : inter_arrival_times_ (0), + iterations_ (0), + session_id_ (-1) + { + gsf = ACE_High_Res_Timer::global_scale_factor (); + } + + void + test_i::start_test (CORBA::Long session_id, + const char *protocol, + CORBA::ULong invocation_rate, + CORBA::ULong message_size, + CORBA::ULong iterations) + throw (CORBA::SystemException) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + "Session id starts %d\n", + session_id)); + + } + + ACE_DEBUG ((LM_DEBUG, + "Protocol = %5s Invocation Rate = %3d Message Size = %5d Expected Latency = %4d ", + protocol, + invocation_rate, + message_size, + 1000 / invocation_rate)); + + // Remember test parameters. + this->session_id_ = session_id; + this->iterations_ = iterations; + this->number_of_invocations_received_ = 0; + + // + // Initialize counters and tables. + // + this->inter_arrival_times_ = + new ACE_Sample_History (iterations); + + this->first_invocation_ = 1; + + this->invocations_received_.size (iterations); + for (CORBA::ULong i = 0; + i < iterations; + ++i) + this->invocations_received_[i] = 0; + + // Record start time. + this->test_start_ = + ACE_OS::gethrtime (); + } + + void + test_i::end_test (void) + throw (CORBA::SystemException) + { + // Record end time. + this->test_end_ = + ACE_OS::gethrtime (); + + if (do_dump_history) + { + this->inter_arrival_times_->dump_samples ("Inter-arrival times", gsf); + } + + ACE_Basic_Stats stats; + this->inter_arrival_times_->collect_basic_stats (stats); + + ACE_DEBUG ((LM_DEBUG, + "Max Latency = %6d ", + stats.max_ / gsf / 1000)); + + ACE_DEBUG ((LM_DEBUG, + "Invocations expected / received / missed / missed %% = %6d / %6d / %6d / %5.2f\n", + this->iterations_, + this->number_of_invocations_received_, + this->iterations_ - this->number_of_invocations_received_, + (this->iterations_ - this->number_of_invocations_received_) / (double) this->iterations_ * 100)); + + if (print_missed_invocations) + { + ACE_DEBUG ((LM_DEBUG, "\nFollowing invocations were never received:\n")); + + for (CORBA::ULong i = 0; + i < this->iterations_; + ++i) + { + if (this->invocations_received_[i] == 0) + { + ACE_DEBUG ((LM_DEBUG, + "%d ", + i)); + } + } + + ACE_DEBUG ((LM_DEBUG, "\n")); + } + + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + "Session id ends %d\n", + this->session_id_)); + + stats.dump_results ("Inter-arrival times", gsf); + + ACE_Throughput_Stats::dump_throughput ("Inter-arrival times", gsf, + this->test_end_ - this->test_start_, + stats.samples_count ()); + } + + this->session_id_ = -1; + + delete this->inter_arrival_times_; + } + + void + test_i::oneway_sync (void) + throw (CORBA::SystemException) + { + } + + void + test_i::twoway_sync (void) + throw (CORBA::SystemException) + { + } + + void + test_i::oneway_method (CORBA::Long session_id, + CORBA::ULong iteration, + const Protocols::test::octets &payload) + throw (CORBA::SystemException) + { + if (this->session_id_ != session_id) + { + ACE_DEBUG ((LM_DEBUG, + "Late message with iteration id = %d: will not count message\n", + iteration)); + return; + } + + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + "test_i::oneway_method -> session id = %d iteration = %d payload size = %d\n", + session_id, + iteration, + payload.length ())); + } + + this->invocations_received_[iteration] = 1; + ++this->number_of_invocations_received_; + + ACE_hrtime_t time_of_current_call = + ACE_OS::gethrtime (); + + if (this->first_invocation_) + this->first_invocation_ = 0; + else + this->inter_arrival_times_->sample (time_of_current_call - this->time_of_last_call_); + + this->time_of_last_call_ = time_of_current_call; + } + + void + test_i::twoway_method (CORBA::Long &session_id, + CORBA::ULong &iteration, + Protocols::test::octets &payload) + throw (CORBA::SystemException) + { + if (this->session_id_ != session_id) + { + ACE_DEBUG ((LM_DEBUG, + "Late message with iteration id = %d: will not count message\n", + iteration)); + return; + } + + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + "test_i::twoway_method -> session id = %d iteration = %d payload size = %d\n", + session_id, + iteration, + payload.length ())); + } + + this->invocations_received_[iteration] = 1; + ++this->number_of_invocations_received_; + + ACE_hrtime_t time_of_current_call = + ACE_OS::gethrtime (); + + if (this->first_invocation_) + this->first_invocation_ = 0; + else + this->inter_arrival_times_->sample (time_of_current_call - this->time_of_last_call_); + + this->time_of_last_call_ = time_of_current_call; + } + + ReceiverExec_i::ReceiverExec_i (void) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::ReceiverExec_i\n")); + + int argc = 0; + char **argv = 0; + + this->orb_ = + CORBA::ORB_init (argc, + argv, + ""); + + } + + ::Protocols::CCM_test_ptr + ReceiverExec_i::get_writer (void) + throw (CORBA::SystemException) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::get_writer\n")); + return new test_i; + } + + void + ReceiverExec_i::shutdown (void) + throw (CORBA::SystemException) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::shutdown\n")); + this->orb_->shutdown (); + } + + void + ReceiverExec_i::set_session_context (Components::SessionContext_ptr ctx) + throw (CORBA::SystemException, + Components::CCMException) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::set_session_context\n")); + + this->context_ = + ReceiverExec_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + throw CORBA::INTERNAL (); + } + + void + ReceiverExec_i::ccm_activate (void) + throw (CORBA::SystemException, + Components::CCMException) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::ccm_activate\n")); + } + + void + ReceiverExec_i::ccm_passivate (void) + throw (CORBA::SystemException, + Components::CCMException) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::ccm_passivate\n")); + } + + void + ReceiverExec_i::ccm_remove (void) + throw (CORBA::SystemException, + Components::CCMException) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::ccm_remove\n")); + } + + void + ReceiverExec_i::ciao_preactivate (void) + throw (CORBA::SystemException, + Components::CCMException) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::ccm_preactivate\n")); + } + + void + ReceiverExec_i::ciao_postactivate (void) + throw (CORBA::SystemException, + Components::CCMException) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::ccm_postactivate\n")); + } + + ::Components::EnterpriseComponent_ptr + ReceiverHomeExec_i::create (void) + throw (CORBA::SystemException, + Components::CCMException) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverHome_exec::create\n")); + return new ReceiverExec_i; + } + + extern "C" RECEIVER_EXEC_Export ::Components::HomeExecutorBase_ptr + createReceiverHome_Impl (void) + { + ACE_DEBUG ((LM_DEBUG, "createReceiverHome_Impl\n")); + return new ReceiverHomeExec_i; + } +} + diff --git a/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec.h b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec.h new file mode 100644 index 00000000000..20b90f76dac --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec.h @@ -0,0 +1,121 @@ +// $Id$ + +#include "ReceiverEC.h" +#include "Receiver_exec_export.h" +#include "tao/LocalObject.h" +#include "ace/High_Res_Timer.h" +#include "ace/Sample_History.h" +#include "ace/Array.h" + +namespace CIDL_ReceiverImpl +{ + class RECEIVER_EXEC_Export ReceiverExec_i : + public virtual ReceiverExec, + public virtual TAO_Local_RefCounted_Object + { + public: + + ReceiverExec_i (void); + + ::Protocols::CCM_test_ptr get_writer (void) + throw (CORBA::SystemException); + + void shutdown (void) + throw (CORBA::SystemException); + + void set_session_context (Components::SessionContext_ptr ctx) + throw (CORBA::SystemException, + Components::CCMException); + + void ccm_activate (void) + throw (CORBA::SystemException, + Components::CCMException); + + void ccm_passivate (void) + throw (CORBA::SystemException, + Components::CCMException); + + void ccm_remove (void) + throw (CORBA::SystemException, + Components::CCMException); + + void ciao_preactivate (void) + throw (CORBA::SystemException, + Components::CCMException); + + void ciao_postactivate (void) + throw (CORBA::SystemException, + Components::CCMException); + + protected: + + ReceiverExec_Context_var context_; + + CORBA::ORB_var orb_; + + }; + + class RECEIVER_EXEC_Export test_i : + public virtual Protocols::CCM_test, + public virtual TAO_Local_RefCounted_Object + { + public: + + test_i (void); + + void start_test (CORBA::Long session_id, + const char *protocol, + CORBA::ULong invocation_rate, + CORBA::ULong message_size, + CORBA::ULong iterations) + throw (CORBA::SystemException); + + void end_test (void) + throw (CORBA::SystemException); + + void oneway_sync (void) + throw (CORBA::SystemException); + + void twoway_sync (void) + throw (CORBA::SystemException); + + void oneway_method (CORBA::Long session_id, + CORBA::ULong iteration, + const Protocols::test::octets &payload) + throw (CORBA::SystemException); + + void twoway_method (CORBA::Long &session_id, + CORBA::ULong &iteration, + Protocols::test::octets &payload) + throw (CORBA::SystemException); + + private: + typedef ACE_Array_Base<CORBA::Boolean> Invocations; + Invocations invocations_received_; + ACE_hrtime_t time_of_last_call_; + ACE_hrtime_t test_start_; + ACE_hrtime_t test_end_; + CORBA::Boolean first_invocation_; + ACE_Sample_History *inter_arrival_times_; + CORBA::ULong iterations_; + CORBA::ULong number_of_invocations_received_; + CORBA::Long session_id_; + }; + + class RECEIVER_EXEC_Export ReceiverHomeExec_i : + public virtual ReceiverHomeExec, + public virtual TAO_Local_RefCounted_Object + { + public: + + ::Components::EnterpriseComponent_ptr create (void) + throw (CORBA::SystemException, + Components::CCMException); + }; + + extern "C" RECEIVER_EXEC_Export ::Components::HomeExecutorBase_ptr + createReceiverHome_Impl (void); +} + + + diff --git a/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec_export.h b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec_export.h new file mode 100644 index 00000000000..8ad3640d130 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl RECEIVER_EXEC +// ------------------------------ +#ifndef RECEIVER_EXEC_EXPORT_H +#define RECEIVER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (RECEIVER_EXEC_HAS_DLL) +# define RECEIVER_EXEC_HAS_DLL 1 +#endif /* ! RECEIVER_EXEC_HAS_DLL */ + +#if defined (RECEIVER_EXEC_HAS_DLL) && (RECEIVER_EXEC_HAS_DLL == 1) +# if defined (RECEIVER_EXEC_BUILD_DLL) +# define RECEIVER_EXEC_Export ACE_Proper_Export_Flag +# define RECEIVER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define RECEIVER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* RECEIVER_EXEC_BUILD_DLL */ +# define RECEIVER_EXEC_Export ACE_Proper_Import_Flag +# define RECEIVER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define RECEIVER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* RECEIVER_EXEC_BUILD_DLL */ +#else /* RECEIVER_EXEC_HAS_DLL == 1 */ +# define RECEIVER_EXEC_Export +# define RECEIVER_EXEC_SINGLETON_DECLARATION(T) +# define RECEIVER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* RECEIVER_EXEC_HAS_DLL == 1 */ + +// Set RECEIVER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (RECEIVER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define RECEIVER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define RECEIVER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !RECEIVER_EXEC_NTRACE */ + +#if (RECEIVER_EXEC_NTRACE == 1) +# define RECEIVER_EXEC_TRACE(X) +#else /* (RECEIVER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define RECEIVER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (RECEIVER_EXEC_NTRACE == 1) */ + +#endif /* RECEIVER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_stub_export.h b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_stub_export.h new file mode 100644 index 00000000000..c457802854f --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl RECEIVER_STUB +// ------------------------------ +#ifndef RECEIVER_STUB_EXPORT_H +#define RECEIVER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (RECEIVER_STUB_HAS_DLL) +# define RECEIVER_STUB_HAS_DLL 1 +#endif /* ! RECEIVER_STUB_HAS_DLL */ + +#if defined (RECEIVER_STUB_HAS_DLL) && (RECEIVER_STUB_HAS_DLL == 1) +# if defined (RECEIVER_STUB_BUILD_DLL) +# define RECEIVER_STUB_Export ACE_Proper_Export_Flag +# define RECEIVER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define RECEIVER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* RECEIVER_STUB_BUILD_DLL */ +# define RECEIVER_STUB_Export ACE_Proper_Import_Flag +# define RECEIVER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define RECEIVER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* RECEIVER_STUB_BUILD_DLL */ +#else /* RECEIVER_STUB_HAS_DLL == 1 */ +# define RECEIVER_STUB_Export +# define RECEIVER_STUB_SINGLETON_DECLARATION(T) +# define RECEIVER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* RECEIVER_STUB_HAS_DLL == 1 */ + +// Set RECEIVER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (RECEIVER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define RECEIVER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define RECEIVER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !RECEIVER_STUB_NTRACE */ + +#if (RECEIVER_STUB_NTRACE == 1) +# define RECEIVER_STUB_TRACE(X) +#else /* (RECEIVER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define RECEIVER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (RECEIVER_STUB_NTRACE == 1) */ + +#endif /* RECEIVER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_svnt_export.h b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_svnt_export.h new file mode 100644 index 00000000000..1c9eca2556d --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_svnt_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl RECEIVER_SVNT +// ------------------------------ +#ifndef RECEIVER_SVNT_EXPORT_H +#define RECEIVER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (RECEIVER_SVNT_HAS_DLL) +# define RECEIVER_SVNT_HAS_DLL 1 +#endif /* ! RECEIVER_SVNT_HAS_DLL */ + +#if defined (RECEIVER_SVNT_HAS_DLL) && (RECEIVER_SVNT_HAS_DLL == 1) +# if defined (RECEIVER_SVNT_BUILD_DLL) +# define RECEIVER_SVNT_Export ACE_Proper_Export_Flag +# define RECEIVER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define RECEIVER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* RECEIVER_SVNT_BUILD_DLL */ +# define RECEIVER_SVNT_Export ACE_Proper_Import_Flag +# define RECEIVER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define RECEIVER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* RECEIVER_SVNT_BUILD_DLL */ +#else /* RECEIVER_SVNT_HAS_DLL == 1 */ +# define RECEIVER_SVNT_Export +# define RECEIVER_SVNT_SINGLETON_DECLARATION(T) +# define RECEIVER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* RECEIVER_SVNT_HAS_DLL == 1 */ + +// Set RECEIVER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (RECEIVER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define RECEIVER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define RECEIVER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !RECEIVER_SVNT_NTRACE */ + +#if (RECEIVER_SVNT_NTRACE == 1) +# define RECEIVER_SVNT_TRACE(X) +#else /* (RECEIVER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define RECEIVER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (RECEIVER_SVNT_NTRACE == 1) */ + +#endif /* RECEIVER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Protocols/Sender/Sender.cidl b/modules/CIAO/performance-tests/Protocols/Sender/Sender.cidl new file mode 100644 index 00000000000..b5be8747d98 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender.cidl @@ -0,0 +1,13 @@ +// $Id$ + +#include "Sender.idl" + +composition session SenderImpl +{ + home executor SenderHomeExec + { + implements Protocols::SenderHome; + manages SenderExec; + }; +}; + diff --git a/modules/CIAO/performance-tests/Protocols/Sender/Sender.idl b/modules/CIAO/performance-tests/Protocols/Sender/Sender.idl new file mode 100644 index 00000000000..200eaa0350a --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender.idl @@ -0,0 +1,41 @@ +// $Id$ + +#include <Components.idl> +#include "../common/Protocols.idl" + +module Protocols +{ + interface Sender_Controller + { + enum Test_Type + { + PACED, + THROUGHPUT, + LATENCY + }; + + void start (in unsigned long iterations, + in unsigned long invocation_rate, + in boolean count_missed_end_deadlines, + in boolean do_dump_history, + in boolean print_missed_invocations, + in unsigned long message_size, + in unsigned long test_protocol_tag, + in boolean print_statistics, + in unsigned long number_of_connection_attempts, + in boolean enable_diffserv_code_points, + in short priority, + in Test_Type testtype); + + void shutdown (); + }; + + component Sender supports Sender_Controller + { + uses test reader; + }; + + home SenderHome manages Sender + { + }; +}; diff --git a/modules/CIAO/performance-tests/Protocols/Sender/Sender.mpc b/modules/CIAO/performance-tests/Protocols/Sender/Sender.mpc new file mode 100644 index 00000000000..2f65f552b5b --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender.mpc @@ -0,0 +1,82 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Protocols Sender" + +project(Protocols_Sender_stub): ciao_client_dnc { + avoids += ace_for_tao + libs += Protocols_stub + after += Protocols_stub + sharedname = Protocols_Sender_stub + idlflags -= -GT + idlflags += -St \ + -Wb,stub_export_macro=SENDER_STUB_Export \ + -Wb,stub_export_include=Sender_stub_export.h \ + -Wb,skel_export_macro=SENDER_SVNT_Export \ + -Wb,skel_export_include=Sender_svnt_export.h + dynamicflags = SENDER_STUB_BUILD_DLL + + IDL_Files { + Sender.idl + } + + Source_Files { + SenderC.cpp + } + + Header_Files { + Sender_stub_export.h + } +} + +project(Protocols_Sender_svnt) : ciao_servant_dnc { + avoids += ace_for_tao + after += Protocols_skel Protocols_Sender_stub + sharedname = Protocols_Sender_svnt + libs += Protocols_Sender_stub Protocols_stub Protocols_skel + idlflags -= -GT + idlflags += -SS -St \ + -Wb,export_macro=SENDER_SVNT_Export \ + -Wb,export_include=Sender_svnt_export.h + dynamicflags = SENDER_SVNT_BUILD_DLL + + CIDL_Files { + Sender.cidl + } + + IDL_Files { + SenderE.idl + } + + Source_Files { + SenderEC.cpp + SenderS.cpp + Sender_svnt.cpp + } + + Header_Files { + Sender_svnt_export.h + } +} + + +project(Protocols_Sender_exec) : ciao_component_dnc, rtcorba { + avoids += ace_for_tao + after += Protocols_Sender_svnt + sharedname = Protocols_Sender_exec + libs += Protocols_Sender_stub Protocols_Sender_svnt Protocols_stub Protocols_skel + includes += $(TAO_ROOT)/tests/RTCORBA/Diffserv + dynamicflags = SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Sender_exec.cpp + } + + Header_Files { + Sender_exec_export.h + } +} + + + diff --git a/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec.cpp b/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec.cpp new file mode 100644 index 00000000000..d579426574d --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec.cpp @@ -0,0 +1,720 @@ +// $Id$ + +#include "tao/ORB_Constants.h" +#include "tao/debug.h" +#include "tao/RTCORBA/RTCORBA.h" +#include "tao/RTCORBA/Network_Priority_Mapping_Manager.h" +#include "tao/RTCORBA/Network_Priority_Mapping.h" +#include "tao/RTCORBA/RT_Policy_i.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_stdlib.h" +#include "ace/OS_NS_time.h" +#include "ace/High_Res_Timer.h" +#include "ace/Stats.h" +#include "ace/Array.h" +#include "ace/Sample_History.h" +#include "Custom_Network_Priority_Mapping.h" +#include "Custom_Network_Priority_Mapping.cpp" +#include "Sender_exec.h" + +static ACE_UINT32 gsf = 0; + +double +to_seconds (ACE_UINT64 hrtime, + ACE_UINT32 sf) +{ + double seconds = +#if defined ACE_LACKS_LONGLONG_T + hrtime / sf; +#else /* ! ACE_LACKS_LONGLONG_T */ + static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER (hrtime / sf)); +#endif /* ! ACE_LACKS_LONGLONG_T */ + seconds /= ACE_HR_SCALE_CONVERSION; + + return seconds; +} + +ACE_UINT64 +to_hrtime (double seconds, + ACE_UINT32 sf) +{ + return ACE_UINT64 (seconds * sf * ACE_HR_SCALE_CONVERSION); +} + +class Worker +{ +public: + Worker (CORBA::ORB_ptr orb, + RTCORBA::RTORB_ptr rtorb, + CORBA::PolicyManager_ptr policy_manager, + Protocols::test_ptr test, + ::CORBA::ULong iterations, + ::CORBA::ULong invocation_rate, + ::CORBA::Boolean count_missed_end_deadlines, + ::CORBA::Boolean do_dump_history, + ::CORBA::Boolean print_missed_invocations, + ::CORBA::ULong message_size, + ::CORBA::ULong test_protocol_tag, + ::CORBA::ULong number_of_connection_attempts, + ::CORBA::Boolean enable_diffserv_code_points, + ::Protocols::Sender_Controller::Test_Type test_type); + + void run (void); + + void print_stats (void); + + void setup (void); + +private: + + ACE_hrtime_t deadline_for_current_call (CORBA::ULong i); + void missed_start_deadline (CORBA::ULong invocation); + void missed_end_deadline (CORBA::ULong invocation); + + RTCORBA::RTORB_var rtorb_; + CORBA::PolicyManager_var policy_manager_; + Protocols::test_var test_; + ACE_Sample_History history_; + ACE_hrtime_t interval_between_calls_; + ACE_hrtime_t test_start_; + ACE_hrtime_t test_end_; + CORBA::ULong missed_start_deadlines_; + CORBA::ULong missed_end_deadlines_; + + typedef ACE_Array_Base<CORBA::ULong> Missed_Invocations; + Missed_Invocations missed_start_invocations_; + Missed_Invocations missed_end_invocations_; + + CORBA::PolicyList base_protocol_policy_; + CORBA::PolicyList test_protocol_policy_; + + CORBA::Long session_id_; + + ::CORBA::ULong iterations_; + ::CORBA::ULong invocation_rate_; + ::CORBA::Boolean count_missed_end_deadlines_; + ::CORBA::Boolean do_dump_history_; + ::CORBA::Boolean print_missed_invocations_; + ::CORBA::ULong message_size_; + ::CORBA::ULong test_protocol_tag_; + ::CORBA::ULong number_of_connection_attempts_; + ::CORBA::Boolean enable_diffserv_code_points_; + ::Protocols::Sender_Controller::Test_Type test_type_; +}; + +Worker::Worker (CORBA::ORB_ptr orb, + RTCORBA::RTORB_ptr rtorb, + CORBA::PolicyManager_ptr policy_manager, + Protocols::test_ptr test, + ::CORBA::ULong iterations, + ::CORBA::ULong invocation_rate, + ::CORBA::Boolean count_missed_end_deadlines, + ::CORBA::Boolean do_dump_history, + ::CORBA::Boolean print_missed_invocations, + ::CORBA::ULong message_size, + ::CORBA::ULong test_protocol_tag, + ::CORBA::ULong number_of_connection_attempts, + ::CORBA::Boolean enable_diffserv_code_points, + ::Protocols::Sender_Controller::Test_Type test_type) + : rtorb_ (RTCORBA::RTORB::_duplicate (rtorb)), + policy_manager_ (CORBA::PolicyManager::_duplicate (policy_manager)), + test_ (Protocols::test::_duplicate (test)), + history_ (iterations), + interval_between_calls_ (), + missed_start_deadlines_ (0), + missed_end_deadlines_ (0), + missed_start_invocations_ (iterations), + missed_end_invocations_ (iterations), + iterations_ (iterations), + invocation_rate_ (invocation_rate), + count_missed_end_deadlines_ (count_missed_end_deadlines), + do_dump_history_ (do_dump_history), + print_missed_invocations_ (print_missed_invocations), + message_size_ (message_size), + test_protocol_tag_ (test_protocol_tag), + number_of_connection_attempts_ (number_of_connection_attempts), + enable_diffserv_code_points_ (enable_diffserv_code_points), + test_type_ (test_type) +{ + // Each sender will have a random session id. This helps in + // identifying late packets arriving at the server. + ACE_OS::srand ((unsigned) ACE_OS::time (NULL)); + this->session_id_ = ACE_OS::rand (); + + // Interval is inverse of rate. + this->interval_between_calls_ = + to_hrtime (1 / double (this->invocation_rate_), gsf); + + // Base protocol is used for setting up and tearing down the test. + this->base_protocol_policy_.length (1); + + // Test protocol is the one being tested. + this->test_protocol_policy_.length (1); + + RTCORBA::ProtocolProperties_var base_transport_protocol_properties = + TAO_Protocol_Properties_Factory::create_transport_protocol_property (IOP::TAG_INTERNET_IOP, + orb->orb_core ()); + + RTCORBA::TCPProtocolProperties_var tcp_base_transport_protocol_properties = + RTCORBA::TCPProtocolProperties::_narrow (base_transport_protocol_properties.in ()); + + tcp_base_transport_protocol_properties->enable_network_priority (this->enable_diffserv_code_points_); + + RTCORBA::ProtocolList protocols; + protocols.length (1); + protocols[0].transport_protocol_properties = + base_transport_protocol_properties; + protocols[0].orb_protocol_properties = + RTCORBA::ProtocolProperties::_nil (); + + // IIOP is always used for the base protocol. + protocols[0].protocol_type = IOP::TAG_INTERNET_IOP; + + this->base_protocol_policy_[0] = + this->rtorb_->create_client_protocol_policy (protocols); + + // User decides the test protocol. + protocols[0].protocol_type = test_protocol_tag; + + RTCORBA::ProtocolProperties_var test_transport_protocol_properties = + TAO_Protocol_Properties_Factory::create_transport_protocol_property (protocols[0].protocol_type, + orb->orb_core ()); + + if (protocols[0].protocol_type == TAO_TAG_DIOP_PROFILE) + { + RTCORBA::UserDatagramProtocolProperties_var udp_test_transport_protocol_properties = + RTCORBA::UserDatagramProtocolProperties::_narrow (test_transport_protocol_properties.in ()); + + udp_test_transport_protocol_properties->enable_network_priority (enable_diffserv_code_points); + } + else if (protocols[0].protocol_type == TAO_TAG_SCIOP_PROFILE) + { + RTCORBA::StreamControlProtocolProperties_var sctp_test_transport_protocol_properties = + RTCORBA::StreamControlProtocolProperties::_narrow (test_transport_protocol_properties.in ()); + + sctp_test_transport_protocol_properties->enable_network_priority (enable_diffserv_code_points); + } + else if (protocols[0].protocol_type == IOP::TAG_INTERNET_IOP) + { + RTCORBA::TCPProtocolProperties_var tcp_test_transport_protocol_properties = + RTCORBA::TCPProtocolProperties::_narrow (test_transport_protocol_properties.in ()); + + tcp_test_transport_protocol_properties->enable_network_priority (enable_diffserv_code_points); + } + + protocols[0].transport_protocol_properties = + test_transport_protocol_properties; + + this->test_protocol_policy_[0] = + this->rtorb_->create_client_protocol_policy (protocols); +} + +void +Worker::print_stats (void) +{ + CORBA::ULong missed_total_deadlines = + this->missed_start_deadlines_ + this->missed_end_deadlines_; + + CORBA::ULong made_total_deadlines = + this->iterations_ - missed_total_deadlines; + + ACE_DEBUG ((LM_DEBUG, + "\n************ Statistics ************\n\n")); + + // + // Senders-side stats for PACED invocations are not too relevant + // since we are doing one way calls. + // + if (this->test_type_ == ::Protocols::Sender_Controller::PACED) + { + ACE_DEBUG ((LM_DEBUG, + "Rate = %d/sec; Iterations = %d; ", + this->invocation_rate_, + this->iterations_)); + + if (this->count_missed_end_deadlines_) + ACE_DEBUG ((LM_DEBUG, + "Deadlines made/missed[start,end]/%% = %d/%d[%d,%d]/%.2f%%; Effective Rate = %.2f\n", + made_total_deadlines, + missed_total_deadlines, + this->missed_start_deadlines_, + this->missed_end_deadlines_, + made_total_deadlines * 100 / (double) this->iterations_, + made_total_deadlines / to_seconds (this->test_end_ - this->test_start_, gsf))); + else + ACE_DEBUG ((LM_DEBUG, + "Deadlines made/missed/%% = %d/%d/%.2f%%; Effective Rate = %.2f\n", + made_total_deadlines, + missed_total_deadlines, + made_total_deadlines * 100 / (double) this->iterations_, + made_total_deadlines / to_seconds (this->test_end_ - this->test_start_, gsf))); + + if (this->print_missed_invocations_) + { + ACE_DEBUG ((LM_DEBUG, "\nMissed start invocations are:\n")); + + for (CORBA::ULong j = 0; + j < this->missed_start_deadlines_; + ++j) + { + ACE_DEBUG ((LM_DEBUG, + "%d ", + this->missed_start_invocations_[j])); + } + + ACE_DEBUG ((LM_DEBUG, "\n")); + + if (this->count_missed_end_deadlines_) + { + ACE_DEBUG ((LM_DEBUG, "\nMissed end invocations are:\n")); + + for (CORBA::ULong j = 0; + j < this->missed_end_deadlines_; + ++j) + { + ACE_DEBUG ((LM_DEBUG, + "%d ", + this->missed_end_invocations_[j])); + } + + ACE_DEBUG ((LM_DEBUG, "\n")); + } + } + } + + // Individual calls are relevant for the PACED and LATENCY tests. + if (this->test_type_ == ::Protocols::Sender_Controller::PACED || + this->test_type_ == ::Protocols::Sender_Controller::LATENCY) + { + if (this->do_dump_history_) + { + this->history_.dump_samples ("HISTORY", gsf); + } + + ACE_Basic_Stats stats; + this->history_.collect_basic_stats (stats); + stats.dump_results ("Total", gsf); + + ACE_Throughput_Stats::dump_throughput ("Total", gsf, + this->test_end_ - this->test_start_, + this->iterations_); + } + else + { + ACE_hrtime_t elapsed_time = + this->test_end_ - this->test_start_; + + double seconds = + to_seconds (elapsed_time, gsf); + + ACE_hrtime_t bits = this->iterations_; + bits *= this->message_size_ * 8; + + ACE_DEBUG ((LM_DEBUG, + "%Q bits sent in %5.1f seconds at a rate of %5.2f Mbps\n", + bits, + seconds, + bits / seconds / 1000 / 1000)); + } +} + +ACE_hrtime_t +Worker::deadline_for_current_call (CORBA::ULong i) +{ + ACE_hrtime_t deadline_for_current_call = + this->interval_between_calls_; + + deadline_for_current_call *= (i + 1); + + deadline_for_current_call += this->test_start_; + + return deadline_for_current_call; +} + +void +Worker::missed_start_deadline (CORBA::ULong invocation) +{ + this->missed_start_invocations_[this->missed_start_deadlines_++] = + invocation; +} + +void +Worker::missed_end_deadline (CORBA::ULong invocation) +{ + if (this->count_missed_end_deadlines_) + this->missed_end_invocations_[this->missed_end_deadlines_++] = + invocation; +} + +void +Worker::setup (void) +{ + // Make sure we have a connection to the server using the test + // protocol. + this->policy_manager_->set_policy_overrides (this->test_protocol_policy_, + CORBA::SET_OVERRIDE); + + // Since the network maybe unavailable temporarily, make sure to try + // for a few times before giving up. + for (CORBA::ULong j = 0;;) + { + try + { + // Send a message to ensure that the connection is setup. + this->test_->oneway_sync (); + + break; + } + catch (CORBA::TRANSIENT &) + { + ++j; + + if (j < this->number_of_connection_attempts_) + { + ACE_OS::sleep (1); + + continue; + } + } + + ACE_ERROR ((LM_ERROR, + "Cannot setup test protocol\n")); + + ACE_OS::exit (-1); + } + + const char *test_protocol = 0; + if (this->test_protocol_tag_ == IOP::TAG_INTERNET_IOP) + test_protocol = "IIOP"; + else if (this->test_protocol_tag_ == TAO_TAG_DIOP_PROFILE) + test_protocol = "DIOP"; + else if (this->test_protocol_tag_ == TAO_TAG_SCIOP_PROFILE) + test_protocol = "SCIOP"; + + // Use IIOP for setting up the test since the test protocol maybe + // unreliable. + this->policy_manager_->set_policy_overrides (this->base_protocol_policy_, + CORBA::SET_OVERRIDE); + + // Since the network maybe unavailable temporarily, make sure to try + // for a few times before giving up. + for (CORBA::ULong k = 0;;) + { + try + { + // Let the server know what to expect.. + this->test_->start_test (this->session_id_, + test_protocol, + this->invocation_rate_, + this->message_size_, + this->iterations_); + + break; + } + catch (CORBA::TRANSIENT &) + { + ACE_OS::sleep (1); + + if (k < this->number_of_connection_attempts_) + { + ACE_OS::sleep (1); + + continue; + } + } + + ACE_ERROR ((LM_ERROR, + "Cannot setup base protocol\n")); + + ACE_OS::exit (-1); + } + + return; +} + +void +Worker::run (void) +{ + // Select the test protocol for these invocation. + this->policy_manager_->set_policy_overrides (this->test_protocol_policy_, + CORBA::SET_OVERRIDE); + + // Payload. + ::Protocols::test::octets_var payload (new ::Protocols::test::octets); + payload->length (this->message_size_); + + CORBA::Octet *buffer = + payload->get_buffer (); + + // Not necessary but good for debugging. + ACE_OS::memset (buffer, + 1, + this->message_size_ * sizeof (CORBA::Octet)); + + // Record the start time of the test. + this->test_start_ = + ACE_OS::gethrtime (); + + // Test with several iterations. + for (CORBA::ULong i = 0; + i < this->iterations_; + ++i) + { + ACE_hrtime_t time_before_call = 0; + ACE_hrtime_t deadline_for_current_call = 0; + + // For PACED and LATENCY, each sender call is individually + // noted. + if (this->test_type_ == ::Protocols::Sender_Controller::PACED || + this->test_type_ == ::Protocols::Sender_Controller::LATENCY) + { + time_before_call = + ACE_OS::gethrtime (); + + // Pacing code. + if (this->test_type_ == ::Protocols::Sender_Controller::PACED) + { + deadline_for_current_call = + this->deadline_for_current_call (i); + + if (time_before_call > deadline_for_current_call) + { + this->missed_start_deadline (i); + continue; + } + } + } + + // Use oneways for PACING and THROUGHPUT. + if (this->test_type_ == ::Protocols::Sender_Controller::PACED || + this->test_type_ == ::Protocols::Sender_Controller::THROUGHPUT) + { + this->test_->oneway_method (this->session_id_, + i, + payload.in ()); + } + else + { + // Use twoway calls for LATENCY. + this->test_->twoway_method (this->session_id_, + i, + payload.inout ()); + } + + // For PACED and LATENCY, each sender call is individually + // noted. + if (this->test_type_ == ::Protocols::Sender_Controller::PACED || + this->test_type_ == ::Protocols::Sender_Controller::LATENCY) + { + ACE_hrtime_t time_after_call = + ACE_OS::gethrtime (); + + if (this->test_type_ == ::Protocols::Sender_Controller::LATENCY) + this->history_.sample ((time_after_call - time_before_call) / 2); + else + this->history_.sample (time_after_call - time_before_call); + + if (this->test_type_ == ::Protocols::Sender_Controller::PACED) + { + if (time_after_call > deadline_for_current_call) + { + this->missed_end_deadline (i); + continue; + } + + ACE_hrtime_t sleep_time = + deadline_for_current_call - time_after_call; + + ACE_OS::sleep (ACE_Time_Value (0, + long (to_seconds (sleep_time, gsf) * + ACE_ONE_SECOND_IN_USECS))); + } + } + } + + // This call is used to ensure that all the THROUGHPUT related data + // has reached the server. + if (this->test_type_ == ::Protocols::Sender_Controller::THROUGHPUT && + this->test_protocol_tag_ != TAO_TAG_DIOP_PROFILE) + { + this->test_->twoway_sync (); + } + + // Record end time for the test. + this->test_end_ = ACE_OS::gethrtime (); + + // Use IIOP to indicate end of test to server. + this->policy_manager_->set_policy_overrides (this->base_protocol_policy_, + CORBA::SET_OVERRIDE); + + // Tell server that the test is over. + this->test_->end_test (); +} + +CIDL_SenderImpl::SenderExec_i::SenderExec_i (void) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::SenderExec_i\n")); +} + +void +CIDL_SenderImpl::SenderExec_i::start ( + ::CORBA::ULong iterations, + ::CORBA::ULong invocation_rate, + ::CORBA::Boolean count_missed_end_deadlines, + ::CORBA::Boolean do_dump_history, + ::CORBA::Boolean print_missed_invocations, + ::CORBA::ULong message_size, + ::CORBA::ULong test_protocol_tag, + ::CORBA::Boolean print_statistics, + ::CORBA::ULong number_of_connection_attempts, + ::CORBA::Boolean enable_diffserv_code_points, + ::CORBA::Short priority, + ::Protocols::Sender_Controller::Test_Type test_type + ) + throw (CORBA::SystemException) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::start\n")); + + gsf = ACE_High_Res_Timer::global_scale_factor (); + + int argc = 0; + char **argv = 0; + + this->orb_ = + CORBA::ORB_init (argc, + argv, + ""); + + CORBA::Object_var object = + this->orb_->resolve_initial_references ("RTORB"); + + RTCORBA::RTORB_var rtorb = + RTCORBA::RTORB::_narrow (object.in ()); + + object = + this->orb_->resolve_initial_references ("ORBPolicyManager"); + + CORBA::PolicyManager_var policy_manager = + CORBA::PolicyManager::_narrow (object.in ()); + + object = + this->orb_->resolve_initial_references ("NetworkPriorityMappingManager"); + + RTCORBA::NetworkPriorityMappingManager_var mapping_manager = + RTCORBA::NetworkPriorityMappingManager::_narrow (object.in ()); + + Custom_Network_Priority_Mapping *custom_network_priority_mapping = + new Custom_Network_Priority_Mapping; + + // Set the desired corba priority on the network mapping manager + custom_network_priority_mapping->corba_priority (priority); + + mapping_manager->mapping (custom_network_priority_mapping); + + Protocols::test_var test = + this->context_->get_connection_reader (); + + Worker worker (this->orb_.in (), + rtorb.in (), + policy_manager.in (), + test.in (), + iterations, + invocation_rate, + count_missed_end_deadlines, + do_dump_history, + print_missed_invocations, + message_size, + test_protocol_tag, + number_of_connection_attempts, + enable_diffserv_code_points, + test_type); + + worker.setup (); + + worker.run (); + + if (print_statistics) + worker.print_stats (); +} + +void +CIDL_SenderImpl::SenderExec_i::shutdown (void) + throw (CORBA::SystemException) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::shutdown\n")); + this->orb_->shutdown (); +} + +void +CIDL_SenderImpl::SenderExec_i::set_session_context ( + Components::SessionContext_ptr ctx + ) + throw (CORBA::SystemException, + Components::CCMException) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::set_session_context\n")); + + this->context_ = + CIDL_SenderImpl::SenderExec_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + throw CORBA::INTERNAL (); +} + +void +CIDL_SenderImpl::SenderExec_i::ccm_activate (void) + throw (CORBA::SystemException, + Components::CCMException) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::ccm_activate\n")); +} + +void +CIDL_SenderImpl::SenderExec_i::ccm_passivate (void) + throw (CORBA::SystemException, + Components::CCMException) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::ccm_passivate\n")); +} + +void +CIDL_SenderImpl::SenderExec_i::ccm_remove (void) + throw (CORBA::SystemException, + Components::CCMException) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::ccm_remove\n")); +} + + +void +CIDL_SenderImpl::SenderExec_i::ciao_preactivate (void) + throw (CORBA::SystemException, + Components::CCMException) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::ccm_preactivate\n")); +} + +void +CIDL_SenderImpl::SenderExec_i::ciao_postactivate (void) + throw (CORBA::SystemException, + Components::CCMException) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::ccm_postactivate\n")); +} + +::Components::EnterpriseComponent_ptr +CIDL_SenderImpl::SenderHomeExec_i::create (void) + throw (CORBA::SystemException, + Components::CCMException) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderHome_exec::create\n")); + return new CIDL_SenderImpl::SenderExec_i; +} + +extern "C" SENDER_EXEC_Export ::Components::HomeExecutorBase_ptr +createSenderHome_Impl (void) +{ + ACE_DEBUG ((LM_DEBUG, "createSenderHome_Impl\n")); + return new CIDL_SenderImpl::SenderHomeExec_i; +} diff --git a/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec.h b/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec.h new file mode 100644 index 00000000000..44563ee65b9 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec.h @@ -0,0 +1,82 @@ +// $Id$ + +#include "SenderEC.h" +#include "Sender_exec_export.h" +#include "tao/LocalObject.h" + +class Custom_Network_Priority_Mapping; + +namespace CIDL_SenderImpl +{ + class SENDER_EXEC_Export SenderExec_i : + public virtual SenderExec, + public virtual TAO_Local_RefCounted_Object + { + public: + + SenderExec_i (void); + + void start (::CORBA::ULong iterations, + ::CORBA::ULong invocation_rate, + ::CORBA::Boolean count_missed_end_deadlines, + ::CORBA::Boolean do_dump_history, + ::CORBA::Boolean print_missed_invocations, + ::CORBA::ULong message_size, + ::CORBA::ULong test_protocol_tag, + ::CORBA::Boolean print_statistics, + ::CORBA::ULong number_of_connection_attempts, + ::CORBA::Boolean enable_diffserv_code_points, + ::CORBA::Short priority, + ::Protocols::Sender_Controller::Test_Type test_type) + throw (CORBA::SystemException); + + void shutdown (void) + throw (CORBA::SystemException); + + void set_session_context (Components::SessionContext_ptr ctx) + throw (CORBA::SystemException, + Components::CCMException); + + void ccm_activate (void) + throw (CORBA::SystemException, + Components::CCMException); + + void ccm_passivate (void) + throw (CORBA::SystemException, + Components::CCMException); + + void ccm_remove (void) + throw (CORBA::SystemException, + Components::CCMException); + + void ciao_preactivate (void) + throw (CORBA::SystemException, + Components::CCMException); + + void ciao_postactivate (void) + throw (CORBA::SystemException, + Components::CCMException); + + protected: + + SenderExec_Context_var context_; + + CORBA::ORB_var orb_; + + }; + + class SENDER_EXEC_Export SenderHomeExec_i : + public virtual SenderHomeExec, + public virtual TAO_Local_RefCounted_Object + { + public: + + ::Components::EnterpriseComponent_ptr create (void) + throw (CORBA::SystemException, + Components::CCMException); + }; + + extern "C" SENDER_EXEC_Export ::Components::HomeExecutorBase_ptr + createSenderHome_Impl (void); +} + diff --git a/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec_export.h b/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec_export.h new file mode 100644 index 00000000000..dbaa7ea15bc --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SENDER_EXEC +// ------------------------------ +#ifndef SENDER_EXEC_EXPORT_H +#define SENDER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (SENDER_EXEC_HAS_DLL) +# define SENDER_EXEC_HAS_DLL 1 +#endif /* ! SENDER_EXEC_HAS_DLL */ + +#if defined (SENDER_EXEC_HAS_DLL) && (SENDER_EXEC_HAS_DLL == 1) +# if defined (SENDER_EXEC_BUILD_DLL) +# define SENDER_EXEC_Export ACE_Proper_Export_Flag +# define SENDER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SENDER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SENDER_EXEC_BUILD_DLL */ +# define SENDER_EXEC_Export ACE_Proper_Import_Flag +# define SENDER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SENDER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SENDER_EXEC_BUILD_DLL */ +#else /* SENDER_EXEC_HAS_DLL == 1 */ +# define SENDER_EXEC_Export +# define SENDER_EXEC_SINGLETON_DECLARATION(T) +# define SENDER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SENDER_EXEC_HAS_DLL == 1 */ + +// Set SENDER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SENDER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define SENDER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SENDER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SENDER_EXEC_NTRACE */ + +#if (SENDER_EXEC_NTRACE == 1) +# define SENDER_EXEC_TRACE(X) +#else /* (SENDER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SENDER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SENDER_EXEC_NTRACE == 1) */ + +#endif /* SENDER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Protocols/Sender/Sender_stub_export.h b/modules/CIAO/performance-tests/Protocols/Sender/Sender_stub_export.h new file mode 100644 index 00000000000..28c5d3131d0 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SENDER_STUB +// ------------------------------ +#ifndef SENDER_STUB_EXPORT_H +#define SENDER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (SENDER_STUB_HAS_DLL) +# define SENDER_STUB_HAS_DLL 1 +#endif /* ! SENDER_STUB_HAS_DLL */ + +#if defined (SENDER_STUB_HAS_DLL) && (SENDER_STUB_HAS_DLL == 1) +# if defined (SENDER_STUB_BUILD_DLL) +# define SENDER_STUB_Export ACE_Proper_Export_Flag +# define SENDER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SENDER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SENDER_STUB_BUILD_DLL */ +# define SENDER_STUB_Export ACE_Proper_Import_Flag +# define SENDER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SENDER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SENDER_STUB_BUILD_DLL */ +#else /* SENDER_STUB_HAS_DLL == 1 */ +# define SENDER_STUB_Export +# define SENDER_STUB_SINGLETON_DECLARATION(T) +# define SENDER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SENDER_STUB_HAS_DLL == 1 */ + +// Set SENDER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SENDER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SENDER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SENDER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SENDER_STUB_NTRACE */ + +#if (SENDER_STUB_NTRACE == 1) +# define SENDER_STUB_TRACE(X) +#else /* (SENDER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SENDER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SENDER_STUB_NTRACE == 1) */ + +#endif /* SENDER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Protocols/Sender/Sender_svnt_export.h b/modules/CIAO/performance-tests/Protocols/Sender/Sender_svnt_export.h new file mode 100644 index 00000000000..53236a883f2 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender_svnt_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SENDER_SVNT +// ------------------------------ +#ifndef SENDER_SVNT_EXPORT_H +#define SENDER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (SENDER_SVNT_HAS_DLL) +# define SENDER_SVNT_HAS_DLL 1 +#endif /* ! SENDER_SVNT_HAS_DLL */ + +#if defined (SENDER_SVNT_HAS_DLL) && (SENDER_SVNT_HAS_DLL == 1) +# if defined (SENDER_SVNT_BUILD_DLL) +# define SENDER_SVNT_Export ACE_Proper_Export_Flag +# define SENDER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SENDER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SENDER_SVNT_BUILD_DLL */ +# define SENDER_SVNT_Export ACE_Proper_Import_Flag +# define SENDER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SENDER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SENDER_SVNT_BUILD_DLL */ +#else /* SENDER_SVNT_HAS_DLL == 1 */ +# define SENDER_SVNT_Export +# define SENDER_SVNT_SINGLETON_DECLARATION(T) +# define SENDER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SENDER_SVNT_HAS_DLL == 1 */ + +// Set SENDER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SENDER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SENDER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SENDER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SENDER_SVNT_NTRACE */ + +#if (SENDER_SVNT_NTRACE == 1) +# define SENDER_SVNT_TRACE(X) +#else /* (SENDER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SENDER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SENDER_SVNT_NTRACE == 1) */ + +#endif /* SENDER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Protocols/common/Protocols.idl b/modules/CIAO/performance-tests/Protocols/common/Protocols.idl new file mode 100644 index 00000000000..f7f584e9fff --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/common/Protocols.idl @@ -0,0 +1,29 @@ +// $Id$ + +module Protocols +{ + interface test + { + void start_test (in long session_id, + in string protocol, + in unsigned long invocation_rate, + in unsigned long message_size, + in unsigned long iterations); + + void end_test (); + + oneway void oneway_sync (); + + void twoway_sync (); + + typedef sequence<octet> octets; + + oneway void oneway_method (in long session_id, + in unsigned long iteration, + in octets payload); + + void twoway_method (inout long session_id, + inout unsigned long iteration, + inout octets payload); + }; +}; diff --git a/modules/CIAO/performance-tests/Protocols/common/Protocols.mpc b/modules/CIAO/performance-tests/Protocols/common/Protocols.mpc new file mode 100644 index 00000000000..e7dc5609bc2 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/common/Protocols.mpc @@ -0,0 +1,54 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -n Protocols" + +project(Protocols_stub): taolib_with_idl { + + sharedname = Protocols_stub + idlflags += -St \ + -Wb,stub_export_macro=PROTOCOLS_STUB_Export \ + -Wb,stub_export_include=Protocols_stub_export.h \ + -Wb,skel_export_macro=PROTOCOLS_SKEL_Export \ + -Wb,skel_export_include=Protocols_skel_export.h + dynamicflags = PROTOCOLS_STUB_BUILD_DLL + + IDL_Files { + Protocols.idl + } + + Source_Files { + ProtocolsC.cpp + } + + Header_Files { + Protocols_stub_export.h + } +} + +project(Protocols_skel) : portableserver { + after += Protocols_stub + sharedname = Protocols_skel + libs += Protocols_stub + + idlflags += -St \ + -Wb,stub_export_macro=PROTOCOLS_STUB_Export \ + -Wb,stub_export_include=Protocols_stub_export.h \ + -Wb,skel_export_macro=PROTOCOLS_SKEL_Export \ + -Wb,skel_export_include=Protocols_skel_export.h + dynamicflags = PROTOCOLS_SKEL_BUILD_DLL + + IDL_Files { + Protocols.idl + } + + Source_Files { + ProtocolsS.cpp + } + + Header_Files { + Protocols_skel_export.h + } +} + + + + diff --git a/modules/CIAO/performance-tests/Protocols/common/Protocols_skel_export.h b/modules/CIAO/performance-tests/Protocols/common/Protocols_skel_export.h new file mode 100644 index 00000000000..38692d63f09 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/common/Protocols_skel_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl PROTOCOLS_SVNT +// ------------------------------ +#ifndef PROTOCOLS_SKEL_EXPORT_H +#define PROTOCOLS_SKEL_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (PROTOCOLS_SKEL_HAS_DLL) +# define PROTOCOLS_SKEL_HAS_DLL 1 +#endif /* ! PROTOCOLS_SKEL_HAS_DLL */ + +#if defined (PROTOCOLS_SKEL_HAS_DLL) && (PROTOCOLS_SKEL_HAS_DLL == 1) +# if defined (PROTOCOLS_SKEL_BUILD_DLL) +# define PROTOCOLS_SKEL_Export ACE_Proper_Export_Flag +# define PROTOCOLS_SKEL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define PROTOCOLS_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* PROTOCOLS_SKEL_BUILD_DLL */ +# define PROTOCOLS_SKEL_Export ACE_Proper_Import_Flag +# define PROTOCOLS_SKEL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define PROTOCOLS_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* PROTOCOLS_SKEL_BUILD_DLL */ +#else /* PROTOCOLS_SKEL_HAS_DLL == 1 */ +# define PROTOCOLS_SKEL_Export +# define PROTOCOLS_SKEL_SINGLETON_DECLARATION(T) +# define PROTOCOLS_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* PROTOCOLS_SKEL_HAS_DLL == 1 */ + +// Set PROTOCOLS_SKEL_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (PROTOCOLS_SKEL_NTRACE) +# if (ACE_NTRACE == 1) +# define PROTOCOLS_SKEL_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define PROTOCOLS_SKEL_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !PROTOCOLS_SKEL_NTRACE */ + +#if (PROTOCOLS_SKEL_NTRACE == 1) +# define PROTOCOLS_SKEL_TRACE(X) +#else /* (PROTOCOLS_SKEL_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define PROTOCOLS_SKEL_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (PROTOCOLS_SKEL_NTRACE == 1) */ + +#endif /* PROTOCOLS_SKEL_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Protocols/common/Protocols_stub_export.h b/modules/CIAO/performance-tests/Protocols/common/Protocols_stub_export.h new file mode 100644 index 00000000000..ab2de919ebd --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/common/Protocols_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl PROTOCOLS_STUB +// ------------------------------ +#ifndef PROTOCOLS_STUB_EXPORT_H +#define PROTOCOLS_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (PROTOCOLS_STUB_HAS_DLL) +# define PROTOCOLS_STUB_HAS_DLL 1 +#endif /* ! PROTOCOLS_STUB_HAS_DLL */ + +#if defined (PROTOCOLS_STUB_HAS_DLL) && (PROTOCOLS_STUB_HAS_DLL == 1) +# if defined (PROTOCOLS_STUB_BUILD_DLL) +# define PROTOCOLS_STUB_Export ACE_Proper_Export_Flag +# define PROTOCOLS_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define PROTOCOLS_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* PROTOCOLS_STUB_BUILD_DLL */ +# define PROTOCOLS_STUB_Export ACE_Proper_Import_Flag +# define PROTOCOLS_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define PROTOCOLS_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* PROTOCOLS_STUB_BUILD_DLL */ +#else /* PROTOCOLS_STUB_HAS_DLL == 1 */ +# define PROTOCOLS_STUB_Export +# define PROTOCOLS_STUB_SINGLETON_DECLARATION(T) +# define PROTOCOLS_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* PROTOCOLS_STUB_HAS_DLL == 1 */ + +// Set PROTOCOLS_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (PROTOCOLS_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define PROTOCOLS_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define PROTOCOLS_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !PROTOCOLS_STUB_NTRACE */ + +#if (PROTOCOLS_STUB_NTRACE == 1) +# define PROTOCOLS_STUB_TRACE(X) +#else /* (PROTOCOLS_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define PROTOCOLS_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (PROTOCOLS_STUB_NTRACE == 1) */ + +#endif /* PROTOCOLS_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/performance-tests/Protocols/descriptors/CIAO_Installation_Data.ini b/modules/CIAO/performance-tests/Protocols/descriptors/CIAO_Installation_Data.ini new file mode 100644 index 00000000000..379d481d131 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/descriptors/CIAO_Installation_Data.ini @@ -0,0 +1,5 @@ +[ComponentInstallation] +DCE:83d9348a-3248-445c-82c6-e38294943d65=Protocols_Sender_exec +DCE:2c16cd81-a364-4422-b9e0-ee2ebe084954=Protocols_Sender_svnt +DCE:6b6d29ca-c6e7-4823-806d-157113767331=Protocols_Receiver_svnt +DCE:34b61767-2b7d-459d-985d-ece6255275d5=Protocols_Receiver_exec diff --git a/modules/CIAO/performance-tests/Protocols/descriptors/Receiver.csd b/modules/CIAO/performance-tests/Protocols/descriptors/Receiver.csd new file mode 100644 index 00000000000..44606201edc --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/descriptors/Receiver.csd @@ -0,0 +1,40 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- $Id$ --> +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../docs/XML/softpkg.dtd"> + +<softpkg name="Receiver" version="1.0"> + + <pkgtype>CORBA Component</pkgtype> + + <title>Receiver</title> + + <idl id="IDL:Protocols/Receiver:1.0" + homeid="IDL:Protocols/ReceiverHome:1.0"> + <fileinarchive name="Receiver.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="Receiver.ccd"/> + </descriptor> + + <implementation id="DCE:34b61767-2b7d-459d-985d-ece6255275d5"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <fileinarchive name="Receiver.ssd"/> + <implref idref="DCE:6b6d29ca-c6e7-4823-806d-157113767331"/> + </softpkgref> + </dependency> + + <code type="DLL"> + <fileinarchive name="Protocols_Receiver_exec"/> + <entrypoint>createReceiverHome_Impl</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/modules/CIAO/performance-tests/Protocols/descriptors/Receiver.ssd b/modules/CIAO/performance-tests/Protocols/descriptors/Receiver.ssd new file mode 100644 index 00000000000..83f896c5416 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/descriptors/Receiver.ssd @@ -0,0 +1,37 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- $Id$ --> +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../docs/XML/softpkg.dtd"> + +<softpkg name="Receiver-Servant" version="1.0"> + + <pkgtype>CIAO Servant</pkgtype> + + <title>componentizedSender::Receiver Servants</title> + + <idl id="IDL:Protocols/Receiver:1.0" + homeid="IDL:Protocols/ReceiverHome:1.0"> + <fileinarchive name="Receiver.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="Receiver.ccd"/> + </descriptor> + + <implementation id="DCE:6b6d29ca-c6e7-4823-806d-157113767331"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="Protocols_Receiver_svnt"/> + <entrypoint>createReceiverHome_Servant</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/modules/CIAO/performance-tests/Protocols/descriptors/Sender.csd b/modules/CIAO/performance-tests/Protocols/descriptors/Sender.csd new file mode 100644 index 00000000000..f2d899f3338 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/descriptors/Sender.csd @@ -0,0 +1,40 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- $Id$ --> +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../docs/XML/softpkg.dtd"> + +<softpkg name="Sender" version="1.0"> + + <pkgtype>CORBA Component</pkgtype> + + <title>Sender</title> + + <idl id="IDL:Protocols/Sender:1.0" + homeid="IDL:Protocols/SenderHome:1.0"> + <fileinarchive name="Sender.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="Sender.ccd"/> + </descriptor> + + <implementation id="DCE:83d9348a-3248-445c-82c6-e38294943d65"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <fileinarchive name="Sender.ssd"/> + <implref idref="DCE:2c16cd81-a364-4422-b9e0-ee2ebe084954"/> + </softpkgref> + </dependency> + + <code type="DLL"> + <fileinarchive name="Protocols_Sender_exec"/> + <entrypoint>createSenderHome_Impl</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/modules/CIAO/performance-tests/Protocols/descriptors/Sender.ssd b/modules/CIAO/performance-tests/Protocols/descriptors/Sender.ssd new file mode 100644 index 00000000000..411bbbc66d6 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/descriptors/Sender.ssd @@ -0,0 +1,37 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- $Id$ --> +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../docs/XML/softpkg.dtd"> + +<softpkg name="Sender-Servant" version="1.0"> + + <pkgtype>CIAO Servant</pkgtype> + + <title>componentizedSender::Sender Servants</title> + + <idl id="IDL:Protocols/Sender:1.0" + homeid="IDL:Protocols/SenderHome:1.0"> + <fileinarchive name="Sender.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="Sender.ccd"/> + </descriptor> + + <implementation id="DCE:2c16cd81-a364-4422-b9e0-ee2ebe084954"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="Protocols_Sender_svnt"/> + <entrypoint>createSenderHome_Servant</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/modules/CIAO/performance-tests/Protocols/descriptors/default.cad b/modules/CIAO/performance-tests/Protocols/descriptors/default.cad new file mode 100644 index 00000000000..7f518423e70 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/descriptors/default.cad @@ -0,0 +1,59 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- $Id$ --> +<!-- This file must be pre-processed for final location based on $CIAO_ROOT --> +<!DOCTYPE componentassembly SYSTEM "../../../docs/XML/componentassembly.dtd"> + + +<componentassembly id="componentized assembly"> + + <componentfiles> + + <componentfile id="com-Sender"> + <fileinarchive name="Sender.csd"/> + </componentfile> + + <componentfile id="com-Receiver"> + <fileinarchive name="Receiver.csd"/> + </componentfile> + + </componentfiles> + + <partitioning> + + <homeplacement id="a_SenderHome"> + <componentfileref idref="com-Sender"/> + <componentinstantiation id="a_Sender"> + <registercomponent> + <writeiortofile name="sender.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_ReceiverHome"> + <componentfileref idref="com-Receiver"/> + <componentinstantiation id="a_Receiver"> + <registercomponent> + <writeiortofile name="receiver.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + </partitioning> + + <connections> + + <connectinterface> + <usesport> + <usesidentifier>reader</usesidentifier> + <componentinstantiationref idref="a_Sender"/> + </usesport> + <providesport> + <providesidentifier>writer</providesidentifier> + <componentinstantiationref idref="a_Receiver"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly> diff --git a/modules/CIAO/performance-tests/Protocols/descriptors/remote.cad b/modules/CIAO/performance-tests/Protocols/descriptors/remote.cad new file mode 100644 index 00000000000..d17a09a25e8 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/descriptors/remote.cad @@ -0,0 +1,62 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- $Id$ --> +<!-- This file must be pre-processed for final location based on $CIAO_ROOT --> +<!DOCTYPE componentassembly SYSTEM "../../../docs/XML/componentassembly.dtd"> + + +<componentassembly id="componentized assembly"> + + <componentfiles> + + <componentfile id="com-Sender"> + <fileinarchive name="Sender.csd"/> + </componentfile> + + <componentfile id="com-Receiver"> + <fileinarchive name="Receiver.csd"/> + </componentfile> + + </componentfiles> + + <partitioning> + + <homeplacement id="a_SenderHome"> + <componentfileref idref="com-Sender"/> + <componentinstantiation id="a_Sender"> + <registercomponent> + <writeiortofile name="sender.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <processcollocation> + <homeplacement id="a_ReceiverHome"> + <componentfileref idref="com-Receiver"/> + <componentinstantiation id="a_Receiver"> + <registercomponent> + <writeiortofile name="receiver.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + <destination>Remote</destination> + </processcollocation> + + </partitioning> + + <connections> + + <connectinterface> + <usesport> + <usesidentifier>reader</usesidentifier> + <componentinstantiationref idref="a_Sender"/> + </usesport> + <providesport> + <providesidentifier>writer</providesidentifier> + <componentinstantiationref idref="a_Receiver"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly> diff --git a/modules/CIAO/performance-tests/Protocols/descriptors/run_test.pl b/modules/CIAO/performance-tests/Protocols/descriptors/run_test.pl new file mode 100755 index 00000000000..b9ec459dcde --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/descriptors/run_test.pl @@ -0,0 +1,77 @@ +# -*- perl -*- +# $Id$ + +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +use lib "$ENV{'ACE_ROOT'}/bin"; +use PerlACE::Run_Test; + +$ACE_ROOT = $ENV {'ACE_ROOT'}; +$CIAO_ROOT = $ENV {'CIAO_ROOT'}; + +$ORBdebuglevel = 0; +$protocols = "-ORBEndpoint \'iiop://\'"; +#$protocols = "-ORBEndpoint \'iiop://;diop://:5678;sciop://\'"; + +$daemon_1 = new PerlACE::Process ("${CIAO_ROOT}/tools/Daemon/CIAO_Daemon", + "-ORBEndpoint iiop://localhost:20000 " . + "-n \"${CIAO_ROOT}/tools/RTComponentServer/RTComponentServer -ORBdebuglevel $ORBdebuglevel\""); + +$daemon_2 = new PerlACE::Process ("${CIAO_ROOT}/tools/Daemon/CIAO_Daemon", + "-ORBEndpoint iiop://localhost:12000 " . + "-n \"${CIAO_ROOT}/tools/RTComponentServer/RTComponentServer -ORBdebuglevel $ORBdebuglevel $protocols\""); + +$assembly_manager_args = "-o assembly_manager.ior -c test.dat"; +$assembly_manager = new PerlACE::Process ("${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Manager", "$assembly_manager_args"); + +$assembly_deployer_args = "-k file://assembly_manager.ior -a remote.cad -o assembly"; +$assembly_deployer = new PerlACE::Process ("${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Deployer", "$assembly_deployer_args"); + +$controller = new PerlACE::Process ("../Controller/Controller", "-x 1 -z 1"); + +# Remove all ior files +unlink "assembly_manager.ior"; +unlink "daemon.ior"; +unlink "receiver.ior"; +unlink "sender.ior"; +unlink "assembly"; + +# Start the daemons. +$daemon_1->Spawn (); +$daemon_2->Spawn (); + +# Start the assembly manager +$assembly_manager->Spawn (); + +# Wait till the assembly manager finishes writing the IOR +PerlACE::waitforfile ("assembly_manager.ior"); + +# Start the Assembly_Deployer +$assembly_deployer->Spawn (); + +# Wait till the sender and receiver to finish writing their IORs +PerlACE::waitforfile ("sender.ior"); +PerlACE::waitforfile ("receiver.ior"); + +# Now start the controller +$controller->Spawn (); + +# Wait for controller to get done. +$controller->Wait (); +$controller->{RUNNING} = 0; + +# Kill daemons. +$daemon_1->Kill (); +$daemon_2->Kill (); +$assembly_manager->Kill (); +$assembly_deployer->Kill (); + +# Remove all ior files +unlink "assembly_manager.ior"; +unlink "daemon.ior"; +unlink "receiver.ior"; +unlink "sender.ior"; +unlink "assembly"; + diff --git a/modules/CIAO/performance-tests/Protocols/descriptors/svc.conf b/modules/CIAO/performance-tests/Protocols/descriptors/svc.conf new file mode 100644 index 00000000000..711df131ebc --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/descriptors/svc.conf @@ -0,0 +1 @@ +dynamic Advanced_Resource_Factory Service_Object * TAO_Strategies:_make_TAO_Advanced_Resource_Factory() diff --git a/modules/CIAO/performance-tests/Protocols/descriptors/test.dat b/modules/CIAO/performance-tests/Protocols/descriptors/test.dat new file mode 100644 index 00000000000..087a2a967e4 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/descriptors/test.dat @@ -0,0 +1,2 @@ +Default corbaloc:iiop:localhost:20000/ServerActivator +Remote corbaloc:iiop:localhost:12000/ServerActivator diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/README b/modules/CIAO/performance-tests/mico/mico-thrput-st/README new file mode 100644 index 00000000000..ee534c0c0a4 --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/README @@ -0,0 +1,26 @@ +// +//$Id$ +// +Throughput Experiment +==================== + +This experiment is used to gather latency and throughput related metrics for MICO ORB. +The benchmark uses ACE to analyze the data sample and generate results. In order to run +this benchmark the following is required + +1: MICO ORB configured in single-threaded mode +2: This directory placed under $MICO_ROOT/demo/<name-of-directory> +3: The envrionment setting required for running this test is provided in + the mico-env file. +4: These tests can only run on *nix systems as of now. For windows project files will + be added shortly + +Compilation +=========== +To compile the files + +$make + +To run the experiment +===================== +./RoundTrip diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip new file mode 100755 index 00000000000..395ef4f73e4 --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip @@ -0,0 +1,40 @@ +#!/bin/sh + +MICORC=/dev/null +export MICORC + +# run Naming Service + +echo "Starting Naming Service ..." + +rm -f nsd.ior +nsd --ior nsd.ior & +nsd_pid=$! + +trap "kill $nsd_pid > /dev/null 2> /dev/null" 0 + +# wait for Naming Service to start + +for i in 0 1 2 3 4 5 6 7 8 9 ; do + if test -r nsd.ior ; then break ; else sleep 1 ; fi +done + +# start Server + +echo "Starting Server ..." + +./server -ORBInitRef NameService=file://`pwd`/nsd.ior & +server_pid=$! + +trap "kill $nsd_pid $server_pid > /dev/null 2> /dev/null" 0 + +# give server some time to start + +sleep 3 + +# run Client + +echo "Running Client ..." + +./client -ORBInitRef NameService=file://`pwd`/nsd.ior -i 500000 + diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip.idl b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip.idl new file mode 100644 index 00000000000..475433dfec4 --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip.idl @@ -0,0 +1,13 @@ +//$Id$ +interface Roundtrip +{ + /// A simple method to measure roundtrip delays + /** + * The operation simply returns its argument, this is used in AMI + * and deferred synchronous tests to measure the roundtrip delay + * without the need for a different reply handler for each + * request. + */ + unsigned long long test_method (in unsigned long long send_time); + +}; diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.cc b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.cc new file mode 100644 index 00000000000..88338765186 --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.cc @@ -0,0 +1,10 @@ +// +//$Id$ +// + +#include "RoundTrip_impl.h" + +CORBA::ULongLong RoundTrip_impl::test_method (CORBA::ULongLong send_time) +{ + return send_time; +} diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.h b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.h new file mode 100644 index 00000000000..86213cf1b9d --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.h @@ -0,0 +1,9 @@ +// +//$Id$ +// +#include "RoundTrip.h" + +class RoundTrip_impl : virtual public POA_Roundtrip { + public: + CORBA::ULongLong test_method (CORBA::ULongLong send_time); +}; diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/client.cc b/modules/CIAO/performance-tests/mico/mico-thrput-st/client.cc new file mode 100644 index 00000000000..74e04bcdf2b --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/client.cc @@ -0,0 +1,150 @@ +// +//$Id$ +// +//FUZZ: disable check_for_missing_rir_env + +#define USE_POA +//#define NESTED + +#include <CORBA.h> +#include <coss/CosNaming.h> + +#ifdef HAVE_ANSI_CPLUSPLUS_HEADERS +#include <iostream> +#else // HAVE_ANSI_CPLUSPLUS_HEADERS +#include <iostream.h> +#endif // HAVE_ANSI_CPLUSPLUS_HEADERS + +#include "RoundTrip.h" + +#include "ace/Get_Opt.h" +#include "ace/High_Res_Timer.h" +#include "ace/Sched_Params.h" +#include "ace/Stats.h" +#include "ace/Sample_History.h" + +using namespace std; + + +int do_dump_history = 0; +int niterations = 1000; + +int +parse_args (int argc, char *argv[]) +{ + //parse arguments + ACE_Get_Opt get_opts (argc, argv, "hxi:"); + char c; + while ((c = get_opts ()) != -1) + switch (c) + { + case 'h': + do_dump_history = 1; + break; + + case 'i': + niterations = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case '?': + default: + /* Could be any other parameter like -ORBSvcConf file so ignore */ + break; + } + // Indicates sucessful parsing of the command line + return 0; +} + +void +set_priority () +{ + 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, + "client (%P|%t): user is not superuser, " + "test runs in time-shared class\n")); + } + else + ACE_ERROR ((LM_ERROR, + "client (%P|%t): sched_params failed\n")); + } + +} + +int +main (int argc, char *argv[]) +{ + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + CORBA::Object_var obj = orb->resolve_initial_references ("NameService"); + CosNaming::NamingContextExt_var nc = + CosNaming::NamingContextExt::_narrow (obj); + assert (!CORBA::is_nil (nc)); + + //Obtain reference from the naming context + obj = nc->resolve_str ("RoundTrip"); + + Roundtrip_var bench = Roundtrip::_narrow (obj); + + parse_args(argc, argv); + set_priority(); + + //Warmup the System by making some empty calls + CORBA::Long start = 0L; + for (int j = 0; j < 100; ++j) + { + bench->test_method (start); + } + + + CORBA::ULongLong time_stamp = 1234; + ACE_Sample_History history (niterations); + ACE_hrtime_t test_start = ACE_OS::gethrtime (); + + for (int i = 0; i < niterations; ++i) + { + + ACE_hrtime_t start = ACE_OS::gethrtime (); + + bench->test_method (time_stamp); + + ACE_hrtime_t now = ACE_OS::gethrtime (); + history.sample (now - start); + } + + ACE_hrtime_t test_end = ACE_OS::gethrtime (); + + ACE_DEBUG ((LM_DEBUG, "test finished\n")); + + ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + ACE_DEBUG ((LM_DEBUG, "done\n")); + + if (do_dump_history) + { + history.dump_samples ("HISTORY", gsf); + } + + ACE_Basic_Stats stats; + history.collect_basic_stats (stats); + stats.dump_results ("Total", gsf); + + ACE_Throughput_Stats::dump_throughput ("Total", gsf, + test_end - test_start, + stats.samples_count ()); + + //Remove the component + cout << "client finished" << endl; + + return 0; +} diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/mico-env b/modules/CIAO/performance-tests/mico/mico-thrput-st/mico-env new file mode 100755 index 00000000000..67b444acef9 --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/mico-env @@ -0,0 +1,14 @@ +############## +## MICO ENVIRONMENT SETTINGS +############# +# +# If MICO has been built in /build/ccm/mico-obj +# then add the following to your path and Library paths +# for Bash Shell: +# +#export PATH=/build/ccm/mico-obj/bin:$PATH +#export LD_LIBRARY_PATH=/build/ccm/mico-obj/lib:$LD_LIBRARY_PATH +# +# Note: The place where object files and binaries are built could be +# different from source files. The environment variables use the obj +# path rather than source path diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/server.cc b/modules/CIAO/performance-tests/mico/mico-thrput-st/server.cc new file mode 100644 index 00000000000..9bf90eda0ed --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/server.cc @@ -0,0 +1,43 @@ +// +//$Id$ +// +// FUZZ: disable check_for_missing_rir_env +#include <CORBA.h> +#include <coss/CosNaming.h> + +#ifdef HAVE_ANSI_CPLUSPLUS_HEADERS +#include <iostream> +#else // HAVE_ANSI_CPLUSPLUS_HEADERS +#include <iostream.h> +#endif // HAVE_ANSI_CPLUSPLUS_HEADERS + +#include "RoundTrip_impl.h" +int +main (int argc, char *argv[]) +{ + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "mico-local-orb"); + + //Obtain reference to Naming service + CORBA::Object_var naming_context_object = + orb->resolve_initial_references ("NameService"); + CosNaming::NamingContext_var naming_context = + CosNaming::NamingContext::_narrow (naming_context_object.in ()); + + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow (obj); + RoundTrip_impl* rt_impl = new RoundTrip_impl(); + PortableServer::ObjectId_var oid = poa->activate_object (rt_impl); + Roundtrip_var rt_obj = rt_impl->_this(); + + //Add to Naming Service + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup ("RoundTrip"); + naming_context->bind (name, rt_obj.in()); + + //allow incoming requests + poa->the_POAManager()->activate(); + + orb->run (); + return 0; +} |