diff options
Diffstat (limited to 'modules/CIAO/performance-tests/mico/mico-thrput-st')
8 files changed, 305 insertions, 0 deletions
diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/README b/modules/CIAO/performance-tests/mico/mico-thrput-st/README new file mode 100644 index 00000000000..ee534c0c0a4 --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/README @@ -0,0 +1,26 @@ +// +//$Id$ +// +Throughput Experiment +==================== + +This experiment is used to gather latency and throughput related metrics for MICO ORB. +The benchmark uses ACE to analyze the data sample and generate results. In order to run +this benchmark the following is required + +1: MICO ORB configured in single-threaded mode +2: This directory placed under $MICO_ROOT/demo/<name-of-directory> +3: The envrionment setting required for running this test is provided in + the mico-env file. +4: These tests can only run on *nix systems as of now. For windows project files will + be added shortly + +Compilation +=========== +To compile the files + +$make + +To run the experiment +===================== +./RoundTrip diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip new file mode 100755 index 00000000000..395ef4f73e4 --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip @@ -0,0 +1,40 @@ +#!/bin/sh + +MICORC=/dev/null +export MICORC + +# run Naming Service + +echo "Starting Naming Service ..." + +rm -f nsd.ior +nsd --ior nsd.ior & +nsd_pid=$! + +trap "kill $nsd_pid > /dev/null 2> /dev/null" 0 + +# wait for Naming Service to start + +for i in 0 1 2 3 4 5 6 7 8 9 ; do + if test -r nsd.ior ; then break ; else sleep 1 ; fi +done + +# start Server + +echo "Starting Server ..." + +./server -ORBInitRef NameService=file://`pwd`/nsd.ior & +server_pid=$! + +trap "kill $nsd_pid $server_pid > /dev/null 2> /dev/null" 0 + +# give server some time to start + +sleep 3 + +# run Client + +echo "Running Client ..." + +./client -ORBInitRef NameService=file://`pwd`/nsd.ior -i 500000 + diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip.idl b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip.idl new file mode 100644 index 00000000000..475433dfec4 --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip.idl @@ -0,0 +1,13 @@ +//$Id$ +interface Roundtrip +{ + /// A simple method to measure roundtrip delays + /** + * The operation simply returns its argument, this is used in AMI + * and deferred synchronous tests to measure the roundtrip delay + * without the need for a different reply handler for each + * request. + */ + unsigned long long test_method (in unsigned long long send_time); + +}; diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.cc b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.cc new file mode 100644 index 00000000000..88338765186 --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.cc @@ -0,0 +1,10 @@ +// +//$Id$ +// + +#include "RoundTrip_impl.h" + +CORBA::ULongLong RoundTrip_impl::test_method (CORBA::ULongLong send_time) +{ + return send_time; +} diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.h b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.h new file mode 100644 index 00000000000..86213cf1b9d --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/RoundTrip_impl.h @@ -0,0 +1,9 @@ +// +//$Id$ +// +#include "RoundTrip.h" + +class RoundTrip_impl : virtual public POA_Roundtrip { + public: + CORBA::ULongLong test_method (CORBA::ULongLong send_time); +}; diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/client.cc b/modules/CIAO/performance-tests/mico/mico-thrput-st/client.cc new file mode 100644 index 00000000000..74e04bcdf2b --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/client.cc @@ -0,0 +1,150 @@ +// +//$Id$ +// +//FUZZ: disable check_for_missing_rir_env + +#define USE_POA +//#define NESTED + +#include <CORBA.h> +#include <coss/CosNaming.h> + +#ifdef HAVE_ANSI_CPLUSPLUS_HEADERS +#include <iostream> +#else // HAVE_ANSI_CPLUSPLUS_HEADERS +#include <iostream.h> +#endif // HAVE_ANSI_CPLUSPLUS_HEADERS + +#include "RoundTrip.h" + +#include "ace/Get_Opt.h" +#include "ace/High_Res_Timer.h" +#include "ace/Sched_Params.h" +#include "ace/Stats.h" +#include "ace/Sample_History.h" + +using namespace std; + + +int do_dump_history = 0; +int niterations = 1000; + +int +parse_args (int argc, char *argv[]) +{ + //parse arguments + ACE_Get_Opt get_opts (argc, argv, "hxi:"); + char c; + while ((c = get_opts ()) != -1) + switch (c) + { + case 'h': + do_dump_history = 1; + break; + + case 'i': + niterations = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case '?': + default: + /* Could be any other parameter like -ORBSvcConf file so ignore */ + break; + } + // Indicates sucessful parsing of the command line + return 0; +} + +void +set_priority () +{ + int priority = + (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) + + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; + // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. + + if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, + priority, + ACE_SCOPE_PROCESS)) != 0) + { + if (ACE_OS::last_error () == EPERM) + { + ACE_DEBUG ((LM_DEBUG, + "client (%P|%t): user is not superuser, " + "test runs in time-shared class\n")); + } + else + ACE_ERROR ((LM_ERROR, + "client (%P|%t): sched_params failed\n")); + } + +} + +int +main (int argc, char *argv[]) +{ + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + CORBA::Object_var obj = orb->resolve_initial_references ("NameService"); + CosNaming::NamingContextExt_var nc = + CosNaming::NamingContextExt::_narrow (obj); + assert (!CORBA::is_nil (nc)); + + //Obtain reference from the naming context + obj = nc->resolve_str ("RoundTrip"); + + Roundtrip_var bench = Roundtrip::_narrow (obj); + + parse_args(argc, argv); + set_priority(); + + //Warmup the System by making some empty calls + CORBA::Long start = 0L; + for (int j = 0; j < 100; ++j) + { + bench->test_method (start); + } + + + CORBA::ULongLong time_stamp = 1234; + ACE_Sample_History history (niterations); + ACE_hrtime_t test_start = ACE_OS::gethrtime (); + + for (int i = 0; i < niterations; ++i) + { + + ACE_hrtime_t start = ACE_OS::gethrtime (); + + bench->test_method (time_stamp); + + ACE_hrtime_t now = ACE_OS::gethrtime (); + history.sample (now - start); + } + + ACE_hrtime_t test_end = ACE_OS::gethrtime (); + + ACE_DEBUG ((LM_DEBUG, "test finished\n")); + + ACE_DEBUG ((LM_DEBUG, "High resolution timer calibration....")); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + ACE_DEBUG ((LM_DEBUG, "done\n")); + + if (do_dump_history) + { + history.dump_samples ("HISTORY", gsf); + } + + ACE_Basic_Stats stats; + history.collect_basic_stats (stats); + stats.dump_results ("Total", gsf); + + ACE_Throughput_Stats::dump_throughput ("Total", gsf, + test_end - test_start, + stats.samples_count ()); + + //Remove the component + cout << "client finished" << endl; + + return 0; +} diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/mico-env b/modules/CIAO/performance-tests/mico/mico-thrput-st/mico-env new file mode 100755 index 00000000000..67b444acef9 --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/mico-env @@ -0,0 +1,14 @@ +############## +## MICO ENVIRONMENT SETTINGS +############# +# +# If MICO has been built in /build/ccm/mico-obj +# then add the following to your path and Library paths +# for Bash Shell: +# +#export PATH=/build/ccm/mico-obj/bin:$PATH +#export LD_LIBRARY_PATH=/build/ccm/mico-obj/lib:$LD_LIBRARY_PATH +# +# Note: The place where object files and binaries are built could be +# different from source files. The environment variables use the obj +# path rather than source path diff --git a/modules/CIAO/performance-tests/mico/mico-thrput-st/server.cc b/modules/CIAO/performance-tests/mico/mico-thrput-st/server.cc new file mode 100644 index 00000000000..9bf90eda0ed --- /dev/null +++ b/modules/CIAO/performance-tests/mico/mico-thrput-st/server.cc @@ -0,0 +1,43 @@ +// +//$Id$ +// +// FUZZ: disable check_for_missing_rir_env +#include <CORBA.h> +#include <coss/CosNaming.h> + +#ifdef HAVE_ANSI_CPLUSPLUS_HEADERS +#include <iostream> +#else // HAVE_ANSI_CPLUSPLUS_HEADERS +#include <iostream.h> +#endif // HAVE_ANSI_CPLUSPLUS_HEADERS + +#include "RoundTrip_impl.h" +int +main (int argc, char *argv[]) +{ + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "mico-local-orb"); + + //Obtain reference to Naming service + CORBA::Object_var naming_context_object = + orb->resolve_initial_references ("NameService"); + CosNaming::NamingContext_var naming_context = + CosNaming::NamingContext::_narrow (naming_context_object.in ()); + + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow (obj); + RoundTrip_impl* rt_impl = new RoundTrip_impl(); + PortableServer::ObjectId_var oid = poa->activate_object (rt_impl); + Roundtrip_var rt_obj = rt_impl->_this(); + + //Add to Naming Service + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup ("RoundTrip"); + naming_context->bind (name, rt_obj.in()); + + //allow incoming requests + poa->the_POAManager()->activate(); + + orb->run (); + return 0; +} |