diff options
author | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-03-17 21:39:13 +0000 |
---|---|---|
committer | wolff1 <wolff1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-03-17 21:39:13 +0000 |
commit | 0a92873f69145d3e9f4bb56b339069e01a5d21f4 (patch) | |
tree | f9339e460722b63e8cfe0828f998ff3113a16a86 | |
parent | 522c03b61fb74c6224b743bf5941c9a51e75f286 (diff) | |
download | ATCD-0a92873f69145d3e9f4bb56b339069e01a5d21f4.tar.gz |
ChangeLogTag: Tue Mar 17 21:37:47 UTC 2009 Friedhelm Wolf <fwolf@dre.vanderbilt.edu>
8 files changed, 73 insertions, 35 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 5c663abcb4b..9f9490fd7b7 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,17 @@ +Tue Mar 17 21:37:47 UTC 2009 Friedhelm Wolf <fwolf@dre.vanderbilt.edu> + + * orbsvcs/examples/FaultTolerance/FLARe/Worker/client.cpp + * orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker.idl + * orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.h + * orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.cpp + * orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.h + * orbsvcs/examples/FaultTolerance/FLARe/Worker/server.cpp + * orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.cpp: + + Changed server and client to take server processing time into + account and added additional client parameters for logging + output control. + Fri Mar 13 03:40:01 UTC 2009 Friedhelm Wolf <fwolf@dre.vanderbilt.edu> * orbsvcs/orbsvcs/LWFT/ReplicationManager.h diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.cpp index 9d77302c1cc..daf2eb3636e 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.cpp @@ -7,7 +7,8 @@ extern double execution_time; -Client_Timer_Handler::Client_Timer_Handler (long iterations, +Client_Timer_Handler::Client_Timer_Handler (unsigned long iterations, + unsigned long log_start, const std::string & filename, const ACE_Time_Value & period, bool logging) @@ -15,8 +16,10 @@ Client_Timer_Handler::Client_Timer_Handler (long iterations, invocations_ (0), logfile_ (filename), max_iterations_ (iterations), + log_start_ (log_start), logging_ (logging) { + timer_.calibrate (); } Client_Timer_Handler::~Client_Timer_Handler () @@ -54,19 +57,23 @@ Client_Timer_Handler::handle_timeout (const ACE_Time_Value &, { try { + CORBA::ULong server_processing_time; + timer_.start (); // we have to do some profiling first to see how we can achieve // the correct execution time. - worker_->run_task (execution_time); + server_processing_time = worker_->run_task (execution_time); timer_.stop (); - - ACE_Time_Value rt; - timer_.elapsed_time (rt); - if (logging_) - history_.push_back (rt.msec ()); + if (logging_ && (invocations_ >= log_start_)) + { + ACE_Time_Value rt; + timer_.elapsed_time (rt); + + history_.push_back (rt.msec () - server_processing_time); + } } catch (CORBA::SystemException & ex) { @@ -79,7 +86,7 @@ Client_Timer_Handler::handle_timeout (const ACE_Time_Value &, return 1; } - if ((max_iterations_ > 0) && (++invocations_ > max_iterations_)) + if ((max_iterations_ > 0) && (++invocations_ >= max_iterations_)) { worker_->stop (); diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.h b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.h index f2f84b5bb95..03b4ae40c47 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.h +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Client_Timer_Handler.h @@ -12,7 +12,8 @@ class Client_Timer_Handler : public ACE_Event_Handler { public: - Client_Timer_Handler (long iterations, + Client_Timer_Handler (unsigned long iterations, + unsigned long log_start, const std::string & filename, const ACE_Time_Value & period, bool logging = false); @@ -38,11 +39,13 @@ class Client_Timer_Handler : public ACE_Event_Handler ACE_Time_Value period_; - long invocations_; + unsigned long invocations_; std::string logfile_; - long max_iterations_; + unsigned long max_iterations_; + + unsigned long log_start_; bool logging_; diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker.idl b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker.idl index 3b183d6d69a..295a0e60fc9 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker.idl +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker.idl @@ -4,7 +4,7 @@ module DeCoRAM { interface Worker : ReplicatedApplication { - void run_task (in double execution_time); + unsigned long run_task (in double execution_time); void stop (); }; diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.cpp index 25895d53048..9e2a50a019a 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.cpp @@ -52,19 +52,30 @@ Worker_i::Worker_i (CORBA::ORB_ptr orb, suicidal_count_ (invocations), task_ (orb_.in (), suicidal_count_, state_) { + timer_.calibrate (); task_.activate (); } -void +CORBA::ULong Worker_i::run_task (CORBA::Double execution_time) { + timer_.start (); + this->cpu_.run (static_cast <size_t> (execution_time)); ++state_; agent_->state_changed (object_id_.c_str ()); + timer_.stop (); + + timer_.elapsed_time (last_execution_time_); + + ACE_DEBUG ((LM_TRACE, "le=%d\n", last_execution_time_.msec ())); + task_.signal (); + + return last_execution_time_.msec (); } void Worker_i::stop () diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.h b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.h index f5529ab7efe..bd5e4afa5b1 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.h +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/Worker_i.h @@ -5,6 +5,7 @@ #include "CPU/CPU_Worker.h" #include "ace/Task.h" #include "ace/Condition_T.h" +#include "ace/High_Res_Timer.h" #include "orbsvcs/orbsvcs/LWFT/StateSynchronizationAgentC.h" class Failure_Task : public ACE_Task_Base @@ -38,7 +39,7 @@ class Worker_i : public POA_DeCoRAM::Worker StateSynchronizationAgent_ptr agent, long invocations); - virtual void run_task (CORBA::Double execution_time); + virtual CORBA::ULong run_task (CORBA::Double execution_time); virtual void set_state (const CORBA::Any & state_value); @@ -72,6 +73,10 @@ class Worker_i : public POA_DeCoRAM::Worker long suicidal_count_; Failure_Task task_; + + ACE_High_Res_Timer timer_; + + ACE_Time_Value last_execution_time_; }; #endif /* WORKER_I_H_ */ diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/client.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/client.cpp index cfa6eb7badf..885a0270812 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/client.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/client.cpp @@ -10,22 +10,30 @@ #include "tao/ORB_Core.h" const ACE_TCHAR *ior1 = ACE_TEXT("file://test.ior"); -long iterations = 0; +unsigned long iterations = 0; +unsigned long log_start = 0; ACE_Time_Value period; double execution_time = 100; std::string server_id = "server"; +std::string prefix = ""; bool logging = false; bool kill_me = false; int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("p:r:e:s:i:lk")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("f:n:p:r:e:s:i:lk")); int c; while ((c = get_opts ()) != -1) switch (c) { + case 'f': + prefix = get_opts.opt_arg (); + break; + case 'n': + log_start = atoi (get_opts.opt_arg ()); + break; case 'p': ior1 = get_opts.opt_arg (); break; @@ -85,7 +93,9 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // Parse arguments. if (parse_args (argc, argv) != 0) - return -1; + { + return -1; + } // Test object 1. CORBA::Object_var object = @@ -99,7 +109,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) // PriorityModelPolicy, and get their server priorities. Client_Timer_Handler timeout_handler (iterations, - server_id + "-client.txt", + log_start, + prefix + server_id + "-client.txt", period, logging); diff --git a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/server.cpp b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/server.cpp index c880359304c..72ff402dc4e 100644 --- a/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/server.cpp +++ b/TAO/orbsvcs/examples/FaultTolerance/FLARe/Worker/server.cpp @@ -134,6 +134,7 @@ Task::svc (void) PortableServer::POA_var root_poa = PortableServer::POA::_narrow (object.in ()); + if (check_for_nil (root_poa.in (), "RootPOA") == -1) return -1; @@ -141,33 +142,19 @@ Task::svc (void) PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); - // Create child POA with SERVER_DECLARED PriorityModelPolicy, - // and MULTIPLE_ID id uniqueness policy (so we can use one - // servant to create several objects). - CORBA::PolicyList poa_policy_list; - poa_policy_list.length (1); - - poa_policy_list[0] = - root_poa->create_id_assignment_policy (PortableServer::USER_ID); - - PortableServer::POA_var child_poa = - root_poa->create_POA ("Child_POA", - poa_manager.in (), - poa_policy_list); - // Servant. Worker_i server_impl (this->orb_.in (), - child_poa.in (), + root_poa.in (), AppOptions::instance ()->app_id (), agent_, invocations); - int result = create_object (child_poa.in (), + int result = create_object (root_poa.in (), orb_.in (), &server_impl, ior_output.c_str ()); - CORBA::Object_var obj = child_poa->servant_to_reference (&server_impl); + CORBA::Object_var obj = root_poa->servant_to_reference (&server_impl); if (result == -1) return -1; |