diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-13 02:21:11 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-13 02:21:11 +0000 |
commit | d7a5c3a6d87f21bddc1e1ec958ea58b9d01d7439 (patch) | |
tree | f00d40b11eba2ee16314d586474d69090dced5dc /TAO | |
parent | 8b15faae84942b6ff75e3cf952ccf5cc3cf437e3 (diff) | |
download | ATCD-d7a5c3a6d87f21bddc1e1ec958ea58b9d01d7439.tar.gz |
ChangeLogTag:Mon Jul 12 20:40:38 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog-99c | 13 | ||||
-rw-r--r-- | TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp | 226 | ||||
-rw-r--r-- | TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h | 8 | ||||
-rw-r--r-- | TAO/performance-tests/Cubit/TAO/MT_Cubit/svc.conf | 2 | ||||
-rw-r--r-- | TAO/tao/ORB.cpp | 2 |
5 files changed, 120 insertions, 131 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index f6263328623..74dfaccc6f7 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,16 @@ +Mon Jul 12 20:40:38 1999 Carlos O'Ryan <coryan@cs.wustl.edu> + + * tao/ORB.cpp: + The ORB returned from CORBA::ORB_init() should be duplicated + + * performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h: + * performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp: + Use an ORB-per-thread to minimize contention and simplify memory + managment of per-ORB-per-thread resources. + + * performance-tests/Cubit/TAO/MT_Cubit/svc.conf: + Fixed the InputCDRAllocator argument + Mon Jul 12 19:23:47 1999 Jeff Parsons <parsons@cs.wustl.edu> * TAO_IDL/fe/idl.ll: diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp index 148c81799db..ce0c9eb230a 100644 --- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp +++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp @@ -273,7 +273,6 @@ Client::Client (ACE_Thread_Manager *thread_manager, my_jitter_array_ (0), timer_ (0), frequency_ (0), - orb_ (0), latency_ (0), argc_ (argc), argv_ (argv) @@ -553,14 +552,11 @@ Client::find_frequency (void) } } -int -Client::init_orb (void) +CORBA::ORB_ptr +Client::init_orb (CORBA::Environment &ACE_TRY_ENV) { - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - ACE_DEBUG ((LM_DEBUG, - "I'm thread %t\n")); + ACE_DEBUG ((LM_DEBUG, + "I'm thread %t\n")); // Convert the argv vector into a string. @@ -582,11 +578,13 @@ Client::init_orb (void) int argc = tmp_args2.argc (); char **argv = tmp_args2.argv (); - this->orb_ = CORBA::ORB_init (argc, - argv, - "internet", - ACE_TRY_ENV); - ACE_TRY_CHECK; + char orbid[64]; + ACE_OS::sprintf (orbid, "orb:%d", this->id_); + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv, + orbid, + ACE_TRY_ENV); + ACE_CHECK_RETURN (CORBA::ORB::_nil ()); if (this->id_ == 0) { @@ -596,12 +594,14 @@ Client::init_orb (void) int result = this->ts_->parse_args (argc, argv); if (result != 0) - return -1; + return CORBA::ORB::_nil (); ACE_DEBUG ((LM_DEBUG, "(%t)Arguments parsed successfully\n")); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ready_mon, this->ts_->ready_mtx_, 1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ready_mon, + this->ts_->ready_mtx_, + CORBA::ORB::_nil ()); this->ts_->ready_ = 1; this->ts_->ready_cnd_.broadcast (); ready_mon.release (); @@ -609,129 +609,109 @@ Client::init_orb (void) ACE_DEBUG ((LM_DEBUG, "(%t) ORB_init success\n")); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Client::Orb_init ()"); - return -1; - } - ACE_ENDTRY; - return 0; + return orb._retn (); } int -Client::get_cubit (void) +Client::get_cubit (CORBA::ORB_ptr orb, CORBA::Environment &ACE_TRY_ENV) { - CORBA::Object_var objref (0); + char *my_ior = + this->ts_->use_utilization_test_ == 1 + ? this->ts_->one_ior_ + : this->ts_->iors_[this->id_]; + + // If we are running the "1 to n" test make sure all low + // priority clients use only 1 low priority servant. + if (this->id_ > 0 + && this->ts_->one_to_n_test_ == 1) + my_ior = this->ts_->iors_[1]; + + if (my_ior == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Must specify valid ior filename with -f option\n"), + -1); + + CORBA::Object_var objref = + orb->string_to_object (my_ior, + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (objref.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%t) string_to_object Failed!\n"), + -1); + + // Narrow the CORBA::Object reference to the stub object, + // checking the type along the way using _is_a. + this->cubit_ = Cubit::_narrow (objref.in (), + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (this->cubit_)) + ACE_ERROR_RETURN ((LM_ERROR, + "Create cubit failed\n"), + -1); - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - char *my_ior = - this->ts_->use_utilization_test_ == 1 - ? this->ts_->one_ior_ - : this->ts_->iors_[this->id_]; - - // If we are running the "1 to n" test make sure all low - // priority clients use only 1 low priority servant. - if (this->id_ > 0 - && this->ts_->one_to_n_test_ == 1) - my_ior = this->ts_->iors_[1]; - - if (my_ior == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Must specify valid ior filename with -f option\n"), - -1); - - objref = this->orb_->string_to_object (my_ior, - ACE_TRY_ENV); - ACE_TRY_CHECK; - - if (CORBA::is_nil (objref.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%t) string_to_object Failed!\n"), - -1); - - // Narrow the CORBA::Object reference to the stub object, - // checking the type along the way using _is_a. - this->cubit_ = Cubit::_narrow (objref.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; - - if (CORBA::is_nil (this->cubit_)) - ACE_ERROR_RETURN ((LM_ERROR, - "Create cubit failed\n"), - 1); - - ACE_DEBUG ((LM_DEBUG, - "(%t) Binding succeeded\n")); + ACE_DEBUG ((LM_DEBUG, + "(%t) Binding succeeded\n")); - CORBA::String_var str = - this->orb_->object_to_string (this->cubit_, - ACE_TRY_ENV); - ACE_TRY_CHECK; + CORBA::String_var str = + orb->object_to_string (this->cubit_, + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + ACE_DEBUG ((LM_DEBUG, + "(%t) CUBIT OBJECT connected to <%s>\n", + str.in ())); - ACE_DEBUG ((LM_DEBUG, - "(%t) CUBIT OBJECT connected to <%s>\n", - str.in ())); - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Client::get_cubit"); - return -1; - } - ACE_ENDTRY; return 0; } int Client::svc (void) { - // Initialize the ORB. - int result = this->init_orb (); - if (result != 0) - return result; + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + // Initialize the ORB. + CORBA::ORB_var orb = this->init_orb (ACE_TRY_ENV); + ACE_TRY_CHECK; - // Find the frequency of CORBA requests based on thread id. - this->find_frequency (); + // Find the frequency of CORBA requests based on thread id. + this->find_frequency (); - // Get the cubit object from the file. - result = this->get_cubit (); - if (result != 0) - return result; + // Get the cubit object from the file. + int r = this->get_cubit (orb.in (), ACE_TRY_ENV); + ACE_TRY_CHECK; + if (r != 0) + return r; - ACE_DEBUG ((LM_DEBUG, - "(%t) Waiting for other threads to " - "finish binding..\n")); + ACE_DEBUG ((LM_DEBUG, + "(%t) Waiting for other threads to " + "finish binding..\n")); - // Wait for all the client threads to be initialized before going - // any further. - this->ts_->barrier_->wait (); - ACE_DEBUG ((LM_DEBUG, - "(%t; %D) Everyone's done, here I go!!\n")); - if (this->ts_->oneway_ == 1) - ACE_DEBUG ((LM_DEBUG, - "(%t) **** USING ONEWAY CALLS ****\n")); + // Wait for all the client threads to be initialized before going + // any further. + this->ts_->barrier_->wait (); + ACE_DEBUG ((LM_DEBUG, + "(%t; %D) Everyone's done, here I go!!\n")); + if (this->ts_->oneway_ == 1) + ACE_DEBUG ((LM_DEBUG, + "(%t) **** USING ONEWAY CALLS ****\n")); - // Perform the tests. - result = this->run_tests (); - if (result != 0) - { - ACE_ERROR ((LM_ERROR, "(%t) Error occurred in run_test ()\n")); - return result; - } + // Perform the tests. + int result = this->run_tests (); + if (result != 0) + return result; - // release the semaphore - if (this->ts_->thread_per_rate_ == 1 - && this->id_ == this->ts_->thread_count_ - 1) - this->ts_->semaphore_->release (this->ts_->thread_count_ - 1); - else - this->ts_->semaphore_->release (); + // release the semaphore + if (this->ts_->thread_per_rate_ == 1 + && this->id_ == this->ts_->thread_count_ - 1) + this->ts_->semaphore_->release (this->ts_->thread_count_ - 1); + else + this->ts_->semaphore_->release (); - // shutdown the server if necessary. - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { + // shutdown the server if necessary. if (this->ts_->shutdown_) { ACE_DEBUG ((LM_DEBUG, @@ -739,18 +719,16 @@ Client::svc (void) this->cubit_->shutdown (ACE_TRY_ENV); ACE_TRY_CHECK; } + + CORBA::release (this->cubit_); + this->cubit_ = 0; } ACE_CATCHANY { - ACE_ERROR ((LM_ERROR, - "Shutdown of the server failed!\n")); - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "shutdown() call failed.\n"); + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Task_Client::svc()"); } ACE_ENDTRY; - // Delete dynamic memory - CORBA::release (this->cubit_); - // To avoid a memPartFree on VxWorks. It will leak memory, though. int status = 0; diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h index b966fd23942..bc41d77eb50 100644 --- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h +++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h @@ -274,13 +274,14 @@ public: // cubed. private: - int init_orb (void); + CORBA::ORB_ptr init_orb (CORBA::Environment &ACE_TRY_ENV); // initialize the ORB. void read_ior (void); // reads the cubit ior from a file. - int get_cubit (void); + int get_cubit (CORBA::ORB_ptr orb, + CORBA::Environment &ACE_TRY_ENV); // gets the cubit object. int run_tests (void); @@ -355,9 +356,6 @@ private: ACE_timer_t frequency_; // frequency of CORBA requests. - CORBA::ORB_var orb_; - // ORB pointer. - ACE_timer_t latency_; // aggregate latency of the requests. diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/svc.conf b/TAO/performance-tests/Cubit/TAO/MT_Cubit/svc.conf index f8f49d4290c..e05046555c7 100644 --- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/svc.conf +++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/svc.conf @@ -3,6 +3,6 @@ # Please see $TAO_ROOT/docs/Options.html for details on these options. # -static Resource_Factory "-ORBResources tss -ORBInputCDRAllocator tss" +static Resource_Factory "-ORBResources tss -ORBInputCDRAllocator null" static Client_Strategy_Factory "-ORBProfileLock null -ORBClientConnectionHandler RW" static Server_Strategy_Factory "-ORBConcurrency thread-per-connection -ORBPOALock null -ORBConnectorLock null -ORBAllowReactivationOfSystemids 0" diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 3e4990ba88c..b6ac04115d9 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -1332,7 +1332,7 @@ CORBA::ORB_init (int &argc, // The ORB was initialized already, just return that one! if (oc != 0) - return oc->orb (); + return CORBA::ORB::_duplicate (oc->orb ()); // @@ As part of the ORB re-architecture this will the point where // we locate the right ORB (from a table) and use that one |