diff options
author | gokhale <asgokhale@users.noreply.github.com> | 1998-10-30 20:15:49 +0000 |
---|---|---|
committer | gokhale <asgokhale@users.noreply.github.com> | 1998-10-30 20:15:49 +0000 |
commit | 030fda56841cdfd0e4e0611d27c55a49a1f579ce (patch) | |
tree | a89a955f8d4d3a95d753e15f69879ddd5046b2c2 | |
parent | 04a443594df3d7d6aabc161d81bcd661d712fbc2 (diff) | |
download | ATCD-030fda56841cdfd0e4e0611d27c55a49a1f579ce.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/ChangeLog-98c | 30 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/codegen.cpp | 3 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/codegen.h | 12 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/gen_names.cpp | 49 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/idl.cpp | 10 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/servant_impl.cpp | 11 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/demux_test_client.cpp | 59 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/demux_test_server.cpp | 6 |
8 files changed, 141 insertions, 39 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 5d527faa6c7..b27d4853f78 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,33 @@ +Fri Oct 30 15:10:16 EST 1998 Aniruddha Gokhale <gokhale@sahyadri.research.bell-labs.com> + + * performance_tests/Demux/CodeGen + + Made modifications such that a new method called shutdown is + always generated for every interface. This method will be called + to shutdown the ORB on the server side. + + In addition, we now generate the poa-names.dat file with a POA + depth appaneded to it. Thus we shall have names like + poa_names_1.dat. This will enable us to create many executables + at the same time. Otherwise, everytime we ran the demux + executable, we were overwriting this file. In the servant + implementation, for the shutdown mehtod, we call the shutdown on + the ORB. + + Affected files are: + + codegen.cpp + codegen.h + gen_names.cpp + idl.cpp + servant_impl.cpp + + * performance_tests/Demux/demux_test_client.cpp + + The client now invokes the shutdown method on the very first obj + reference it holds. This will enable the ORB shutting down on + the other side. + Fri Oct 30 13:50:21 1998 David L. Levine <levine@cs.wustl.edu> * TAO_IDL/be/be_visitor_array/any_op_cs.cpp, diff --git a/TAO/performance-tests/Demux/CodeGen/codegen.cpp b/TAO/performance-tests/Demux/CodeGen/codegen.cpp index f67c07bd088..2d346ac0aff 100644 --- a/TAO/performance-tests/Demux/CodeGen/codegen.cpp +++ b/TAO/performance-tests/Demux/CodeGen/codegen.cpp @@ -23,6 +23,7 @@ Demux_Test_CodeGenerator::Demux_Test_CodeGenerator (void) : num_POAs_ (1), // 1 child POA num_objs_ (1), num_ops_ (1), + state_ (Demux_Test_CodeGenerator::CG_NONE), oneway_ (0), debug_ (0) { @@ -133,6 +134,8 @@ Demux_Test_CodeGenerator::run (void) -1); } + this->state_ = Demux_Test_CodeGenerator::CG_NONE; + // debugging if (this->debug_) { diff --git a/TAO/performance-tests/Demux/CodeGen/codegen.h b/TAO/performance-tests/Demux/CodeGen/codegen.h index 6f684d12673..c929a04c3e3 100644 --- a/TAO/performance-tests/Demux/CodeGen/codegen.h +++ b/TAO/performance-tests/Demux/CodeGen/codegen.h @@ -43,6 +43,14 @@ public: int run (void); // run the various algorithms + enum CG_STATE + { + CG_NONE, + CG_POA, + CG_OBJ, + CG_OP + }; + private: int parse_args (int argc, char *argv []); // parse arguments @@ -117,11 +125,15 @@ private: ACE_Unbounded_Queue <ACE_CString> op_array_; // array of operation names + CG_STATE state_; + // code generation state + int oneway_; // whether operations must be oneway or not int debug_; // whether to print debugging info + }; diff --git a/TAO/performance-tests/Demux/CodeGen/gen_names.cpp b/TAO/performance-tests/Demux/CodeGen/gen_names.cpp index dbaae84fdeb..77e7cdc8f54 100644 --- a/TAO/performance-tests/Demux/CodeGen/gen_names.cpp +++ b/TAO/performance-tests/Demux/CodeGen/gen_names.cpp @@ -25,6 +25,7 @@ ACE_RCSID(CodeGen, gen_names, "$Id$") int Demux_Test_CodeGenerator::gen_poa_names (void) { + this->state_ = Demux_Test_CodeGenerator::CG_POA; if (this->gen_names (this->poa_array_, this->num_POAs_) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -35,12 +36,15 @@ Demux_Test_CodeGenerator::gen_poa_names (void) // We store the generated names in a file FILE *fp; + char poa_file [128]; - if ((fp = ACE_OS::fopen ("poa_names.dat", "w")) == 0) + ACE_OS::sprintf (poa_file, "poa_names_%d.dat", this->num_POAs_); + + if ((fp = ACE_OS::fopen (poa_file, "w")) == 0) { ACE_ERROR_RETURN ((LM_ERROR, "(%n:%l) Demux_Test_CodeGenerator::gen_poa_names - " - "Failed to open file\n"), + "Failed to open file %s\n", poa_file), -1); } @@ -69,6 +73,7 @@ Demux_Test_CodeGenerator::gen_poa_names (void) int Demux_Test_CodeGenerator::gen_object_names (void) { + this->state_ = Demux_Test_CodeGenerator::CG_OBJ; if (this->gen_names (this->obj_array_, this->num_objs_) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -83,6 +88,7 @@ Demux_Test_CodeGenerator::gen_object_names (void) int Demux_Test_CodeGenerator::gen_operation_names (void) { + this->state_ = Demux_Test_CodeGenerator::CG_OP; if (this->gen_names (this->op_array_, this->num_ops_) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -91,6 +97,15 @@ Demux_Test_CodeGenerator::gen_operation_names (void) -1); } + // save it at this location + if (this->op_array_.enqueue_tail (ACE_CString ("shutdown")) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%n:%l) Demux_Test_CodeGenerator::gen_operation_names - " + "Failed to enqueue the shutdown operation\n"), + -1); + } + return 0; } @@ -123,8 +138,8 @@ int Demux_Test_CodeGenerator::insert_unique_string (ACE_Unbounded_Queue<ACE_CString> &arr) { long rnd; - ACE_CString s; - long status; + ACE_CString str; + int exists = 1; // get a random number between 3 and 32 rnd = this->gen_rand (3,32); @@ -132,29 +147,41 @@ Demux_Test_CodeGenerator::insert_unique_string (ACE_Unbounded_Queue<ACE_CString> // This random number is used as a string length of the distinct string to be // generated. - do + do { - if (this->create_string (rnd, s) == -1) + if (this->create_string (rnd, str) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%n:%l) Demux_Test_CodeGenerator::insert_unique_string - " "Failed to create string\n"), -1); } + + // if we are generating operations, we do not want to generate the + // operation "shutdown" that has special semantics + if ((this->state_ == Demux_Test_CodeGenerator::CG_OP) && + (!ACE_OS::strcmp (str.c_str (), "shutdown"))) + { + // repeat the loop since we cannot accept this string + continue; + } - status = this->is_present (arr, s); - if (status == -1) + exists = this->is_present (arr, str); + if (exists == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%n:%l) Demux_Test_CodeGenerator::insert_unique_string - " "is_present check failed\n"), -1); } - } - while (status > 0); + } + while (exists > 0); + // we are here implies that the generated string did not exist in the queue + // that has been created so far + // save it at this location - if (arr.enqueue_tail (s) == -1) + if (arr.enqueue_tail (str) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%n:%l) Demux_Test_CodeGenerator::insert_unique_string - " diff --git a/TAO/performance-tests/Demux/CodeGen/idl.cpp b/TAO/performance-tests/Demux/CodeGen/idl.cpp index fc3c6456532..225c11f6734 100644 --- a/TAO/performance-tests/Demux/CodeGen/idl.cpp +++ b/TAO/performance-tests/Demux/CodeGen/idl.cpp @@ -52,9 +52,13 @@ Demux_Test_CodeGenerator::gen_idl_interface (void) // grab the next element waiting to be grabbed (void) iter.next (str); - ACE_OS::fprintf (fp, " %svoid %s ();\n", - (this->oneway_ ? "oneway ": ""), - str->rep ()); + // only the shutdown method is always oneway + if (!ACE_OS::strcmp (str->c_str (), "shutdown")) + ACE_OS::fprintf (fp, " oneway void shutdown ();\n"); + else + ACE_OS::fprintf (fp, " %svoid %s ();\n", + (this->oneway_ ? "oneway ": ""), + str->c_str ()); (void) iter.advance (); } diff --git a/TAO/performance-tests/Demux/CodeGen/servant_impl.cpp b/TAO/performance-tests/Demux/CodeGen/servant_impl.cpp index 92317485d2f..4f0766626e1 100644 --- a/TAO/performance-tests/Demux/CodeGen/servant_impl.cpp +++ b/TAO/performance-tests/Demux/CodeGen/servant_impl.cpp @@ -67,7 +67,7 @@ Demux_Test_CodeGenerator::gen_servant_impl_code (void) (void) iter.next (str); ACE_OS::fprintf (fp, "void Demux_Test_i::%s (CORBA::Environment &env)\n", - str->rep ()); + str->c_str ()); // if debugging desired ACE_OS::fprintf (fp, "{\n"); ACE_OS::fprintf (fp, " ACE_UNUSED_ARG (env);\n"); @@ -76,7 +76,14 @@ Demux_Test_CodeGenerator::gen_servant_impl_code (void) { ACE_OS::fprintf (fp, " ACE_DEBUG ((LM_DEBUG, " "\"Inside Demux_Test_i::%s\\n\"));\n", - str->rep ()); + str->c_str ()); + } + + // if this is a shutdown method + if (!ACE_OS::strcmp (str->c_str (), "shutdown")) + { + ACE_OS::fprintf (fp, + " TAO_ORB_Core_instance ()->orb ()->shutdown ();\n"); } ACE_OS::fprintf (fp, "}\n\n"); diff --git a/TAO/performance-tests/Demux/demux_test_client.cpp b/TAO/performance-tests/Demux/demux_test_client.cpp index 37bfa91f842..af2ba8dd7f9 100644 --- a/TAO/performance-tests/Demux/demux_test_client.cpp +++ b/TAO/performance-tests/Demux/demux_test_client.cpp @@ -243,16 +243,16 @@ Demux_Test_Client::parse_args (void) int Demux_Test_Client::run (CORBA::Environment &env) { - TAO_TRY + // open a temporary results file + if ((this->result_fp_ = ACE_OS::fopen ("results.dat", "w")) == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Demux_Test_Client::run - " + "Failed to open the results file for writing\n"), + -1); + } + TAO_TRY_EX (RUN) { - // open a temporary results file - if ((this->result_fp_ = ACE_OS::fopen ("results.dat", "w")) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Demux_Test_Client::run - " - "Failed to open the results file for writing\n"), - -1); - } switch (this->is_) { case Demux_Test_Client::LINEAR: @@ -268,18 +268,7 @@ Demux_Test_Client::run (CORBA::Environment &env) (void) this->run_worst_test (TAO_TRY_ENV); break; } - TAO_CHECK_ENV; - - ACE_OS::fclose (this->result_fp_); - - // now print the results - if (this->print_results () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Demux_Test_Client::run - " - "Print results failed\n"), - -1); - } + TAO_CHECK_ENV_EX (RUN); } TAO_CATCHANY { @@ -291,7 +280,35 @@ Demux_Test_Client::run (CORBA::Environment &env) -1); } TAO_ENDTRY; + + ACE_OS::fclose (this->result_fp_); + TAO_TRY_EX (SHUTDOWN) + { + // call the shutdown method one the first object + this->demux_test_[0][0]->shutdown (TAO_TRY_ENV); + TAO_CHECK_ENV_EX (SHUTDOWN); + } + TAO_CATCHANY + { + TAO_TRY_ENV.print_exception ("shutdown failed"); + env.exception (TAO_TRY_ENV.exception ()); + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) Demux_Test_Client::run - " + "Error running the Client\n"), + -1); + } + TAO_ENDTRY; + + // now print the results + if (this->print_results () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Demux_Test_Client::run - " + "Print results failed\n"), + -1); + } + return 0; } diff --git a/TAO/performance-tests/Demux/demux_test_server.cpp b/TAO/performance-tests/Demux/demux_test_server.cpp index e2092bcb75f..b80e50d465d 100644 --- a/TAO/performance-tests/Demux/demux_test_server.cpp +++ b/TAO/performance-tests/Demux/demux_test_server.cpp @@ -150,10 +150,12 @@ Demux_Test_Server::init (int argc, char *argv [], CORBA::Environment &env) // the specified number of objects. Finally, activate these objects. // open the file that has all the POA names in it - if ((this->poa_fp_ = ACE_OS::fopen ("poa_names.dat", "r")) == 0) + char poa_file [128]; + ACE_OS::sprintf (poa_file, "poa_names_%d.dat", this->num_POAs_); + if ((this->poa_fp_ = ACE_OS::fopen (poa_file, "r")) == 0) { ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to open POA file\n"), + " (%P|%t) Unable to open POA file %s\n", poa_file), -1); } |