diff options
author | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-03-22 03:07:15 +0000 |
---|---|---|
committer | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-03-22 03:07:15 +0000 |
commit | e743a80a1f39c3bec039e8a4fce759fc9c332cfe (patch) | |
tree | aa14ae6af1980f784cd581619be047481a439a99 | |
parent | ac9508202157630e19a09ad5f8cf33bc50f5b53f (diff) | |
download | ATCD-e743a80a1f39c3bec039e8a4fce759fc9c332cfe.tar.gz |
ChangeLogTag: Sun Mar 22 03:04:48 UTC 2009 Friedhelm Wolf <fwolf@dre.vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/LWFT_Service/host_monitor.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LWFT/HMOptions.cpp | 16 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LWFT/HMOptions.h | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp | 24 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp | 38 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.h | 9 |
8 files changed, 89 insertions, 17 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 94c48321cda..287612e1b89 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,15 @@ +Sun Mar 22 03:04:48 UTC 2009 Friedhelm Wolf <fwolf@dre.vanderbilt.edu> + + * orbsvcs/orbsvcs/LWFT/ReplicationManager.h + * orbsvcs/orbsvcs/LWFT/HMOptions.h + * orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h + * orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp + * orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp + * orbsvcs/orbsvcs/LWFT/HMOptions.cpp + * orbsvcs/LWFT_Service/host_monitor.cpp: + + Added logging for failure timing. + Wed Mar 18 21:06:23 UTC 2009 Friedhelm Wolf <fwolf@dre.vanderbilt.edu> * orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp: diff --git a/TAO/orbsvcs/LWFT_Service/host_monitor.cpp b/TAO/orbsvcs/LWFT_Service/host_monitor.cpp index 66cfd22ad29..7db1842bc96 100644 --- a/TAO/orbsvcs/LWFT_Service/host_monitor.cpp +++ b/TAO/orbsvcs/LWFT_Service/host_monitor.cpp @@ -47,7 +47,7 @@ int main (int argc, char* argv[]) /// Initilize the timedate object on heap. HostMonitorImpl * host_monitor = - new HostMonitorImpl (orb, &monitor_thread); + new HostMonitorImpl (orb, &monitor_thread, opts->logging ()); PortableServer::ServantBase_var safe_host (host_monitor); ACE_UNUSED_ARG (safe_host); diff --git a/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.cpp b/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.cpp index f95a9116300..2ba72b64783 100644 --- a/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.cpp +++ b/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.cpp @@ -2,7 +2,7 @@ // $Id$ #include <sstream> - +#include <iostream> #include "ace/Global_Macros.h" #include "ace/Guard_T.h" #include "ace/Log_Msg.h" @@ -21,7 +21,8 @@ HMOptions::HMOptions (void) port_range_begin_ (7000), RM_update_freq_ (1), load_monitor_freq_(2), - debug_level_ (0) + debug_level_ (0), + logging_ (false) { char hostname [100]; gethostname (hostname, sizeof (hostname)); @@ -65,6 +66,11 @@ HMOptions::parse_args (int &argc, char **argv) HM_ior_file_ = arg; as.consume_arg (); } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-logging")))) + { + logging_ = true; + as.consume_arg (); + } else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-rm_ior")))) { RM_ior_ = arg; @@ -222,3 +228,9 @@ HMOptions::set_debug_level (void) ACE_LOG_MSG->priority_mask (mask, ACE_Log_Msg::PROCESS); } + +bool +HMOptions::logging (void) +{ + return logging_; +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.h b/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.h index 4cc93ea5c36..220006dbeca 100644 --- a/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.h +++ b/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.h @@ -44,6 +44,7 @@ public: std::string util_file (void) const; std::pair <char, std::string> ior_access (void) const; bool use_naming_service (void) const; + bool logging (void); /** * @return the debug level of the application: @@ -71,6 +72,7 @@ protected: size_t load_monitor_freq_; std::pair <char, std::string> ior_access_; long debug_level_; + bool logging_; /// Singleton-related stuff. static HMOptions * volatile instance_; diff --git a/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp b/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp index 85984b1032e..dffdc3b271d 100644 --- a/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp +++ b/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp @@ -8,6 +8,7 @@ #include "ace/Time_Value.h" #include "ace/Synch_Options.h" #include "ace/Thread_Mutex.h" +#include "ace/Date_Time.h" #include "HostMonitorImpl.h" #include "Failure_Handler.h" @@ -16,11 +17,12 @@ #include "HMOptions.h" #include "Utilization_Monitor.h" -HostMonitorImpl::HostMonitorImpl (CORBA::ORB_ptr orb, Monitor_Thread *mt) +HostMonitorImpl::HostMonitorImpl (CORBA::ORB_ptr orb, Monitor_Thread *mt, bool logging) : monitor_thread_ (mt), port_counter_ (HMOptions::instance ()->port_range_begin ()), connector_ (monitor_thread_->get_reactor ()), - orb_ (CORBA::ORB::_duplicate (orb)) + orb_ (CORBA::ORB::_duplicate (orb)), + logging_ (logging) { this->create_RM_Proxy (); } @@ -126,6 +128,24 @@ int HostMonitorImpl::drop_process (const std::string &process_id) if (process_map_.find (process_id, handler) == 0) { rm_proxy_->proc_failure (process_id); + + if (logging_) + { + std::ofstream logfile; + logfile.open ("./hm.log", ios_base::app); + + ACE_Date_Time dt; + + logfile << process_id << " " + << dt.hour () << ":" + << dt.minute () << ":" + << dt.second () << ":" + << dt.microsec () + << std::endl; + + logfile.close (); + } + return remove_process (process_id); } diff --git a/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h b/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h index a8b31f6bdc8..82ca29078c2 100644 --- a/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h +++ b/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h @@ -29,7 +29,7 @@ public: ACE_Thread_Mutex> ProcessHandlerMap; - HostMonitorImpl (CORBA::ORB_ptr, Monitor_Thread *); + HostMonitorImpl (CORBA::ORB_ptr, Monitor_Thread *, bool logging = false); int drop_process (const std::string &process_id); @@ -69,6 +69,7 @@ private: ProcessHandlerMap process_map_; ACE_Connector <Failure_Handler, ACE_SOCK_Connector> connector_; CORBA::ORB_var orb_; + bool logging_; }; #endif // __HOSTMONITORIMPL_H diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp b/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp index 347db876543..6ecd8dcd218 100644 --- a/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp +++ b/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp @@ -6,7 +6,7 @@ #include <string> #include <set> - +#include <ace/Date_Time.h> #include "ace/OS_NS_unistd.h" #include <ace/High_Res_Timer.h> #include "AppSideMonitor_Thread.h" @@ -684,15 +684,26 @@ ReplicationManager_i::process_proc_failure ( std::ofstream out; out.open ("rm-failures.txt", ios_base::app); - for (PROC_FAIL_TIME_LIST::iterator it = failure_history_.begin (); - it != failure_history_.end (); - ++it) - { - out << it->second << " " << it->first << std::endl; - } + { + ACE_Guard <ACE_Thread_Mutex> guard (history_lock_); + + ACE_Date_Time dt; + for (PROC_FAIL_TIME_LIST::iterator it = failure_history_.begin (); + it != failure_history_.end (); + ++it) + { + dt.update (it->timestamp); + out << it->process_id << " " + << dt.hour () << ":" + << dt.minute () << ":" + << dt.second () << ":" + << dt.microsec () << " " + << it->delta << std::endl; + } - out.close (); - failure_history_.clear (); + out.close (); + failure_history_.clear (); + } } void @@ -1676,7 +1687,14 @@ ReplicationManager_i::proc_failure (const char *process_id) ACE_Time_Value tv; timer_.elapsed_time (tv); - failure_history_.push_back (TProcessFailureTime (tv.msec (), process_id)); + TProcessFailureTime sample = {tv.msec (), ACE_OS::gettimeofday (), process_id}; + + { + ACE_Guard <ACE_Thread_Mutex> guard (history_lock_); + + failure_history_.push_back ( sample ); + } + timer_.reset (); timer_.start (); } diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.h b/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.h index 2ebd6751ec6..b9179a4a88d 100644 --- a/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.h +++ b/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.h @@ -321,10 +321,17 @@ private: ACE_High_Res_Timer timer_; - typedef std::pair <unsigned long, std::string> TProcessFailureTime; + struct TProcessFailureTime { + unsigned long delta; + ACE_Time_Value timestamp; + std::string process_id; + }; + typedef std::list <TProcessFailureTime> PROC_FAIL_TIME_LIST; PROC_FAIL_TIME_LIST failure_history_; + ACE_Thread_Mutex history_lock_; + void update_enhanced_ranklist (void); void update_map (const char * key_str, |