diff options
Diffstat (limited to 'modules/CIAO/performance-tests/Benchmark/RoundTripClient')
8 files changed, 676 insertions, 0 deletions
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..a98d3acec69 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient.mpc @@ -0,0 +1,132 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -p Benchmark -l .. -c client RoundTripClient" + +project(Benchmark_RoundTripClient_idl_gen) : componentidldefaults { + custom_only = 1 + idlflags += -Wb,stub_export_macro=ROUNDTRIPCLIENT_STUB_Export \ + -Wb,stub_export_include=RoundTripClient_stub_export.h \ + -Wb,skel_export_macro=ROUNDTRIPCLIENT_SVNT_Export \ + -Wb,skel_export_include=RoundTripClient_svnt_export.h \ + -Wb,exec_export_macro=ROUNDTRIPCLIENT_EXEC_Export \ + -Wb,exec_export_include=RoundTripClient_exec_export.h \ + + IDL_Files { + RoundTripClient.idl + } +} + +project(Benchmark_RoundTripClient_lem_gen) : ciaoidldefaults { + custom_only = 1 + after += Benchmark_RoundTripClient_idl_gen + idlflags += -Wb,export_macro=ROUNDTRIPCLIENT_EXEC_Export \ + -Wb,export_include=RoundTripClient_exec_export.h \ + -SS + + IDL_Files { + RoundTripClientE.idl + RoundTripClientEI.idl << RoundTripClientE.idl + } +} + +project(Benchmark_RoundTripClient_stub) : ccm_stub { + after += Benchmark_RoundTripClient_idl_gen Benchmark_stub + libs += Benchmark_stub + libpaths += .. + sharedname = RoundTripClient_stub + dynamicflags = ROUNDTRIPCLIENT_STUB_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RoundTripClientC.cpp + } + + Header_Files { + RoundTripClientC.h + RoundTripClient_stub_export.h + } + + Inline_Files { + RoundTripClientC.inl + } +} + +project(Benchmark_RoundTripClient_exec) : ciao_executor, avoids_ace_for_tao { + after += Benchmark_RoundTripClient_lem_gen Benchmark_RoundTripClient_stub + sharedname = RoundTripClient_exec + libs += RoundTripClient_stub Benchmark_stub + libpaths += .. + dynamicflags = ROUNDTRIPCLIENT_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RoundTripClientEC.cpp + RoundTripClientEIC.cpp + RoundTripClient_exec.cpp + } + + Header_Files { + RoundTripClientEC.h + RoundTripClientEIC.h + RoundTripClient_exec.h + RoundTripClient_exec_export.h + } + + Inline_Files { + RoundTripClientEC.inl + RoundTripClientEIC.inl + } +} + + +project(Benchmark_RoundTripClient_svnt) : ciao_servant, avoids_ace_for_tao { + after += Benchmark_skel Benchmark_RoundTripClient_exec + sharedname = RoundTripClient_svnt + libs += RoundTripClient_exec \ + RoundTripClient_stub \ + Benchmark_skel \ + Benchmark_stub + libpaths += .. + dynamicflags = ROUNDTRIPCLIENT_SVNT_BUILD_DLL + + IDL_Files { + } + + Source_Files { + RoundTripClientS.cpp + RoundTripClient_svnt.cpp + } + + Header_Files { + RoundTripClientS.h + RoundTripClient_svnt.h + RoundTripClient_svnt_export.h + } + + Inline_Files { + RoundTripClientS.inl + } +} + +project (RoundTripClient_client) : ccm_stub, valuetype, avoids_ace_for_tao { + exename = client + after += Benchmark_RoundTripClient_stub + libs += RoundTripClient_stub Benchmark_stub + libpaths += .. + IDL_Files { + } + + Source_Files { + client.cpp + } + + Header_Files { + } + + Inline_Files { + } +} + 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..784abd168d4 --- /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..8896138b6ab --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec.cpp @@ -0,0 +1,158 @@ +// $Id$ + +#include "ace/Stats.h" +#include "ace/Throughput_Stats.h" +#include "ace/Sample_History.h" +#include "ace/High_Res_Timer.h" +#include "ace/Env_Value_T.h" +#include "ciao/Logger/Log_Macros.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) +{ + CIAO_DEBUG ((LM_TRACE, CLINFO + "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::configuration_complete () +{ +} + +void +MyImpl::RoundTripClient_exec_i::ccm_activate () +{ + CIAO_DEBUG ((LM_TRACE, CLINFO "MyImpl::RoundTripClient_exec_i::ccm_activate\n")); +} + +void +MyImpl::RoundTripClient_exec_i::start () +{ + ///////////// Start test ///////////////////////////////////////// + + // Let's try to start tests from here... + Benchmark::LatencyTest_var lt = + context_->get_connection_latency (); + + CIAO_DEBUG ((LM_INFO, CLINFO + "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 (); + + CIAO_DEBUG ((LM_DEBUG, CLINFO"test finished\n")); + + CIAO_DEBUG ((LM_DEBUG, CLINFO"High resolution timer calibration....")); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + CIAO_DEBUG ((LM_DEBUG, CLINFO"done\n")); + + ACE_Env_Value<int> envar (ACE_TEXT("CIAO_DUMP_SAMPLE_HISTORY"), 0); + if (envar != 0) + { + history.dump_samples (ACE_TEXT("HISTORY"), gsf); + } + + ACE_Basic_Stats stats; + history.collect_basic_stats (stats); + stats.dump_results (ACE_TEXT("Total"), gsf); + + ACE_Throughput_Stats::dump_throughput (ACE_TEXT("Total"), + gsf, + test_end - test_start, + stats.samples_count ()); + +} + +::Benchmark::CCM_Controller_ptr +MyImpl::RoundTripClient_exec_i::get_controller () +{ + return ::Benchmark::CCM_Controller::_duplicate (this); +} + + +void +MyImpl::RoundTripClient_exec_i::ccm_passivate () +{ + CIAO_DEBUG ((LM_TRACE, CLINFO "MyImpl::RoundTripClient_exec_i::ccm_passivate\n")); +} + +void +MyImpl::RoundTripClient_exec_i::ccm_remove () +{ + CIAO_DEBUG ((LM_TRACE, CLINFO "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 () +{ + return new MyImpl::RoundTripClient_exec_i; +} + + +extern "C" ROUNDTRIPCLIENT_EXEC_Export ::Components::HomeExecutorBase_ptr +createRoundTripClientHome_Impl (void) +{ + CIAO_DEBUG ((LM_INFO, CLINFO "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..117ad723c01 --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/RoundTripClient_exec.h @@ -0,0 +1,92 @@ +// $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 ::CORBA::LocalObject + { + + public: + /// Default constructor. + RoundTripClient_exec_i (); + + /// Default destructor. + ~RoundTripClient_exec_i (); + + // Operations from Components::SessionComponent + virtual void set_session_context (Components::SessionContext_ptr ctx); + + virtual void configuration_complete (); + + virtual void ccm_activate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + virtual ::Benchmark::CCM_Controller_ptr + get_controller (); + + virtual void start (); + + + 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 ::CORBA::LocalObject + { + public: + /// Default ctor. + RoundTripClientHome_exec_i (); + + /// Default dtor. + ~RoundTripClientHome_exec_i (); + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (); + }; + +} + +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/client.cpp b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/client.cpp new file mode 100644 index 00000000000..5d75029d1bb --- /dev/null +++ b/modules/CIAO/performance-tests/Benchmark/RoundTripClient/client.cpp @@ -0,0 +1,49 @@ +// $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 +ACE_TMAIN (int argc, ACE_TCHAR *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..dc6ac7c8ea1 --- /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, $PerlACE::wait_interval_for_process_creation) == -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, $PerlACE::wait_interval_for_process_creation) == -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, $PerlACE::wait_interval_for_process_creation) == -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..eba3cc1d6cb --- /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, $PerlACE::wait_interval_for_process_creation) == -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, $PerlACE::wait_interval_for_process_creation) == -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; |