diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2009-08-13 17:22:20 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2009-08-13 17:22:20 +0000 |
commit | d2c1ccadb685877479d7a2091e9aca5a5b333652 (patch) | |
tree | 0118dca796b67ccfbcb8ebe51be7e6b2298580cc /modules/CIAO/performance-tests/Protocols | |
parent | 1bf8bb0ad2f1244f827b9cf7426946f0a14050db (diff) | |
download | ATCD-d2c1ccadb685877479d7a2091e9aca5a5b333652.tar.gz |
branching/tagging
Diffstat (limited to 'modules/CIAO/performance-tests/Protocols')
26 files changed, 2433 insertions, 0 deletions
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..fee5d4c2bd9 --- /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 ACE_TCHAR *sender_ior = ACE_TEXT("file://sender.ior"); +static const ACE_TCHAR *distributor_ior = ACE_TEXT("file://distributor.ior"); +static const ACE_TCHAR *receiver_ior = ACE_TEXT("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 ACE_TCHAR *test_protocol = ACE_TEXT("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 ACE_TCHAR *test_type = ACE_TEXT("PACED"); + +static int +parse_args (int argc, ACE_TCHAR **argv) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("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 +ACE_TMAIN(int argc, ACE_TCHAR *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, ACE_TEXT("DIOP")) == 0) + test_protocol_tag = TAO_TAG_DIOP_PROFILE; + else if (ACE_OS::strcmp (test_protocol, ACE_TEXT("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, ACE_TEXT("THROUGHPUT")) == 0) + test_type_tag = Protocols::Sender_Controller::THROUGHPUT; + else if (ACE_OS::strcmp (test_type, ACE_TEXT("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..af97a3d6520 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Controller/Controller.mpc @@ -0,0 +1,12 @@ +// $Id$ + +project (Protocols_Controller) : ccm_stub, rtcorba { + after += Protocols_Sender_stub \ + Protocols_Receiver_stub + includes += ../Sender + includes += ../Receiver + libs += Protocols_Receiver_stub \ + Protocols_Sender_stub \ + Protocols_stub + libpaths += ../common ../Sender ../Receiver +} 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..f4f1a8d719f --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver.mpc @@ -0,0 +1,114 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Protocols Receiver" + +project(Protocols_Receiver_idl_gen) : componentidldefaults { + custom_only = 1 + idlflags += -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 \ + -Wb,exec_export_macro=RECEIVER_EXEC_Export \ + -Wb,exec_export_include=Receiver_exec_export.h + + IDL_Files { + Receiver.idl + } +} + +project(Protocols_Receiver_lem_gen) : ciaoidldefaults { + custom_only = 1 + after += Protocols_Receiver_idl_gen + idlflags += -Wb,export_macro=RECEIVER_EXEC_Export \ + -Wb,export_include=Receiver_exec_export.h \ + -SS + + IDL_Files { + ReceiverE.idl + } +} + +project(Protocols_Receiver_stub) : ccm_stub { + after += Protocols_Receiver_idl_gen Protocols_stub + libs += Protocols_stub + libpaths += ../common + + sharedname = Protocols_Receiver_stub + dynamicflags = RECEIVER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ReceiverC.cpp + } + + Header_Files { + ReceiverC.h + Receiver_stub_export.h + } + + Inline_Files { + ReceiverC.inl + } +} + +project(Protocols_Receiver_exec) : ciao_executor, avoids_ace_for_tao { + after += Protocols_Receiver_lem_gen Protocols_Receiver_stub + sharedname = Protocols_Receiver_exec + libs += Protocols_Receiver_stub \ + Protocols_stub + libpaths += ../common + + dynamicflags = RECEIVER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ReceiverEC.cpp + Receiver_exec.cpp + } + + Header_Files { + ReceiverEC.h + Receiver_exec.h + Receiver_exec_export.h + } + + Inline_Files { + ReceiverEC.inl + } +} + + +project(Protocols_Receiver_svnt) : ciao_servant, avoids_ace_for_tao { + after += Protocols_skel Protocols_Receiver_exec + sharedname = Protocols_Receiver_svnt + libs += Protocols_Receiver_exec \ + Protocols_Receiver_stub \ + Protocols_skel \ + Protocols_stub + libpaths += ../common + + dynamicflags = RECEIVER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ReceiverS.cpp + Receiver_svnt.cpp + } + + Header_Files { + ReceiverS.h + Receiver_svnt.h + Receiver_svnt_export.h + } + + Inline_Files { + ReceiverS.inl + } +} + + 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..baa926d17b0 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec.cpp @@ -0,0 +1,287 @@ +// $Id$ + +#include "Receiver_exec.h" +#include "ace/Stats.h" +#include "ace/Throughput_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) + { + 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) + { + // Record end time. + this->test_end_ = + ACE_OS::gethrtime (); + + if (do_dump_history) + { + this->inter_arrival_times_->dump_samples (ACE_TEXT("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 (ACE_TEXT("Inter-arrival times"), gsf); + + ACE_Throughput_Stats::dump_throughput (ACE_TEXT("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) + { + } + + void + test_i::twoway_sync (void) + { + } + + void + test_i::oneway_method (CORBA::Long session_id, + CORBA::ULong iteration, + const Protocols::test::octets &payload) + { + 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) + { + 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) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::get_writer\n")); + return new test_i; + } + + void + ReceiverExec_i::shutdown (void) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::shutdown\n")); + this->orb_->shutdown (); + } + + void + ReceiverExec_i::set_session_context (Components::SessionContext_ptr ctx) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::set_session_context\n")); + + this->context_ = + ::CIAO_Protocols_Receiver_Impl::Receiver_Exec_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + throw CORBA::INTERNAL (); + } + + void + ReceiverExec_i::ccm_activate (void) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::ccm_activate\n")); + } + + void + ReceiverExec_i::ccm_passivate (void) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::ccm_passivate\n")); + } + + void + ReceiverExec_i::ccm_remove (void) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::ccm_remove\n")); + } + + void + ReceiverExec_i::configuration_complete (void) + { + ACE_DEBUG ((LM_DEBUG, "ReceiverExec_i::configuration_complete\n")); + } + + ::Components::EnterpriseComponent_ptr + ReceiverHomeExec_i::create (void) + { + 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..d5213a5cb92 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Receiver/Receiver_exec.h @@ -0,0 +1,94 @@ +// $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 ::CIAO_Protocols_Receiver_Impl::Receiver_Exec, + public virtual ::CORBA::LocalObject + { + public: + + ReceiverExec_i (void); + + ::Protocols::CCM_test_ptr get_writer (void); + + void shutdown (void); + + void set_session_context (Components::SessionContext_ptr ctx); + + void ccm_activate (void); + + void ccm_passivate (void); + + void ccm_remove (void); + + void configuration_complete (void); + + protected: + + ::CIAO_Protocols_Receiver_Impl::Receiver_Exec_Context_var context_; + + CORBA::ORB_var orb_; + + }; + + class RECEIVER_EXEC_Export test_i : + public virtual Protocols::CCM_test, + public virtual ::CORBA::LocalObject + { + 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); + + void end_test (void); + + void oneway_sync (void); + + void twoway_sync (void); + + void oneway_method (CORBA::Long session_id, + CORBA::ULong iteration, + const Protocols::test::octets &payload); + + void twoway_method (CORBA::Long &session_id, + CORBA::ULong &iteration, + Protocols::test::octets &payload); + + 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 ::CIAO_Protocols_Receiver_Impl::ReceiverHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + + ::Components::EnterpriseComponent_ptr create (void); + }; + + extern "C" RECEIVER_EXEC_Export ::Components::HomeExecutorBase_ptr + createReceiverHome_Impl (void); +} diff --git a/modules/CIAO/performance-tests/Protocols/Sender/Custom_Network_Priority_Mapping.cpp b/modules/CIAO/performance-tests/Protocols/Sender/Custom_Network_Priority_Mapping.cpp new file mode 100644 index 00000000000..bb503a6728f --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Custom_Network_Priority_Mapping.cpp @@ -0,0 +1,133 @@ +// $Id$ + +#include "Custom_Network_Priority_Mapping.h" +#include "tao/debug.h" +#include "ace/Log_Msg.h" + +ACE_RCSID (Strategies, + Custom_Network_Priority_Mapping, + "$Id$") + +#define IPDSFIELD_DSCP_DEFAULT 0x00 +#define IPDSFIELD_DSCP_CS1 0x08 +#define IPDSFIELD_DSCP_CS2 0x10 +#define IPDSFIELD_DSCP_CS3 0x18 +#define IPDSFIELD_DSCP_CS4 0x20 +#define IPDSFIELD_DSCP_CS5 0x28 +#define IPDSFIELD_DSCP_CS6 0x30 +#define IPDSFIELD_DSCP_CS7 0x38 +#define IPDSFIELD_DSCP_AF11 0x0A +#define IPDSFIELD_DSCP_AF12 0x0C +#define IPDSFIELD_DSCP_AF13 0x0E +#define IPDSFIELD_DSCP_AF21 0x12 +#define IPDSFIELD_DSCP_AF22 0x14 +#define IPDSFIELD_DSCP_AF23 0x16 +#define IPDSFIELD_DSCP_AF31 0x1A +#define IPDSFIELD_DSCP_AF32 0x1C +#define IPDSFIELD_DSCP_AF33 0x1E +#define IPDSFIELD_DSCP_AF41 0x22 +#define IPDSFIELD_DSCP_AF42 0x24 +#define IPDSFIELD_DSCP_AF43 0x26 +#define IPDSFIELD_ECT_MASK 0x02 +#define IPDSFIELD_CE_MASK 0x01 +#define IPDSFIELD_DSCP_EF 0x2E + +static int dscp [] = +{ + IPDSFIELD_DSCP_DEFAULT , + IPDSFIELD_DSCP_CS1 , + IPDSFIELD_DSCP_CS2 , + IPDSFIELD_DSCP_CS3 , + IPDSFIELD_DSCP_CS4 , + IPDSFIELD_DSCP_CS5 , + IPDSFIELD_DSCP_CS6 , + IPDSFIELD_DSCP_CS7 , + IPDSFIELD_DSCP_AF11 , + IPDSFIELD_DSCP_AF12 , + IPDSFIELD_DSCP_AF13 , + IPDSFIELD_DSCP_AF21 , + IPDSFIELD_DSCP_AF22 , + IPDSFIELD_DSCP_AF23 , + IPDSFIELD_DSCP_AF31 , + IPDSFIELD_DSCP_AF32 , + IPDSFIELD_DSCP_AF33 , + IPDSFIELD_DSCP_AF41 , + IPDSFIELD_DSCP_AF42 , + IPDSFIELD_DSCP_AF43 , + IPDSFIELD_DSCP_EF +}; + +/* +static const char *dscp_char[]= +{ + "Normal", + "CS1", + "CS2", + "CS3", + "CS4", + "CS5", + "CS6", + "CS7", + "Assured Forwarding 11", + "Assured Forwarding 12", + "Assured Forwarding 13", + "Assured Forwarding 21", + "Assured Forwarding 22", + "Assured Forwarding 23", + "Assured Forwarding 31", + "Assured Forwarding 32", + "Assured Forwarding 33", + "Assured Forwarding 41", + "Assured Forwarding 42", + "Assured Forwarding 43", + "Expedited Forwarding" +}; +*/ + +Custom_Network_Priority_Mapping::Custom_Network_Priority_Mapping (void) + : corba_priority_ (RTCORBA::minPriority) +{ +} + +void +Custom_Network_Priority_Mapping::corba_priority (RTCORBA::Priority corba_priority) +{ + this->corba_priority_ = corba_priority; +} + +CORBA::Boolean +Custom_Network_Priority_Mapping::to_network (RTCORBA::Priority, + RTCORBA::NetworkPriority &network_priority) +{ + if (TAO_debug_level) + ACE_DEBUG ((LM_DEBUG, + "Custom_Network_Priority_Mapping::to_network corba_priority %d\n", + this->corba_priority_)); + + const int total_slots = sizeof (dscp) / sizeof (int); + + int array_slot = + static_cast<int> (((this->corba_priority_ - RTCORBA::minPriority) / double (RTCORBA::maxPriority - RTCORBA::minPriority)) * total_slots); + + if (array_slot == total_slots) + array_slot -= 1; + + network_priority = dscp[array_slot]; + + if (TAO_debug_level) + ACE_DEBUG ((LM_DEBUG, + "Custom_Network_Priority_Mapping::to_network = %x\n", + network_priority)); + + return 1; +} + +CORBA::Boolean +Custom_Network_Priority_Mapping::to_CORBA (RTCORBA::NetworkPriority, + RTCORBA::Priority &) +{ + // This method should not be called. + ACE_ASSERT (0); + + return 0; +} diff --git a/modules/CIAO/performance-tests/Protocols/Sender/Custom_Network_Priority_Mapping.h b/modules/CIAO/performance-tests/Protocols/Sender/Custom_Network_Priority_Mapping.h new file mode 100644 index 00000000000..fac5d84a433 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Custom_Network_Priority_Mapping.h @@ -0,0 +1,58 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO +// +// = FILENAME +// Custom_Network_Priority_Mapping.h +// +// = DESCRIPTION +// Declares the Custom_Network_Priority_Mapping interface, +// +// = AUTHOR +// Yamuna Krishnamurthy (yamuna@oomworks.com) +// +// ============================================================================ + +#ifndef CUSTOM_NETWORK_PRIORITY_MAPPING_H +#define CUSTOM_NETWORK_PRIORITY_MAPPING_H + +#include /**/ "ace/pre.h" +#include "tao/RTCORBA/Network_Priority_Mapping.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class Custom_Network_Priority_Mapping : public TAO_Network_Priority_Mapping +{ + // + // = TITLE + // A simple implementation of the Network_Priority_Mapping interface + // + // = DESCRIPTION + // This implementation uses custom mapping between the range of + // priorities for a given scheduling class (ACE_SCHED_OTHER, + // ACE_SCHED_FIFO, ACE_SCHED_RR) and the valid range of CORBA + // priorities (0...32767) + // +public: + Custom_Network_Priority_Mapping (void); + + CORBA::Boolean to_network (RTCORBA::Priority corba_priority, + RTCORBA::NetworkPriority &network_priority); + + CORBA::Boolean to_CORBA (RTCORBA::NetworkPriority network_priority, + RTCORBA::Priority &corba_priority); + + void corba_priority (RTCORBA::Priority corba_priority); + + private: + RTCORBA::Priority corba_priority_; +}; + + +#include /**/ "ace/post.h" +#endif /* CUSTOM_NETWORK_PRIORITY_MAPPING_H */ 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..8234f0546ec --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender.mpc @@ -0,0 +1,116 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Protocols Sender" + +project(Protocols_Sender_idl_gen) : componentidldefaults { + custom_only = 1 + idlflags += -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 \ + -Wb,exec_export_macro=SENDER_EXEC_Export \ + -Wb,exec_export_include=Sender_exec_export.h + + IDL_Files { + Sender.idl + } +} + +project(Protocols_Sender_lem_gen) : ciaoidldefaults { + custom_only = 1 + after += Protocols_Sender_idl_gen + idlflags += -Wb,export_macro=SENDER_EXEC_Export \ + -Wb,export_include=Sender_exec_export.h \ + -SS + + IDL_Files { + SenderE.idl + } +} + +project(Protocols_Sender_stub) : ccm_stub { + after += Protocols_Sender_idl_gen Protocols_stub + libs += Protocols_stub + libpaths += ../common + + sharedname = Protocols_Sender_stub + dynamicflags = SENDER_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SenderC.cpp + } + + Header_Files { + SenderC.h + Sender_stub_export.h + } + + Inline_Files { + SenderC.inl + } +} + +project(Protocols_Sender_exec) : ciao_executor, rtcorba, avoids_ace_for_tao { + after += Protocols_Sender_lem_gen Protocols_Sender_stub + sharedname = Protocols_Sender_exec + libs += Protocols_Sender_stub \ + Protocols_stub + libpaths += ../common + includes += $(TAO_ROOT)/tests/RTCORBA/Diffserv + dynamicflags = SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Custom_Network_Priority_Mapping.cpp + SenderEC.cpp + Sender_exec.cpp + } + + Header_Files { + Custom_Network_Priority_Mapping.h + SenderEC.h + Sender_exec.h + Sender_exec_export.h + } + + Inline_Files { + SenderEC.inl + } +} + + +project(Protocols_Sender_svnt) : ciao_servant, avoids_ace_for_tao { + after += Protocols_skel Protocols_Sender_exec + sharedname = Protocols_Sender_svnt + libs += Protocols_Sender_exec \ + Protocols_Sender_stub \ + Protocols_skel \ + Protocols_stub + libpaths += ../common + + dynamicflags = SENDER_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + SenderS.cpp + Sender_svnt.cpp + } + + Header_Files { + SenderS.h + Sender_svnt.h + Sender_svnt_export.h + } + + Inline_Files { + SenderS.inl + } +} + + 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..b3cd02897df --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec.cpp @@ -0,0 +1,697 @@ +// $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 "tao/Policy_ManagerC.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/Throughput_Stats.h" +#include "ace/Array.h" +#include "ace/Sample_History.h" +#include "Custom_Network_Priority_Mapping.h" +#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 (0)); + 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 (ACE_TEXT("HISTORY"), gsf); + } + + ACE_Basic_Stats stats; + this->history_.collect_basic_stats (stats); + stats.dump_results (ACE_TEXT("Total"), gsf); + + ACE_Throughput_Stats::dump_throughput (ACE_TEXT("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 + ) +{ + 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) +{ + 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 + ) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::set_session_context\n")); + + this->context_ = + ::CIAO_Protocols_Sender_Impl::Sender_Exec_Context::_narrow (ctx); + + if (CORBA::is_nil (this->context_.in ())) + throw CORBA::INTERNAL (); +} + +void +CIDL_SenderImpl::SenderExec_i::ccm_activate (void) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::ccm_activate\n")); +} + +void +CIDL_SenderImpl::SenderExec_i::ccm_passivate (void) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::ccm_passivate\n")); +} + +void +CIDL_SenderImpl::SenderExec_i::ccm_remove (void) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::ccm_remove\n")); +} + + +void +CIDL_SenderImpl::SenderExec_i::configuration_complete (void) +{ + ACE_DEBUG ((LM_DEBUG, "CIDL_SenderImpl::SenderExec_i::configuration_complete\n")); +} + +::Components::EnterpriseComponent_ptr +CIDL_SenderImpl::SenderHomeExec_i::create (void) +{ + 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..9d2d307a406 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/Sender/Sender_exec.h @@ -0,0 +1,62 @@ +// $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 ::CIAO_Protocols_Sender_Impl::Sender_Exec, + public virtual ::CORBA::LocalObject + { + 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); + + void shutdown (void); + + void set_session_context (Components::SessionContext_ptr ctx); + + void ccm_activate (void); + + void ccm_passivate (void); + + void ccm_remove (void); + + void configuration_complete (void); + + protected: + ::CIAO_Protocols_Sender_Impl::Sender_Exec_Context_var context_; + + CORBA::ORB_var orb_; + + }; + + class SENDER_EXEC_Export SenderHomeExec_i : + public virtual ::CIAO_Protocols_Sender_Impl::SenderHome_Exec, + public virtual ::CORBA::LocalObject + { + public: + + ::Components::EnterpriseComponent_ptr create (void); + }; + + extern "C" SENDER_EXEC_Export ::Components::HomeExecutorBase_ptr + createSenderHome_Impl (void); +} 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..9b0a3f2d6a9 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/common/Protocols.mpc @@ -0,0 +1,64 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -n Protocols" + +project(Protocols_idl_gen) : ciaoidldefaults, anytypecode { + custom_only = 1 + idlflags += -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 + + IDL_Files { + Protocols.idl + } +} + +project(Protocols_stub) : ccm_stub { + after += Protocols_idl_gen + + sharedname = Protocols_stub + dynamicflags = PROTOCOLS_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ProtocolsC.cpp + } + + Header_Files { + ProtocolsC.h + Protocols_stub_export.h + } + + Inline_Files { + ProtocolsC.inl + } +} + + +project(Protocols_skel) : ciao_executor { + after += Protocols_stub + sharedname = Protocols_skel + libs += Protocols_stub + + dynamicflags = PROTOCOLS_SKEL_BUILD_DLL + + IDL_Files { + } + + Source_Files { + ProtocolsS.cpp + } + + Header_Files { + ProtocolsS.h + Protocols_skel_export.h + } + + Inline_Files { + ProtocolsS.inl + } +} + + 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..2f169679d78 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/common/Protocols_skel_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl PROTOCOLS_SKEL +// ------------------------------ +#ifndef PROTOCOLS_SKEL_EXPORT_H +#define PROTOCOLS_SKEL_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (PROTOCOLS_SKEL_HAS_DLL) +# define PROTOCOLS_SKEL_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && PROTOCOLS_SKEL_HAS_DLL */ + +#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..a214c4ceda9 --- /dev/null +++ b/modules/CIAO/performance-tests/Protocols/common/Protocols_stub_export.h @@ -0,0 +1,58 @@ + +// -*- 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 (ACE_AS_STATIC_LIBS) && !defined (PROTOCOLS_STUB_HAS_DLL) +# define PROTOCOLS_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && PROTOCOLS_STUB_HAS_DLL */ + +#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..57f2cfb0c76 --- /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
\ No newline at end of file |