diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-11-28 21:39:06 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-11-28 21:39:06 +0000 |
commit | 00fd3dba59786f3635a7bf1e903369cbe4835ac0 (patch) | |
tree | 740d0aba8a36ba162a2651778e15b89757960f7b | |
parent | 1497cae058f1a6595c0abe5b465f64a5b599e58c (diff) | |
download | ATCD-00fd3dba59786f3635a7bf1e903369cbe4835ac0.tar.gz |
ChangeLogTag:Fri Nov 28 14:32:58 2003 Nanbor Wang <nanbor@cse.wustl.edu>
14 files changed, 998 insertions, 17 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index b02f852c2a7..0ed94cbc029 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,69 @@ +Fri Nov 28 14:32:58 2003 Nanbor Wang <nanbor@cse.wustl.edu> + + * tests/RTCCM/Priority_Test/Controllers/Controller.mpc: + * tests/RTCCM/Priority_Test/Controllers/Rate_Controller.cpp: + * tests/RTCCM/Priority_Test/Controllers/Rate_Controller.h: + * tests/RTCCM/Priority_Test/Controllers/Pulser.cpp: + * tests/RTCCM/Priority_Test/Controllers/Pulser.h: Added a new rate + generating component implementation and provide 3 components + generating 25, 50, and 75 hz "trigger" using 3 different entry + points to the component executor. + + * tests/RTCCM/Priority_Test/Controllers/client.cpp: Changed to + perform the test with on/off method invocation. + + * tests/RTCCM/Priority_Test/descriptors/basic_test.pl: Made the + script most robust by extracting cad file, deployment + configuration etc into variables. + + * tests/RTCCM/Priority_Test/descriptors/CIAO_Installation_Data.ini: + * tests/RTCCM/Priority_Test/descriptors/Controller25.csd: + * tests/RTCCM/Priority_Test/descriptors/Controller50.csd: + * tests/RTCCM/Priority_Test/descriptors/Controller75.csd: + * tests/RTCCM/Priority_Test/descriptors/demo-25.cad: + * tests/RTCCM/Priority_Test/descriptors/demo-50.cad: Added the + meta information for the new rate geneartion components. + +Mon Nov 24 23:56:49 2003 Nanbor Wang <nanbor@cse.wustl.edu> + + * tests/RTCCM/Priority_Test/Priority_Test.idl: + * tests/RTCCM/Priority_Test/Controllers/Controller_exec.cpp: + * tests/RTCCM/Priority_Test/Controllers/Controller_exec.h: + * tests/RTCCM/Priority_Test/Controllers/client.cpp: Changed the + Op_Mode interface from a single perform_work operation to + start/stop operations for triggering and stopping controller. + The new start operation also pass an argument into the + controller. + + * tests/RTCCM/Priority_Test/descriptors/basic_test.pl: Changed the + script to run the test over a range of work load to test the + rate a system can handle over a range of work load. + + +Sun Nov 23 20:45:24 2003 Nanbor Wang <nanbor@cse.wustl.edu> + + * tools/Daemon/CIAO_Daemon.cpp: A small test for the existance of + component server executable but commented out because the test + didn't take into account of the executable extension on win32. + It was left in the code to make sure we don't forget to add the + check back later. + + * tests/RTCCM/Priority_Test/descriptors/NOTE-win.txt: + Notes on running the Priority_Test in a demo setting. + + * tools/Assembly_Deployer/Assembly_Deployer.cpp: Changed the + deployer to become a controller like command line tool. Now, + instead of building an assembly and wait for user input to tear + down the assembly and detroy the component server, this tool now + perform a single task, according to its command line flag. By + removing the need of user intervention, it makes it possible to + write clean auto-test scripts. + + * tests/RTCCM/Priority_Test/descriptors/basic_test.pl: Took + advantage of the new Assembly_Deployer and wrote this run_test + example that does not left stray component server process + behind. + Wed Nov 19 00:56:46 2003 Nanbor Wang <nanbor@cse.wustl.edu> * tools/Assembly_Deployer/README: diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Controller.mpc b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Controller.mpc index f1508f9ceec..1eb9ffc6f89 100644 --- a/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Controller.mpc +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Controller.mpc @@ -58,6 +58,25 @@ project(Priority_Test_Controller_exec) : ciao_component { } } +project(Priority_Test_Rate_Controller_exec) : ciao_component { + after += Priority_Test_Controller_svnt + sharedname = Rate_Controller_exec + libs += Controller_stub Controller_svnt Priority_Test_stub Priority_Test_svnt + libpaths += .. + idlflags += -Wb,export_macro=CONTROLLER_EXEC_Export -Wb,export_include=Controller_exec_export.h + dynamicflags = CONTROLLER_EXEC_BUILD_DLL + + IDL_Files { + ControllerEI.idl + } + + Source_Files { + ControllerEIC.cpp + Rate_Controller.cpp + Pulser.cpp + } +} + project (*client) : ciao_client { exename = client after += Priority_Test_Controller_stub diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.cpp b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.cpp new file mode 100644 index 00000000000..41ec8e20f67 --- /dev/null +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.cpp @@ -0,0 +1,118 @@ +// $Id$ + +#include "Pulser.h" +#include "CIAO_common.h" +#include "ace/Timer_Queue.h" +#include "ace/Reactor.h" + +//================================================================= + +PTImpl::Pulser::Pulser (PTImpl::Pulse_Handler *cb) + : active_ (0), + done_ (0), + tid_ (0), + pulser_callback_ (cb) +{ + // Nothing + this->reactor (new ACE_Reactor); +} + +PTImpl::Pulser::~Pulser () +{ + delete this->reactor (); + this->reactor (0); +} + +int +PTImpl::Pulser::open () +{ + return this->activate (); +} + +int +PTImpl::Pulser::close () +{ + this->done_ = 1; + this->reactor ()->notify (); + + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "Waiting\n")); + return this->wait (); +} + +int +PTImpl::Pulser::start (CORBA::Long hertz) +{ + if (hertz == 0 || this->active_ != 0) // Not valid + return -1; + + long usec = 1000000 / hertz; + + this->tid_ = this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (0, usec), + ACE_Time_Value (0, usec)); + + this->active_ = 1; + return 0; +} + +int +PTImpl::Pulser::stop (void) +{ + if (this->active_ == 0) // Not valid. + return -1; + + this->reactor ()->cancel_timer (this); + + this->active_ = 0; + return 0; +} + +int +PTImpl::Pulser::active (void) +{ + return this->active_; +} + +int +PTImpl::Pulser::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), + this, + handle, + close_mask)); + + return 0; +} + +int +PTImpl::Pulser::handle_timeout (const ACE_Time_Value &, + const void *) +{ + this->pulser_callback_->pulse (); + +// ACE_DEBUG ((LM_DEBUG, +// ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"), +// this, +// tv.sec (), +// tv.usec ())); + + return 0; +} + +int +PTImpl::Pulser::svc (void) +{ + this->reactor ()->owner (ACE_OS::thr_self ()); + + while (!this->done_) + this->reactor ()->handle_events (); + + return 0; +} + +//================================================================= diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.h b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.h new file mode 100644 index 00000000000..9b0d8b6b4cc --- /dev/null +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.h @@ -0,0 +1,75 @@ +// $Id$ + +/** + * @file Pulser.h + * + * Header file for the Pulser class. + * + * @author Nanbor Wang <nanbor@cse.wustl.edu> + */ + +#ifndef PULSER_H +#define PULSER_H + +#include "corba.h" +#include "ace/Thread_Manager.h" +#include "ace/Task.h" + +namespace PTImpl +{ + // Forward decl. + class Pulse_Handler + { + public: + /// Helper function to be called back by Pulse_Handler + virtual void pulse (void) = 0; + }; + + /** + * @brief Active pulse generater + */ + class Pulser : public ACE_Task_Base + { + public: + // Default constructor + Pulser (Pulse_Handler *cb); + ~Pulser (); + + int open (void); + + int close (void); + + int start (CORBA::Long hertz); + + int stop (void); + + int active (void); + + // Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + // Called when <Time_Handler> is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + virtual int svc (void); + + private: + /// Tracking whether we are actively generating pulse or not. + long active_; + + /// Flag to indicate completion of this active object. + int done_; + + /// The timer id we are waiting. + int tid_; + + Pulse_Handler *pulser_callback_; + + ACE_Thread_Manager thr_mgr_; + }; + +} + +#endif /* PULSER_H */ diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Rate_Controller.cpp b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Rate_Controller.cpp new file mode 100644 index 00000000000..15d429a5d38 --- /dev/null +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Rate_Controller.cpp @@ -0,0 +1,221 @@ +// $Id$ + +#include "Rate_Controller.h" +#include "CIAO_common.h" + +/// Allocate sample history to take up to 5 minutes of samples. +const int MyImpl::Rate_Controller_i::sample_time_ = 5; + +/// Default constructor. +MyImpl::Rate_Controller_i::Rate_Controller_i (CORBA::Long hertz) + : rate_ (hertz), + pulser_ (this), + sampler_ (0) +{ +} + +/// Default destructor. +MyImpl::Rate_Controller_i::~Rate_Controller_i () +{ + delete this->sampler_; +} + +// Operations from Priority_Test::Controller +void +MyImpl::Rate_Controller_i::start (CORBA::Long arg + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // This simply performs some measurements and print out the result. + ACE_DEBUG ((LM_DEBUG, "PERFORM TEST (%dhz)\n", this->rate_)); + + if (this->pulser_.active()) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + this->work_ = arg; + this->start_time_ = ACE_OS::gethrtime (); + delete this->sampler_; +#if defined (COLLECT_AND_DUMP_SAMPLE_HISTORY) + size_t niterations = this->rate_ * 60 * MyImpl::Rate_Controller_i::sample_time_; + this->sampler_ = new SAMPLER (niterations); +#else + this->sampler_ = new SAMPLER; +#endif /* COLLECT_AND_DUMP_SAMPLE_HISTORY */ + + // @@ Start the rate generator + this->pulser_.start (this->rate_); +} + +void +MyImpl::Rate_Controller_i::stop (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (! this->pulser_.active ()) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + // @@ stop the rate generator + this->pulser_.stop (); + ACE_hrtime_t stop_test = ACE_OS::gethrtime (); + + ACE_DEBUG ((LM_DEBUG, "test finished (%dhz)\n", this->rate_)); + + const int len = 1024; + char title [len]; + + ACE_OS::snprintf (title, len, "Total (work=%4d @ %2dhz)", + this->work_, + this->rate_); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + + size_t count = 0; + +#if defined (COLLECT_AND_DUMP_SAMPLE_HISTORY) + this->sampler_->dump_samples (title, gsf); + + ACE_Basic_Stats stats; + this->sampler_->collect_basic_stats (stats); + stats.dump_results (title, gsf); + count = stats.samples_count (); +#else + this->sampler_->dump_results (title, gsf); + count = this->sampler_->samples_count (); +#endif /* COLLECT_BASIC_STATS */ + + ACE_Throughput_Stats::dump_throughput (title, gsf, + stop_test - this->start_time_, + count); +} + +// Operations from Components::SessionComponent +void +MyImpl::Rate_Controller_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::Rate_Controller_i::set_session_context (%dhz)\n", + this->rate_)); + + this->context_ = + Priority_Test::CCM_Controller_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::Rate_Controller_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::Rate_Controller_i::ccm_activate (%dhz)\n", + this->rate_)); + + this->pulser_.open (); +} + +void +MyImpl::Rate_Controller_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::Rate_Controller_i::ccm_passivate(%dhz)\n", + this->rate_)); + + this->pulser_.close (); +} + +void +MyImpl::Rate_Controller_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::Rate_Controller_i::ccm_remove (%dhz)\n", + this->rate_)); +} + +void +MyImpl::Rate_Controller_i::pulse (void) +{ + ACE_TRY_NEW_ENV + { + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + "Pulse (%dhz)!\n", + this->rate_)); + + ACE_hrtime_t start = ACE_OS::gethrtime (); + + Priority_Test::Common_Ops_var device = + this->context_->get_connection_worker (ACE_ENV_SINGLE_ARG_PARAMETER); + + (void) device->do_work (this->work_, 0 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_hrtime_t now = ACE_OS::gethrtime (); + this->sampler_->sample (now - start); + } + ACE_CATCHANY + { + // >= 0 meaning always print out the exception. + if (CIAO::debug_level () >= 0) + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Rate_Controller pulse exception\n"); + } + ACE_ENDTRY; +} + +/// Default ctor. +MyImpl::Rate_Controller_Home_i::Rate_Controller_Home_i (CORBA::Long hertz) + : hertz_ (hertz) +{ +} + +/// Default dtor. +MyImpl::Rate_Controller_Home_i::~Rate_Controller_Home_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::Rate_Controller_Home_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::Rate_Controller_i (this->hertz_); +} + + +extern "C" CONTROLLER_EXEC_Export ::Components::HomeExecutorBase_ptr +createControllerHome25_Impl (void) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "extern \"C\" ::createControllerHome_Impl (25hz)\n")); + return new MyImpl::Rate_Controller_Home_i (25); +} + +extern "C" CONTROLLER_EXEC_Export ::Components::HomeExecutorBase_ptr +createControllerHome50_Impl (void) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "extern \"C\" ::createControllerHome_Impl (25hz)\n")); + return new MyImpl::Rate_Controller_Home_i (50); +} + +extern "C" CONTROLLER_EXEC_Export ::Components::HomeExecutorBase_ptr +createControllerHome75_Impl (void) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "extern \"C\" ::createControllerHome_Impl (25hz)\n")); + return new MyImpl::Rate_Controller_Home_i (75); +} diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Rate_Controller.h b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Rate_Controller.h new file mode 100644 index 00000000000..8da42be49a3 --- /dev/null +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Rate_Controller.h @@ -0,0 +1,163 @@ +// $Id$ + +/** + * @file Rate_Controller.h + * + * Header file for the Rate Controller and Rate ControllerHome + * component implementations. These controller trigger a remote + * worker at some rate to do some amount of work. + * + * We should make "hertz" a configurable parameter using a property + * file, but, unfortunately, CIAO doesn't support this feature when + * this executor at this time. Therefore, we use different entry + * points for the DLL to control the rate of the Rate_Controller. + * + * define macro: COLLECT_AND_DUMP_SAMPLE_HISTORY to collect and dump + * sample history. + * + * @author Nanbor Wang <nanbor@cse.wustl.edu> + */ + +#ifndef RATE_CONTROLLER_H +#define RATE_CONTROLLER_H + +#include "ControllerEIC.h" +#include "tao/LocalObject.h" +#include "Pulser.h" +#include "ace/High_Res_Timer.h" +#include "ace/Stats.h" +#include "ace/Sample_History.h" + +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. +namespace MyImpl +{ + /** + * @class Rate_Controller_i + * + * A generic controller implementation. + */ + class CONTROLLER_EXEC_Export Rate_Controller_i : + public virtual PTImpl::Pulse_Handler, + public virtual Priority_Test::Controller_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + Rate_Controller_i (CORBA::Long hertz); + + /// Default destructor. + ~Rate_Controller_i (); + + // Operations from Priority_Test::Controller + + virtual void + start (CORBA::Long arg + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void + set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + /// Callback + virtual void + pulse (void); + + protected: + const CORBA::Long rate_; + + CORBA::Long work_; + + /// Copmponent specific context + Priority_Test::CCM_Controller_Context_var context_; + + /// Pulser generate periodical events + PTImpl::Pulser pulser_; + + // ------ Statistic related variables -------- + + /// Amount of memory to allocate for performance samples. + static const int sample_time_; // in minute + + /// Mark the time when the "start method" is called. + ACE_hrtime_t start_time_; + +#if defined (COLLECT_AND_DUMP_SAMPLE_HISTORY) + typedef ACE_Sample_History SAMPLER; +#else + typedef ACE_Basic_Stats SAMPLER; +#endif /* COLLECT_AND_DUMP_SAMPLE_HISTORY */ + SAMPLER *sampler_; + }; + + /** + * @class Controller_exec_i + * + * CB_Worker home executor implementation class. + */ + class CONTROLLER_EXEC_Export Rate_Controller_Home_i : + public virtual Priority_Test::CCM_ControllerHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + Rate_Controller_Home_i (CORBA::Long hertz); + + /// Default dtor. + ~Rate_Controller_Home_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + private: + CORBA::Long hertz_; + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" CONTROLLER_EXEC_Export ::Components::HomeExecutorBase_ptr +createControllerHome25_Impl (void); + +extern "C" CONTROLLER_EXEC_Export ::Components::HomeExecutorBase_ptr +createControllerHome50_Impl (void); + +extern "C" CONTROLLER_EXEC_Export ::Components::HomeExecutorBase_ptr +createControllerHome75_Impl (void); + +#endif /* RATE_CONTROLLER_H */ diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/client.cpp b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/client.cpp index 9469f5fa6d8..ecec707a994 100644 --- a/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/client.cpp +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/client.cpp @@ -10,12 +10,13 @@ #include "ace/streams.h" char *controller_ior_ = 0; +int ctrl_off = 0; long work = 80; int parse_args (int argc, char *argv[]) { - ACE_Get_Opt get_opts (argc, argv, "k:w:"); + ACE_Get_Opt get_opts (argc, argv, "k:fw:"); int c; while ((c = get_opts ()) != -1) @@ -26,6 +27,10 @@ parse_args (int argc, char *argv[]) controller_ior_ = get_opts.opt_arg (); break; + case 'f': // Turn off controller + ctrl_off = 1; + break; + case 'w': work = ACE_OS::atoi (get_opts.opt_arg ()); break; @@ -36,12 +41,13 @@ parse_args (int argc, char *argv[]) "usage: %s\n" "-k <Controller IOR>\n" "-w <work amount>\n" + "-f: Turn off Controller\n" "\n", argv [0]), -1); } - if (controller_ior_ == 0) + if (controller_ior_ == 0 && ctrl_off == 0) ACE_ERROR_RETURN ((LM_ERROR, "Please provide controller IOR\n"), -1); @@ -73,8 +79,11 @@ main (int argc, char *argv[]) if (CORBA::is_nil (ctrlr.in ())) ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire 'Controller' objref\n"), -1); - ctrlr->start (work - ACE_ENV_ARG_PARAMETER); + if (ctrl_off != 0) + ctrlr->stop (ACE_ENV_SINGLE_ARG_PARAMETER); + else + ctrlr->start (work + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/CIAO_Installation_Data.ini b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/CIAO_Installation_Data.ini index a2aca1cab21..0a1a4b7254e 100644 --- a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/CIAO_Installation_Data.ini +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/CIAO_Installation_Data.ini @@ -3,4 +3,5 @@ DCE:53E7624B-96D9-4E2B-BD73-66A56082AA1A=Worker_svnt DCE:1EB5F4C6-7F5D-43F2-9A44-E89B6E96377F=CB_Worker_exec DCE:A99FBAC6-823B-42D3-87B1-404D2DFCD690=IOB_Worker_exec DCE:A4981A0E-DF91-46B1-A77C-58B6052CC799=Controller_svnt -DCE:9663E039-96F8-41BE-BDA9-3BF4654DE996=Controller_exec
\ No newline at end of file +DCE:9663E039-96F8-41BE-BDA9-3BF4654DE996=Controller_exec +DCE:95CFD762-03EC-4A53-BF11-E15C1834DD17=Rate_Controller_exec diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/Controller25.csd b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/Controller25.csd new file mode 100644 index 00000000000..6b423fff32b --- /dev/null +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/Controller25.csd @@ -0,0 +1,64 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- 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"> + +<!-- Controller Software Package Descriptor --> +<!-- This file describes various Controller executors --> +<!-- implementations. --> + + +<softpkg name="CIAO-Controller25" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>Controller Component</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A 25hz controller executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:Priority_Test/Controller:1.0" homeid="IDL:Priority_Test/ControllerHome:1.0"> + <fileinarchive name="Controller.idl"/> + </idl> + + <!-- We don't need a property file for this example. However, --> + <!-- what to do with this element? Cache it in ComponentInstallation? --> + <!-- A better question maybe, when do we actually read the file and --> + <!-- build the attributes defined in the file? By Assembly perhaps? --> + <!-- Notice that this property file applies to the implementation itself. --> + <!-- Whatever that means. --> +<!-- <propertyfile> --> +<!-- <fileinarchive name="empty.cpf"/> --> +<!-- </propertyfile> --> + + <descriptor type="CORBA Component"> + <fileinarchive name="Controller.ccd"/> + </descriptor> + + <implementation id="DCE:95CFD762-03EC-4A53-BF11-E15C1834DD17"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="Controller.ssd"/> + <implref idref="DCE:A4981A0E-DF91-46B1-A77C-58B6052CC799"/> + </softpkgref> + </dependency> + + <!-- What happens when one define descriptors for both softpkg and --> + <!-- implementations? --> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="Rate_Controller_exec"/> + <entrypoint>createControllerHome25_Impl</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg> diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/Controller50.csd b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/Controller50.csd new file mode 100644 index 00000000000..6e811cb9956 --- /dev/null +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/Controller50.csd @@ -0,0 +1,64 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- 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"> + +<!-- Controller Software Package Descriptor --> +<!-- This file describes various Controller executors --> +<!-- implementations. --> + + +<softpkg name="CIAO-Controller50" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>Controller Component</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A 50hz controller executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:Priority_Test/Controller:1.0" homeid="IDL:Priority_Test/ControllerHome:1.0"> + <fileinarchive name="Controller.idl"/> + </idl> + + <!-- We don't need a property file for this example. However, --> + <!-- what to do with this element? Cache it in ComponentInstallation? --> + <!-- A better question maybe, when do we actually read the file and --> + <!-- build the attributes defined in the file? By Assembly perhaps? --> + <!-- Notice that this property file applies to the implementation itself. --> + <!-- Whatever that means. --> +<!-- <propertyfile> --> +<!-- <fileinarchive name="empty.cpf"/> --> +<!-- </propertyfile> --> + + <descriptor type="CORBA Component"> + <fileinarchive name="Controller.ccd"/> + </descriptor> + + <implementation id="DCE:95CFD762-03EC-4A53-BF11-E15C1834DD17"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="Controller.ssd"/> + <implref idref="DCE:A4981A0E-DF91-46B1-A77C-58B6052CC799"/> + </softpkgref> + </dependency> + + <!-- What happens when one define descriptors for both softpkg and --> + <!-- implementations? --> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="Rate_Controller_exec"/> + <entrypoint>createControllerHome50_Impl</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg> diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/Controller75.csd b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/Controller75.csd new file mode 100644 index 00000000000..89ba842dd22 --- /dev/null +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/Controller75.csd @@ -0,0 +1,64 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- 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"> + +<!-- Controller Software Package Descriptor --> +<!-- This file describes various Controller executors --> +<!-- implementations. --> + + +<softpkg name="CIAO-Controller75" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>Controller Component</title> + <author> + <company>Washington University in St. Louis</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A 75hz controller executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:Priority_Test/Controller:1.0" homeid="IDL:Priority_Test/ControllerHome:1.0"> + <fileinarchive name="Controller.idl"/> + </idl> + + <!-- We don't need a property file for this example. However, --> + <!-- what to do with this element? Cache it in ComponentInstallation? --> + <!-- A better question maybe, when do we actually read the file and --> + <!-- build the attributes defined in the file? By Assembly perhaps? --> + <!-- Notice that this property file applies to the implementation itself. --> + <!-- Whatever that means. --> +<!-- <propertyfile> --> +<!-- <fileinarchive name="empty.cpf"/> --> +<!-- </propertyfile> --> + + <descriptor type="CORBA Component"> + <fileinarchive name="Controller.ccd"/> + </descriptor> + + <implementation id="DCE:95CFD762-03EC-4A53-BF11-E15C1834DD17"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="Controller.ssd"/> + <implref idref="DCE:A4981A0E-DF91-46B1-A77C-58B6052CC799"/> + </softpkgref> + </dependency> + + <!-- What happens when one define descriptors for both softpkg and --> + <!-- implementations? --> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="Rate_Controller_exec"/> + <entrypoint>createControllerHome75_Impl</entrypoint> + </code> + + </implementation> + + <!-- Let's add more implementation description later when we try to --> + <!-- compile this stuff on, say, Solaris and Linux. --> + +</softpkg> diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/basic_test.pl b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/basic_test.pl index bcdaeebce9f..284ea9a2ed2 100755 --- a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/basic_test.pl +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/basic_test.pl @@ -12,13 +12,7 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' use lib "$ENV{'ACE_ROOT'}/bin"; use PerlACE::Run_Test; -$status = 0; -$assembly = PerlACE::LocalFile ("demo.cad"); -$daemon_ior = PerlACE::LocalFile ("daemon.ior"); -$am_ior = PerlACE::LocalFile ("am.ior"); -$controller_ior = PerlACE::LocalFile ("controller.ior"); -$cookie = PerlACE::LocalFile ("ck_demo_deployment"); - +## Source in the environment setting $ACE_ROOT=$ENV{'ACE_ROOT'}; $CIAO_ROOT=$ENV{'CIAO_ROOT'}; @@ -26,6 +20,20 @@ if ($CIAO_ROOT eq "") { $CIAO_ROOT="$ACE_ROOT/TAO/CIAO"; } + +$status = 0; +$assembly = PerlACE::LocalFile ("demo-50.cad"); +$deploy_config = PerlACE::LocalFile ("test.dat"); +$daemon_ior = PerlACE::LocalFile ("daemon.ior"); +$am_ior = PerlACE::LocalFile ("am.ior"); +$controller_ior = PerlACE::LocalFile ("controller.ior"); +$cookie = PerlACE::LocalFile ("ck_demo_deployment"); + +## The following control how to iterate thru various work amount +$start_work = 10; +$end_work = 300; +$work_step = 300; + unlink $daemon_ior; unlink $am_ior; unlink $cookie; @@ -34,9 +42,9 @@ unlink $cookie; # 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"; -$assembly_manager_args = "-o $am_ior -c test.dat"; +$assembly_manager_args = "-o $am_ior -c $deploy_config"; -$ad_deploy = " -k file://$am_ior -o $cookie -a demo.cad"; +$ad_deploy = " -k file://$am_ior -o $cookie -a $assembly"; $ad_teardown = " -k file://$am_ior -d $cookie -x"; @@ -81,7 +89,7 @@ if (PerlACE::waitforfile_timed ($controller_ior, 15) == -1) { exit 1; } -for ($work = 20; $work < 400; $work += 20) +for ($work = $start_work; $work < $end_work; $work += $work_step) { printf "Test work: $work\n"; @@ -92,7 +100,12 @@ for ($work = 20; $work < 400; $work += 20) ## Now wait for the test to complete. Need to figure out a way to ## detect this. - sleep (3); + sleep (30); + +#Start the client to send the trigger message + $CL = new PerlACE::Process ("../Controllers/client", + "-k file://$controller_ior -f"); + $CL->SpawnWaitKill(60); } ## Now teardown the application @@ -110,7 +123,7 @@ if ($AD->SpawnWaitKill (60) == -1) { #$AM->WaitKill(5); #$AD->WaitKill(5); -$AM->WaitKill (40); +$AM->WaitKill (2); $DS->Kill (); diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/demo-25.cad b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/demo-25.cad new file mode 100644 index 00000000000..f0cb3080a49 --- /dev/null +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/demo-25.cad @@ -0,0 +1,52 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- 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 componentassembly SYSTEM "../../../../docs/XML/componentassembly.dtd"> + +<componentassembly id="A test assembly for RTCCM Priority components."> + <componentfiles> + <componentfile id="com-Controller"> + <fileinarchive name="Controller25.csd"/> + </componentfile> + <componentfile id="com-Worker"> + <fileinarchive name="CB_Worker.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_ControllerHome"> + <componentfileref idref="com-Controller"/> + <componentinstantiation id="a_Controller"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="controller.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_WorkerHome"> + <componentfileref idref="com-Worker"/> + <componentinstantiation id="a_Worker"/> + </homeplacement> + + </partitioning> + + <connections> + + <connectinterface> + <usesport> + <usesidentifier>worker</usesidentifier> + <componentinstantiationref idref="a_Controller"/> + </usesport> + <providesport> + <providesidentifier>some_device</providesidentifier> + <componentinstantiationref idref="a_Worker"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly> diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/demo-50.cad b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/demo-50.cad new file mode 100644 index 00000000000..fee312eff4e --- /dev/null +++ b/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/demo-50.cad @@ -0,0 +1,52 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- 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 componentassembly SYSTEM "../../../../docs/XML/componentassembly.dtd"> + +<componentassembly id="A test assembly for RTCCM Priority components."> + <componentfiles> + <componentfile id="com-Controller"> + <fileinarchive name="Controller50.csd"/> + </componentfile> + <componentfile id="com-Worker"> + <fileinarchive name="CB_Worker.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_ControllerHome"> + <componentfileref idref="com-Controller"/> + <componentinstantiation id="a_Controller"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="controller.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + + <homeplacement id="a_WorkerHome"> + <componentfileref idref="com-Worker"/> + <componentinstantiation id="a_Worker"/> + </homeplacement> + + </partitioning> + + <connections> + + <connectinterface> + <usesport> + <usesidentifier>worker</usesidentifier> + <componentinstantiationref idref="a_Controller"/> + </usesport> + <providesport> + <providesidentifier>some_device</providesidentifier> + <componentinstantiationref idref="a_Worker"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly> |