diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
commit | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (patch) | |
tree | 197c810e5f5bce17b1233a7cb8d7b50c0bcd25e2 /TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline | |
parent | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (diff) | |
download | ATCD-3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline')
13 files changed, 859 insertions, 0 deletions
diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Makefile.am b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Makefile.am new file mode 100644 index 00000000000..b536939e7c1 --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Makefile.am @@ -0,0 +1,170 @@ +## Process this file with automake to create Makefile.in +## +## $Id$ +## +## This file was generated by MPC. Any changes made directly to +## this file will be lost the next time it is generated. +## +## MPC Command: +## ../bin/mwc.pl -type automake -noreldefs TAO.mwc + +ACE_BUILDDIR = $(top_builddir)/.. +ACE_ROOT = $(top_srcdir)/.. +TAO_BUILDDIR = $(top_builddir) +TAO_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl +TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl +TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/gperf +TAO_ROOT = $(top_srcdir) + +noinst_PROGRAMS = + +## Makefile.RTCORBA_Baseline_IDL.am + +if BUILD_CORBA_MESSAGING +if BUILD_RT_CORBA +if !BUILD_ACE_FOR_TAO +if !BUILD_MINIMUM_CORBA + +BUILT_SOURCES = \ + TestC.cpp \ + TestC.h \ + TestC.inl \ + TestS.cpp \ + TestS.h \ + TestS.inl \ + TestS_T.cpp \ + TestS_T.h \ + TestS_T.inl + +CLEANFILES = \ + Test-stamp \ + TestC.cpp \ + TestC.h \ + TestC.inl \ + TestS.cpp \ + TestS.h \ + TestS.inl \ + TestS_T.cpp \ + TestS_T.h \ + TestS_T.inl + +TestC.cpp TestC.h TestC.inl TestS.cpp TestS.h TestS.inl TestS_T.cpp TestS_T.h TestS_T.inl: Test-stamp + +Test-stamp: $(srcdir)/Test.idl $(TAO_IDL_DEP) + $(TAO_IDL) $(TAO_IDLFLAGS) -I$(TAO_ROOT)/orbsvcs -GT $(srcdir)/Test.idl + @touch $@ + + +noinst_HEADERS = \ + Test.idl + +endif !BUILD_MINIMUM_CORBA +endif !BUILD_ACE_FOR_TAO +endif BUILD_RT_CORBA +endif BUILD_CORBA_MESSAGING + +## Makefile.RTCORBA_Baseline_Client.am + +if BUILD_CORBA_MESSAGING +if BUILD_RT_CORBA +if !BUILD_ACE_FOR_TAO +if !BUILD_MINIMUM_CORBA + +noinst_PROGRAMS += client + +client_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) \ + -I$(TAO_ROOT) \ + -I$(TAO_BUILDDIR) \ + -I$(TAO_ROOT)/orbsvcs \ + -I$(TAO_BUILDDIR)/orbsvcs \ + -I$(srcdir)/../lib + +client_SOURCES = \ + TestC.cpp \ + client.cpp \ + Roundtrip.h + +client_LDADD = \ + $(TAO_BUILDDIR)/orbsvcs/performance-tests/RTEvent/lib/libTAO_RTEC_Perf.la \ + $(TAO_BUILDDIR)/tao/libTAO_Strategies.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_RTCORBAEvent.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_RTEvent_Serv.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_RTEvent_Skel.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_RTEvent.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \ + $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \ + $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \ + $(TAO_BUILDDIR)/tao/libTAO_RTPortableServer.la \ + $(TAO_BUILDDIR)/tao/libTAO_RTCORBA.la \ + $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ + $(TAO_BUILDDIR)/tao/libTAO_PI.la \ + $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \ + $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ + $(TAO_BUILDDIR)/tao/libTAO.la \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_MINIMUM_CORBA +endif !BUILD_ACE_FOR_TAO +endif BUILD_RT_CORBA +endif BUILD_CORBA_MESSAGING + +## Makefile.RTCORBA_Baseline_Server.am + +if BUILD_CORBA_MESSAGING +if BUILD_RT_CORBA +if !BUILD_ACE_FOR_TAO +if !BUILD_MINIMUM_CORBA + +noinst_PROGRAMS += server + +server_CPPFLAGS = \ + -I$(ACE_ROOT) \ + -I$(ACE_BUILDDIR) \ + -I$(TAO_ROOT) \ + -I$(TAO_BUILDDIR) \ + -I$(TAO_ROOT)/orbsvcs \ + -I$(TAO_BUILDDIR)/orbsvcs \ + -I$(srcdir)/../lib + +server_SOURCES = \ + Roundtrip.cpp \ + TestC.cpp \ + TestS.cpp \ + server.cpp \ + Roundtrip.h + +server_LDADD = \ + $(TAO_BUILDDIR)/orbsvcs/performance-tests/RTEvent/lib/libTAO_RTEC_Perf.la \ + $(TAO_BUILDDIR)/tao/libTAO_Strategies.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_RTCORBAEvent.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_RTEvent_Serv.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_RTEvent_Skel.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_RTEvent.la \ + $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_Svc_Utils.la \ + $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \ + $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \ + $(TAO_BUILDDIR)/tao/libTAO_RTPortableServer.la \ + $(TAO_BUILDDIR)/tao/libTAO_RTCORBA.la \ + $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \ + $(TAO_BUILDDIR)/tao/libTAO_PI.la \ + $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \ + $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \ + $(TAO_BUILDDIR)/tao/libTAO.la \ + $(ACE_BUILDDIR)/ace/libACE.la + +endif !BUILD_MINIMUM_CORBA +endif !BUILD_ACE_FOR_TAO +endif BUILD_RT_CORBA +endif BUILD_CORBA_MESSAGING + +## Clean up template repositories, etc. +clean-local: + -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.* + -rm -f gcctemp.c gcctemp so_locations *.ics + -rm -rf cxx_repository ptrepository ti_files + -rm -rf templateregistry ir.out + -rm -rf ptrepository SunWS_cache Templates.DB diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/RTCORBA_Baseline.mpc b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/RTCORBA_Baseline.mpc new file mode 100644 index 00000000000..188d5276fd9 --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/RTCORBA_Baseline.mpc @@ -0,0 +1,52 @@ +// $Id$ + +project(*IDL): orbsvcsexe, rtcorbaevent, strategies, minimum_corba { + + IDL_Files { + Test.idl + } + + custom_only = 1 +} + +project(*server): orbsvcsexe, rtcorbaevent, strategies, minimum_corba { + after += RTEC_Perf + libs += TAO_RTEC_Perf + + specific (automake) { + includes += $(srcdir)/../lib + } else { + includes += ../lib + } + + Source_Files { + server.cpp + Roundtrip.cpp + TestS.cpp + TestC.cpp + } + + after += *IDL + IDL_Files { + } +} + +project(*client): orbsvcsexe, rtcorbaevent, strategies, minimum_corba { + after += RTEC_Perf + libs += TAO_RTEC_Perf + + specific (automake) { + includes += $(srcdir)/../lib + } else { + includes += ../lib + } + + Source_Files { + TestC.cpp + client.cpp + } + + after += *IDL + IDL_Files { + } +} diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Roundtrip.cpp b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Roundtrip.cpp new file mode 100644 index 00000000000..d4ef62e9781 --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Roundtrip.cpp @@ -0,0 +1,42 @@ +// +// $Id$ +// +#include "Roundtrip.h" +#include "ace/High_Res_Timer.h" + +ACE_RCSID (TAO_RTEC_Perf_RTCORBA_Baseline, + Roundtrip, + "$Id$") + +Roundtrip::Roundtrip (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) + , gsf_ (ACE_High_Res_Timer::calibrate ()) +{ +} + +Test::Timestamp +Roundtrip::test_method (Test::Timestamp send_time, + CORBA::Long workload_in_usecs + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_hrtime_t start = ACE_OS::gethrtime (); + CORBA::Long elapsed = 0; + + while (elapsed < workload_in_usecs) + { + elapsed = + static_cast<CORBA::Long> ( + (ACE_OS::gethrtime () - start) / this->gsf_ + ); + } + + return send_time; +} + +void +Roundtrip::shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Roundtrip.h b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Roundtrip.h new file mode 100644 index 00000000000..a4b01ce89b1 --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Roundtrip.h @@ -0,0 +1,38 @@ +// +// $Id$ +// + +#ifndef ROUNDTRIP_H +#define ROUNDTRIP_H +#include /**/ "ace/pre.h" + +#include "TestS.h" + +/// Implement the Test::Roundtrip interface +class Roundtrip + : public virtual POA_Test::Roundtrip +{ +public: + /// Constructor + Roundtrip (CORBA::ORB_ptr orb); + + // = The skeleton methods + virtual Test::Timestamp test_method (Test::Timestamp send_time, + CORBA::Long workload_in_usecs + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + +private: + /// Use an ORB reference to conver strings to objects and shutdown + /// the application. + CORBA::ORB_var orb_; + + /// Translate the high resolution timer units into microseconds + ACE_UINT32 gsf_; +}; + +#include /**/ "ace/post.h" +#endif /* ROUNDTRIP_H */ diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Test.idl b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Test.idl new file mode 100644 index 00000000000..7e72f72bcb5 --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/Test.idl @@ -0,0 +1,27 @@ +// +// $Id$ +// + +/// A simple module to avoid namespace pollution +module Test +{ + /// Use a timestamp to measure the roundtrip delay + typedef unsigned long long Timestamp; + + /// Measure roundtrip delay + 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. + */ + Timestamp test_method (in Timestamp send_time, + in long workload_in_usecs); + + /// Shutdown the ORB + void shutdown (); + }; +}; diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/client.cpp b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/client.cpp new file mode 100644 index 00000000000..a3caafe3b54 --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/client.cpp @@ -0,0 +1,280 @@ +// $Id$ + +#include "RT_Class.h" +#include "ORB_Holder.h" +#include "RIR_Narrow.h" +#include "RTClient_Setup.h" +#include "Client_Options.h" +#include "TestC.h" + +#include "tao/Messaging/Messaging.h" +#include "tao/Strategies/advanced_resource.h" +#include "tao/RTPortableServer/RTPortableServer.h" +#include "ace/Get_Opt.h" +#include "ace/Auto_Ptr.h" +#include "ace/High_Res_Timer.h" +#include "ace/Sample_History.h" +#include "ace/Basic_Stats.h" +#include "ace/Stats.h" +#include "ace/Task.h" +#include "ace/Barrier.h" +#include "ace/OS_NS_unistd.h" + +ACE_RCSID (TAO_RTEC_PERF_RTCORBA_Baseline, + client, + "$Id$") + +class Roundtrip_Task : public ACE_Task_Base +{ +public: + Roundtrip_Task (Test::Roundtrip_ptr roundtrip, + ACE_Barrier *the_barrier) + : roundtrip_ (Test::Roundtrip::_duplicate (roundtrip)) + , barrier_ (the_barrier) + { + } + + virtual void run_test (ACE_ENV_SINGLE_ARG_DECL) = 0; + + virtual int svc (void) + { + this->barrier_->wait (); + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + this->run_test (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + } + ACE_ENDTRY; + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) done...\n")); + return 0; + } + +protected: + Test::Roundtrip_var roundtrip_; + + ACE_Barrier *barrier_; +}; + +class High_Priority_Task : public Roundtrip_Task +{ +public: + High_Priority_Task (Test::Roundtrip_ptr roundtrip, + ACE_Barrier *the_barrier, + int iterations, + int period_in_usecs, + int workload) + : Roundtrip_Task (roundtrip, the_barrier) + , sample_history (iterations) + , iterations_ (iterations) + , period_in_usecs_ (period_in_usecs) + , workload_ (workload) + { + } + + virtual void run_test (ACE_ENV_SINGLE_ARG_DECL) + { + for (int i = 0; i != this->iterations_; ++i) + { + ACE_Time_Value period (0, this->period_in_usecs_); + ACE_OS::sleep (period); + + ACE_TRY { + ACE_hrtime_t start = ACE_OS::gethrtime (); + (void) this->roundtrip_->test_method (start, + this->workload_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + ACE_hrtime_t elapsed = ACE_OS::gethrtime () - start; + + this->sample_history.sample (elapsed); + + } ACE_CATCHANY { + } ACE_ENDTRY; + } + } + + ACE_Sample_History sample_history; + +private: + int iterations_; + + int period_in_usecs_; + + int workload_; +}; + +class Low_Priority_Task : public Roundtrip_Task +{ +public: + Low_Priority_Task (Test::Roundtrip_ptr roundtrip, + ACE_Barrier *the_barrier, + int period_in_usecs, + int workload) + : Roundtrip_Task (roundtrip, the_barrier) + , stopped_ (0) + , period_in_usecs_ (period_in_usecs) + , workload_ (workload) + { + } + + void stop (void) + { + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_); + this->stopped_ = 1; + } + + virtual void run_test (ACE_ENV_SINGLE_ARG_DECL) + { + for (;;) + { + ACE_Time_Value period (0, this->period_in_usecs_); + ACE_OS::sleep (period); + + { + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_); + if (this->stopped_) + return; + } + + ACE_TRY { + CORBA::ULongLong dummy = 0; + (void) this->roundtrip_->test_method (dummy, + this->workload_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + } ACE_CATCHANY { + } ACE_ENDTRY; + } + } + +private: + TAO_SYNCH_MUTEX mutex_; + + int stopped_; + + int period_in_usecs_; + + int workload_; +}; + +int main (int argc, char *argv[]) +{ + RT_Class rt_class; + + ACE_TRY_NEW_ENV + { + ORB_Holder orb (argc, argv, "" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Client_Options options (argc, argv); + if (argc != 1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Usage: %s " + "-i iterations (iterations) " + "-h high_priority_period (usecs) " + "-l low_priority_period (usecs) " + "-w high_priority_workload (usecs) " + "-v low_priority_workload (usecs) " + "-r (enable RT-CORBA) " + "-n nthreads (low priority thread) " + "-d (dump history) " + "-z (disable low priority) " + "\n", + argv [0]), + 1); + } + + RTClient_Setup rtclient_setup (options.use_rt_corba, + orb, + rt_class, + options.nthreads + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Finished ORB and POA configuration\n")); + + CORBA::Object_var object = + orb->string_to_object (options.ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Test::Roundtrip_var roundtrip = + Test::Roundtrip::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::PolicyList_var inconsistent_policies; + (void) roundtrip->_validate_connection (inconsistent_policies + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + int thread_count = 1 + options.nthreads; + ACE_Barrier the_barrier (thread_count); + + ACE_DEBUG ((LM_DEBUG, "Calibrating high res timer ....")); + ACE_High_Res_Timer::calibrate (); + + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + ACE_DEBUG ((LM_DEBUG, "Done (%d)\n", gsf)); + + int per_thread_period = options.low_priority_period; + if (options.global_low_priority_rate) + per_thread_period = options.low_priority_period * options.nthreads; + Low_Priority_Task low_priority (roundtrip.in (), &the_barrier, + per_thread_period, + options.low_priority_workload); + low_priority.activate (rt_class.thr_sched_class () + | THR_NEW_LWP | THR_JOINABLE, + options.nthreads, 1, + rt_class.priority_low ()); + + High_Priority_Task high_priority (roundtrip.in (), &the_barrier, + options.iterations, + options.high_priority_period, + options.high_priority_workload); + high_priority.activate (rt_class.thr_sched_class () + | THR_NEW_LWP | THR_JOINABLE, + 1, 1, + rt_class.priority_low ()); + + high_priority.wait (); + low_priority.stop (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) client - high prio task joined\n")); + + ACE_Sample_History &history = high_priority.sample_history; + if (options.dump_history) + { + history.dump_samples ("HISTORY", gsf); + } + + ACE_Basic_Stats high_priority_stats; + history.collect_basic_stats (high_priority_stats); + high_priority_stats.dump_results ("High Priority", gsf); + + low_priority.thr_mgr ()->wait (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) client - all task(s) joined\n")); + + roundtrip->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) client - starting cleanup\n")); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/generate_cmp.sh b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/generate_cmp.sh new file mode 100755 index 00000000000..2c7c555e9e8 --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/generate_cmp.sh @@ -0,0 +1,10 @@ +#/bin/sh + +for i in reactive rtcorba; do + echo $i ; + for j in 99 999 9999; do + paste $i.avg.dat ${i}.${j}.dat | + awk '{print $1, $4 / $2}' > $i.${j}.cmp.dat + done +done + diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/generate_histo.sh b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/generate_histo.sh new file mode 100755 index 00000000000..9837c080edf --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/generate_histo.sh @@ -0,0 +1,8 @@ +#/bin/sh + +for i in *.txt; do + b=`basename $i .txt` + echo $i + awk '/^HISTO/ {print $3}' $i | sort -n | uniq -c | + awk '{print $2, 100.0 * $1 / 20000.0}' > $b.histo.dat +done diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/generate_percentiles.sh b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/generate_percentiles.sh new file mode 100755 index 00000000000..8d0914a6c16 --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/generate_percentiles.sh @@ -0,0 +1,47 @@ +#/bin/sh + +. parameters + +PERCENTILES="0 .25 .50 .75 .99 .999 .9999 1" + +for t in $*; do + cat /dev/null > ${t}.avg.dat + for p in $PERCENTILES; do + cat /dev/null > ${t}$p.percentile.dat + done + + for c in $NCONSUMERS; do + echo $t $c + INPUT=${t}.${c}.txt + awk -v c=$c '/^HISTO/ { + n++; + s += $3 + } + END { + printf("%d %f\n", c, s/n); + }' $INPUT >> ${t}.avg.dat + + TFILE=/tmp/${t}.$$ + awk '/^HISTO/ {print $3}' $INPUT | sort -n | uniq -c > $TFILE + for p in $PERCENTILES; do + awk -v N=$ITERATIONS '{print $2, $1 / N}' $TFILE | + awk -v c=$c -v p=${p} '\ +BEGIN { x = 0; l = 0; } +{ s += $2; + l = $1; + if (x == 0 && s >= p) { + x = $1; + } +} +END { + if (s < p) { + x = l; + } + printf("%d %f\n", c, x); +}' >> ${t}${p}.percentile.dat + done + /bin/rm -f $TFILE + + done + +done diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/realtime.conf b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/realtime.conf new file mode 100644 index 00000000000..493ad253959 --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/realtime.conf @@ -0,0 +1,2 @@ +# $Id$ +static RT_ORB_Loader "-ORBSchedPolicy SCHED_FIFO -ORBPriorityMapping direct" diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/realtime.conf.xml b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/realtime.conf.xml new file mode 100644 index 00000000000..86ba9fd5fbf --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/realtime.conf.xml @@ -0,0 +1,6 @@ +<?xml version='1.0'?> +<!-- Converted from ./orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/realtime.conf by svcconf-convert.pl --> +<ACE_Svc_Conf> + <!-- $Id$ --> + <static id="RT_ORB_Loader" params="-ORBSchedPolicy SCHED_FIFO -ORBPriorityMapping direct"/> +</ACE_Svc_Conf> diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/run.sh b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/run.sh new file mode 100755 index 00000000000..925ea8751dc --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/run.sh @@ -0,0 +1,40 @@ +#! /bin/sh +# +# $Id$ +# + +LOW_PRIORITY="1 4 8 12 16 20 24 28 32" + +ITERATIONS=10000 + +#IOR=/project/amras/coryan/IOR/roundtrip.ior +IOR=test.ior + +for c in $LOW_PRIORITY; do + date + echo rtcorba $c + + /bin/rm -f $IOR +# ssh celegorm "cd /project/celegorm/coryan/RTCORBA_Baseline ; ./server -ORBSvcConf realtime.conf -r -n $c -o $IOR" >server.log 2>&1 </dev/null & + ./server -ORBSvcConf realtime.conf -r -n $c -o $IOR >server.log 2>&1 </dev/null & + while [ ! -f $IOR ]; do + sleep 1 + done + ./client -ORBSvcConf realtime.conf -g -r -d -h 0 -l 0 -w 9000 -i $ITERATIONS -n $c -k file://$IOR > rtcorba.$c.txt 2>&1 + sleep 5 + wait + + date + echo reactive $c + + /bin/rm -f $IOR +# ssh celegorm "cd /project/celegorm/coryan/RTCORBA_Baseline ; ./server -n $c -o $IOR" >server.log 2>&1 </dev/null & + ./server -n $c -o $IOR >server.log 2>&1 </dev/null & + while [ ! -f $IOR ]; do + sleep 1 + done + ./client -g -d -h 0 -l 0 -w 9000 -i $ITERATIONS -n $c -k file://$IOR > reactive.$c.txt 2>&1 + sleep 5 + wait + +done diff --git a/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/server.cpp b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/server.cpp new file mode 100644 index 00000000000..f82199ba24e --- /dev/null +++ b/TAO/orbsvcs/performance-tests/RTEvent/RTCORBA_Baseline/server.cpp @@ -0,0 +1,137 @@ +// $Id$ + +#include "RT_Class.h" +#include "ORB_Holder.h" +#include "Servant_var.h" +#include "RIR_Narrow.h" +#include "RTServer_Setup.h" +#include "Roundtrip.h" + +#include "tao/PortableServer/PortableServer.h" +#include "tao/RTPortableServer/RTPortableServer.h" +#include "tao/Strategies/advanced_resource.h" +#include "tao/Messaging/Messaging.h" +#include "ace/Get_Opt.h" +#include "ace/Auto_Ptr.h" + +ACE_RCSID (TAO_PERF_RTEC_RTCORBA_Baseline, + server, + "$Id$") + +const char *ior_output_file = "test.ior"; +int use_rt_corba = 0; +int nthreads = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "o:n:r"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + + case 'n': + nthreads = ACE_OS::atoi (get_opts.opt_arg ()); + break; + + case 'r': + use_rt_corba = 1; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-o <iorfile> " + "-r (use RT-CORBA) " + "-n nthreads " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int main (int argc, char *argv[]) +{ + /// Move the test to the real-time class if it is possible. + RT_Class rt_class; + + ACE_TRY_NEW_ENV + { + ORB_Holder orb (argc, argv, "" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + RTServer_Setup rtserver_setup (use_rt_corba, + orb, + rt_class, + nthreads + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var root_poa = + RIR_Narrow<PortableServer::POA>::resolve (orb, + "RootPOA" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POA_var the_poa (rtserver_setup.poa ()); + + Servant_var<Roundtrip> roundtrip (new Roundtrip (orb)); + + PortableServer::ObjectId_var id = + the_poa->activate_object (roundtrip.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var object = + the_poa->id_to_reference (id.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var ior = + orb->object_to_string (object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Output the ior to the <ior_output_file> + FILE *output_file = ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file for writing IOR: %s", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} |