diff options
author | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2007-03-18 22:23:37 +0000 |
---|---|---|
committer | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2007-03-18 22:23:37 +0000 |
commit | 06a34455bd98b1379cc69bbc5b2cf085e0fc0d9b (patch) | |
tree | 8815ce3b3a85c3c4285429295f338e00ea4497f4 /CIAO/performance-tests/Benchmark/RoundTrip | |
parent | d66fcc9b4aaec8e88eeb83fc578fdf8a3cc963de (diff) | |
download | ATCD-Static_RT_DAnCE.tar.gz |
Diffstat (limited to 'CIAO/performance-tests/Benchmark/RoundTrip')
13 files changed, 870 insertions, 0 deletions
diff --git a/CIAO/performance-tests/Benchmark/RoundTrip/README b/CIAO/performance-tests/Benchmark/RoundTrip/README new file mode 100644 index 00000000000..8bd003eaf72 --- /dev/null +++ b/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/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.cidl b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.cidl new file mode 100644 index 00000000000..724789ac42d --- /dev/null +++ b/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/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.idl b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.idl new file mode 100644 index 00000000000..73a00422297 --- /dev/null +++ b/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/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.mpc b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip.mpc new file mode 100644 index 00000000000..3a6e310d8ae --- /dev/null +++ b/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/CIAO/performance-tests/Benchmark/RoundTrip/RoundTripEI.idl b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTripEI.idl new file mode 100644 index 00000000000..a28de5948d2 --- /dev/null +++ b/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/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.cpp b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.cpp new file mode 100644 index 00000000000..23bc35c438d --- /dev/null +++ b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.cpp @@ -0,0 +1,135 @@ +// $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 () +{ + return ::Benchmark::CCM_LatencyTest::_duplicate (this); +} + +/* Main method that invokes the octet_sequence */ +CORBA::Long +MyImpl::RoundTrip_exec_i::makeCall (CORBA::Long data) +{ + return data * data * data; +} + +// Operations from Components::SessionComponent +void +MyImpl::RoundTrip_exec_i::set_session_context ( + Components::SessionContext_ptr ctx) +{ + 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 () +{ +} + +void +MyImpl::RoundTrip_exec_i::ccm_activate () +{ + 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 () +{ + +} + +void +MyImpl::RoundTrip_exec_i::ccm_passivate () +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::RoundTrip_exec_i::ccm_passivate\n")); +} + +void +MyImpl::RoundTrip_exec_i::ccm_remove () +{ + 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 () +{ + 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/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.h b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.h new file mode 100644 index 00000000000..c4881d7515f --- /dev/null +++ b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec.h @@ -0,0 +1,105 @@ +// -*- 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); + + virtual ::Benchmark::CCM_LatencyTest* + get_latency (); + + // Operations from Components::SessionComponent + virtual void set_session_context (Components::SessionContext_ptr ctx); + + virtual void ciao_preactivate (); + + virtual void ccm_activate (); + + virtual void ciao_postactivate (); + + virtual void ccm_passivate (); + + virtual void ccm_remove (); + + /// 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 (); + + protected: + + /// Destructor. + ~RoundTripHome_exec_i (); + + }; + +} + +extern "C" ROUNDTRIP_EXEC_Export ::Components::HomeExecutorBase_ptr +createRoundTripHome_Impl (void); + +#endif /* ROUNDTRIP_EXEC_H */ diff --git a/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec_export.h b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_exec_export.h new file mode 100644 index 00000000000..41abae47f67 --- /dev/null +++ b/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/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_stub_export.h b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_stub_export.h new file mode 100644 index 00000000000..3300c0a8b9d --- /dev/null +++ b/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/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_svnt_export.h b/CIAO/performance-tests/Benchmark/RoundTrip/RoundTrip_svnt_export.h new file mode 100644 index 00000000000..9db7ca9eaa3 --- /dev/null +++ b/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/CIAO/performance-tests/Benchmark/RoundTrip/client.cpp b/CIAO/performance-tests/Benchmark/RoundTrip/client.cpp new file mode 100644 index 00000000000..9de1cb46a2d --- /dev/null +++ b/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/CIAO/performance-tests/Benchmark/RoundTrip/run_test.pl b/CIAO/performance-tests/Benchmark/RoundTrip/run_test.pl new file mode 100755 index 00000000000..584351da998 --- /dev/null +++ b/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/CIAO/performance-tests/Benchmark/RoundTrip/svc.conf b/CIAO/performance-tests/Benchmark/RoundTrip/svc.conf new file mode 100644 index 00000000000..e1706aae4e5 --- /dev/null +++ b/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" |