From 3d32f4a96bc1a6b2ce9cac170fb9ab377e2655ea Mon Sep 17 00:00:00 2001 From: nilabjar Date: Thu, 13 Dec 2007 16:52:15 +0000 Subject: Thu Dec 13 16:50:49 UTC 2007 Nishanth Shankaran --- CIAO/ChangeLog | 19 ++++++++- CIAO/DAnCE/TM_Daemon/DomainDataManager.cpp | 44 +++++++++++++++------ CIAO/DAnCE/TM_Daemon/DomainDataManager.h | 13 +++++-- CIAO/DAnCE/TM_Daemon/TM_Daemon.cpp | 7 ++-- CIAO/DAnCE/TM_Daemon/TM_Daemon.h | 51 ++++++++++++++++++++++++ CIAO/DAnCE/TM_Daemon/TM_Daemon.idl | 19 +++++++++ CIAO/DAnCE/TM_Daemon/TM_Daemon_stub_export.h | 58 ++++++++++++++++++++++++++++ CIAO/DAnCE/TM_Daemon/TM_Daemon_svnt_export.h | 58 ++++++++++++++++++++++++++++ CIAO/DAnCE/TM_Daemon/client.cpp | 15 ++++--- CIAO/DAnCE/TM_Daemon/driver.cpp | 21 +++++++--- 10 files changed, 272 insertions(+), 33 deletions(-) create mode 100644 CIAO/DAnCE/TM_Daemon/TM_Daemon.h create mode 100644 CIAO/DAnCE/TM_Daemon/TM_Daemon.idl create mode 100644 CIAO/DAnCE/TM_Daemon/TM_Daemon_stub_export.h create mode 100644 CIAO/DAnCE/TM_Daemon/TM_Daemon_svnt_export.h diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 5742085cb85..fbf76ba45e6 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,17 @@ +Thu Dec 13 16:50:49 UTC 2007 Nishanth Shankaran + + * DAnCE/TM_Daemon/DomainDataManager.h: + * DAnCE/TM_Daemon/DomainDataManager.cpp: + * DAnCE/TM_Daemon/TM_Daemon.h: + * DAnCE/TM_Daemon/TM_Daemon.idl: + * DAnCE/TM_Daemon/TM_Daemon.cpp: + * DAnCE/TM_Daemon/TM_Daemon_stub_export.h: + * DAnCE/TM_Daemon/TM_Daemon_svnt_export.h: + * DAnCE/TM_Daemon/client.cpp: + * DAnCE/TM_Daemon/driver.cpp: + + Cleaned up the implementation. + Mon Oct 8 21:27:20 UTC 2007 Nilabja R * DAnCE/NodeApplication/App_Monitor_Impl.cpp: @@ -22,8 +36,9 @@ Mon Oct 8 21:27:20 UTC 2007 Nilabja R * examples/space/descriptors/NodeManagerMap_6.dat: * examples/space/descriptors/NodeManagerMap_two.dat: * examples/space/descriptors/SPACE_3.cdp: - Added a client to call the TM_Daemon. Added Domains, plans for 3 Nodes. - Made changes in TM_Daemon + + Added a client to call the TM_Daemon. Added Domains, plans for 3 Nodes. + Made changes in TM_Daemon Fri Sep 21 22:18:53 UTC 2007 Nishanth Shanakran diff --git a/CIAO/DAnCE/TM_Daemon/DomainDataManager.cpp b/CIAO/DAnCE/TM_Daemon/DomainDataManager.cpp index 96172b03bae..37c9de99e73 100644 --- a/CIAO/DAnCE/TM_Daemon/DomainDataManager.cpp +++ b/CIAO/DAnCE/TM_Daemon/DomainDataManager.cpp @@ -6,6 +6,7 @@ #include "ciao/CIAO_common.h" #include #include "utils/Exceptions.h" +#include "Config_Handlers/XML_File_Intf.h" namespace CIAO @@ -13,12 +14,13 @@ namespace CIAO DomainDataManager::DomainDataManager (CORBA::ORB_ptr orb, const char *dat_file, const char *domain_file, - ::Deployment::DeploymentPlan& plan) - +// ::Deployment::DeploymentPlan& plan) + vector plans) : orb_ (CORBA::ORB::_duplicate (orb)), deployment_config_ (orb_.in()), - delay_ (utils::Timer ("delay")), - plan_ (plan), + // delay_ (utils::Timer ("delay")), +// plan_ (plan), + plans_ (plans), dat_file_ (dat_file), condition_ (condition_mutex_) @@ -29,11 +31,13 @@ namespace CIAO initial_domain_ = current_domain_; // set up the profile timers for each node + /* for (CORBA::ULong i = 0; i < this->current_domain_.node.length (); ++i) { this->node_timers_ [this->current_domain_.node[i].name.in ()] = new utils::Timer (this->current_domain_.node[i].name.in ()); } + */ if (this->call_all_node_managers () != 0) { @@ -149,7 +153,7 @@ namespace CIAO DomainDataManager::update_dynamic (const ::Deployment::Domain &domainSubset) { this->node_info_map_ [domainSubset.node[0].name.in ()] = domainSubset.node[0]; - this->node_timers_[domainSubset.node[0].name.in ()]->stop (); + // this->node_timers_[domainSubset.node[0].name.in ()]->stop (); // Acquire the mutex before making any modifications as multiple // threads might try to do this simultaneously. @@ -161,10 +165,10 @@ namespace CIAO if (temp_count == 0) { // all responses have come in .... now timestamp the event - this->delay_.stop (); - this->delay_.dump (); + // this->delay_.stop (); + // this->delay_.dump (); this->condition_.signal (); - + /* for (std::map::iterator itr = this->node_timers_.begin (); itr != this->node_timers_.end (); itr++) @@ -172,6 +176,7 @@ namespace CIAO (*itr).second->dump (); } + */ } // CORBA::Double load; @@ -268,13 +273,16 @@ namespace CIAO (Onl_Monitor::AMI_NM_MonitorHandler_ptr handler) { this->response_count_ = this->current_domain_.node.length (); - this->delay_.start (); + // this->delay_.start (); for (CORBA::ULong i = 0; i < this->node_monitors_.size (); ++i) { - this->node_timers_[this->current_domain_.node[i].name.in ()]->start (); + // this->node_timers_[this->current_domain_.node[i].name.in ()]->start (); this->node_monitors_[i]->sendc_get_resource_data (handler); + + // for synchronous calls +// this->node_monitors_[i]->get_resource_data (); } this->condition_.wait (); return this->node_info_map_; @@ -286,12 +294,24 @@ namespace CIAO CIAO::DomainDataManager:: start_monitor_qos (Onl_Monitor::AMI_NM_MonitorHandler_ptr handler) { + + Onl_Monitor::Plan_Seq plans; + plans.length (plans_.size ()); + + // form the plans and send them over + for (int i =0;i < plans_.size ();i++) + { + CIAO::Config_Handlers::XML_File_Intf intf (plans_[i].c_str ()); + ::Deployment::DeploymentPlan_var plan = intf.get_plan (); + plans[i] = plan; + } + + for (CORBA::ULong i = 0; i < this->node_monitors_.size (); ++i) { this->node_monitors_[i]->sendc_monitor_app_QoS (handler, - this->plan_); + plans); } return 0; - } } diff --git a/CIAO/DAnCE/TM_Daemon/DomainDataManager.h b/CIAO/DAnCE/TM_Daemon/DomainDataManager.h index 22622eabc06..a0dbc5aa7e1 100644 --- a/CIAO/DAnCE/TM_Daemon/DomainDataManager.h +++ b/CIAO/DAnCE/TM_Daemon/DomainDataManager.h @@ -28,6 +28,8 @@ using namespace ::CIAO::TM_Daemon; +using namespace std; + /** * @namespace CIAO * @@ -60,7 +62,9 @@ namespace CIAO DomainDataManager (CORBA::ORB_ptr orb, const char *dat_file, const char *domain_file, - ::Deployment::DeploymentPlan& plan); +// ::Deployment::DeploymentPlan& plan); + vector plans); + ~DomainDataManager (); @@ -141,14 +145,14 @@ namespace CIAO int response_count_; /// Stores the time taken to obtain the snapshot of the entire domain. - utils::Timer delay_; + // utils::Timer delay_; /// Exception occured bool ex_occur_; /// Timers for each node to measure data collection delay latency for /// each node - std::map node_timers_; + // std::map node_timers_; /// Map used to store "dynamic information" of each node. std::map node_info_map_; @@ -156,6 +160,9 @@ namespace CIAO /// Deployment plan. ::Deployment::DeploymentPlan plan_; + // name of the plans + vector plans_; + /// the Data file which contains the Node Manager references std::string dat_file_; diff --git a/CIAO/DAnCE/TM_Daemon/TM_Daemon.cpp b/CIAO/DAnCE/TM_Daemon/TM_Daemon.cpp index 307bca7f89b..fd46d6bbe34 100644 --- a/CIAO/DAnCE/TM_Daemon/TM_Daemon.cpp +++ b/CIAO/DAnCE/TM_Daemon/TM_Daemon.cpp @@ -9,7 +9,8 @@ namespace CIAO Daemon_impl::Daemon_impl (CORBA::ORB_ptr orb, - const char *deployment_plan, +// const char *deployment_plan, + vector deployment_plans, const char *mapping, const char *domain, ::PortableServer::POA_ptr poa, @@ -20,12 +21,10 @@ namespace CIAO { // ACE_DEBUG ((LM_DEBUG, "Making call to intf \n")); - CIAO::Config_Handlers::XML_File_Intf intf (deployment_plan); - ::Deployment::DeploymentPlan_var plan = intf.get_plan (); // ACE_DEBUG ((LM_DEBUG, "After call to get plan \n")); // Now create the manager. - this->manager_ = new DomainDataManager (orb, mapping, domain, plan); + this->manager_ = new DomainDataManager (orb, mapping, domain, deployment_plans); // Create the AMI handler providing it with the object reference of // the manager. diff --git a/CIAO/DAnCE/TM_Daemon/TM_Daemon.h b/CIAO/DAnCE/TM_Daemon/TM_Daemon.h new file mode 100644 index 00000000000..621dcc6f7e5 --- /dev/null +++ b/CIAO/DAnCE/TM_Daemon/TM_Daemon.h @@ -0,0 +1,51 @@ +#ifndef TM_DAEMON_H +#define TM_DAEMON_H + +#include "TM_DaemonS.h" +#include "DomainDataManager.h" +#include "Handler_i.h" +#include +#include + +using namespace std; + +namespace CIAO +{ + namespace TM_Daemon + { + class Daemon_impl: public POA_CIAO::TM_Daemon::Daemon + { + + public: + Daemon_impl (CORBA::ORB_ptr orb, +// const char *deployment_plan, + vector deployment_plans, + const char *mapping, + const char *domain, + ::PortableServer::POA_ptr poa, + size_t threads = 2); + + virtual ~Daemon_impl (); + + virtual ::Deployment::Domain * get_snapshot (void); + + virtual void shutdown (); + + virtual int run (); + + + private: + + CORBA::ORB_var orb_; + + DomainDataManager* manager_; + + size_t thread_count_; + + Onl_Monitor::AMI_NM_MonitorHandler_var handler_; + + }; + } +} + +#endif diff --git a/CIAO/DAnCE/TM_Daemon/TM_Daemon.idl b/CIAO/DAnCE/TM_Daemon/TM_Daemon.idl new file mode 100644 index 00000000000..9d6cbb0e379 --- /dev/null +++ b/CIAO/DAnCE/TM_Daemon/TM_Daemon.idl @@ -0,0 +1,19 @@ +// $Id:$ + +#include "DAnCE/Deployment/Deployment_TargetData.idl" + +module CIAO +{ + module TM_Daemon + { + + interface Daemon + { + + ::Deployment::Domain get_snapshot (); + + oneway void shutdown (); + + }; + }; +}; diff --git a/CIAO/DAnCE/TM_Daemon/TM_Daemon_stub_export.h b/CIAO/DAnCE/TM_Daemon/TM_Daemon_stub_export.h new file mode 100644 index 00000000000..691f3a56c58 --- /dev/null +++ b/CIAO/DAnCE/TM_Daemon/TM_Daemon_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl TM_DAEMON_STUB +// ------------------------------ +#ifndef TM_DAEMON_STUB_EXPORT_H +#define TM_DAEMON_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (TM_DAEMON_STUB_HAS_DLL) +# define TM_DAEMON_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && TM_DAEMON_STUB_HAS_DLL */ + +#if !defined (TM_DAEMON_STUB_HAS_DLL) +# define TM_DAEMON_STUB_HAS_DLL 1 +#endif /* ! TM_DAEMON_STUB_HAS_DLL */ + +#if defined (TM_DAEMON_STUB_HAS_DLL) && (TM_DAEMON_STUB_HAS_DLL == 1) +# if defined (TM_DAEMON_STUB_BUILD_DLL) +# define TM_DAEMON_STUB_Export ACE_Proper_Export_Flag +# define TM_DAEMON_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TM_DAEMON_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TM_DAEMON_STUB_BUILD_DLL */ +# define TM_DAEMON_STUB_Export ACE_Proper_Import_Flag +# define TM_DAEMON_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TM_DAEMON_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TM_DAEMON_STUB_BUILD_DLL */ +#else /* TM_DAEMON_STUB_HAS_DLL == 1 */ +# define TM_DAEMON_STUB_Export +# define TM_DAEMON_STUB_SINGLETON_DECLARATION(T) +# define TM_DAEMON_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TM_DAEMON_STUB_HAS_DLL == 1 */ + +// Set TM_DAEMON_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (TM_DAEMON_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define TM_DAEMON_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define TM_DAEMON_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !TM_DAEMON_STUB_NTRACE */ + +#if (TM_DAEMON_STUB_NTRACE == 1) +# define TM_DAEMON_STUB_TRACE(X) +#else /* (TM_DAEMON_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define TM_DAEMON_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (TM_DAEMON_STUB_NTRACE == 1) */ + +#endif /* TM_DAEMON_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/TM_Daemon/TM_Daemon_svnt_export.h b/CIAO/DAnCE/TM_Daemon/TM_Daemon_svnt_export.h new file mode 100644 index 00000000000..1f32bf6e598 --- /dev/null +++ b/CIAO/DAnCE/TM_Daemon/TM_Daemon_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl TM_DAEMON_SVNT +// ------------------------------ +#ifndef TM_DAEMON_SVNT_EXPORT_H +#define TM_DAEMON_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (TM_DAEMON_SVNT_HAS_DLL) +# define TM_DAEMON_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && TM_DAEMON_SVNT_HAS_DLL */ + +#if !defined (TM_DAEMON_SVNT_HAS_DLL) +# define TM_DAEMON_SVNT_HAS_DLL 1 +#endif /* ! TM_DAEMON_SVNT_HAS_DLL */ + +#if defined (TM_DAEMON_SVNT_HAS_DLL) && (TM_DAEMON_SVNT_HAS_DLL == 1) +# if defined (TM_DAEMON_SVNT_BUILD_DLL) +# define TM_DAEMON_SVNT_Export ACE_Proper_Export_Flag +# define TM_DAEMON_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TM_DAEMON_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TM_DAEMON_SVNT_BUILD_DLL */ +# define TM_DAEMON_SVNT_Export ACE_Proper_Import_Flag +# define TM_DAEMON_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TM_DAEMON_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TM_DAEMON_SVNT_BUILD_DLL */ +#else /* TM_DAEMON_SVNT_HAS_DLL == 1 */ +# define TM_DAEMON_SVNT_Export +# define TM_DAEMON_SVNT_SINGLETON_DECLARATION(T) +# define TM_DAEMON_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TM_DAEMON_SVNT_HAS_DLL == 1 */ + +// Set TM_DAEMON_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (TM_DAEMON_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define TM_DAEMON_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define TM_DAEMON_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !TM_DAEMON_SVNT_NTRACE */ + +#if (TM_DAEMON_SVNT_NTRACE == 1) +# define TM_DAEMON_SVNT_TRACE(X) +#else /* (TM_DAEMON_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define TM_DAEMON_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (TM_DAEMON_SVNT_NTRACE == 1) */ + +#endif /* TM_DAEMON_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/CIAO/DAnCE/TM_Daemon/client.cpp b/CIAO/DAnCE/TM_Daemon/client.cpp index f70fb00415d..8aee0713d06 100644 --- a/CIAO/DAnCE/TM_Daemon/client.cpp +++ b/CIAO/DAnCE/TM_Daemon/client.cpp @@ -81,12 +81,15 @@ namespace CIAO utils::Timer latency (output); for (size_t i = 0; i < iterations; ++i) { - ACE_DEBUG ((LM_DEBUG, "%d Invoking get_snapshot ... ", i)); - latency.start (); - ::Deployment::Domain_var domain = daemon->get_snapshot (); - latency.stop (); - latency.dump (); - ACE_DEBUG ((LM_DEBUG, "done!\n")); + for (size_t j = 0; j < 100; ++j) + { +// ACE_DEBUG ((LM_DEBUG, "%d Invoking get_snapshot ... ", i)); + latency.start (); + ::Deployment::Domain_var domain = daemon->get_snapshot (); + latency.stop (); + latency.dump (); +// ACE_DEBUG ((LM_DEBUG, "done!\n")); + } sleep (duration); } orb->destroy (); diff --git a/CIAO/DAnCE/TM_Daemon/driver.cpp b/CIAO/DAnCE/TM_Daemon/driver.cpp index cec3aa8c409..ca7ce6ae2a1 100644 --- a/CIAO/DAnCE/TM_Daemon/driver.cpp +++ b/CIAO/DAnCE/TM_Daemon/driver.cpp @@ -8,12 +8,19 @@ #include "Config_Handlers/DnC_Dump.h" #include "Client_Task.h" +#include +#include + +using namespace std; + namespace CIAO { namespace TM_Daemon { const char *ior_output_file = "daemon.ior"; - const char *deploymentplan_file = 0; +// const char *deploymentplan_file = 0; + vector plans; + string aplan; const char *domain_file = 0; const char *mapping_file = 0; size_t threads = 2; @@ -37,9 +44,10 @@ namespace CIAO break; case 'k': - deploymentplan_file = get_opts.opt_arg (); - ACE_DEBUG ((LM_DEBUG, "deploymentplan_file is %s.\n", deploymentplan_file)); - +// deploymentplan_file = get_opts.opt_arg (); +// ACE_DEBUG ((LM_DEBUG, "deploymentplan_file is %s.\n", deploymentplan_file)); + aplan = get_opts.opt_arg (); + plans.push_back (aplan); break; case 'd': @@ -64,7 +72,7 @@ namespace CIAO -1); } - if (deploymentplan_file != 0 && domain_file != 0 && mapping_file != 0) + if (plans.size () != 0 && domain_file != 0 && mapping_file != 0) { // Indicates sucessful parsing of the command line return 0; @@ -100,7 +108,8 @@ namespace CIAO Daemon_impl *daemon_impl = 0; ACE_NEW_RETURN (daemon_impl, Daemon_impl (orb, - deploymentplan_file, + // deploymentplan_file, + plans, mapping_file, domain_file, root_poa, -- cgit v1.2.1