diff options
author | arvindk <arvindk@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-12-14 23:47:32 +0000 |
---|---|---|
committer | arvindk <arvindk@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-12-14 23:47:32 +0000 |
commit | af888eb6f645cd85d8ad1524c3b9b3185f0424ac (patch) | |
tree | 6af9c72326df1c8e5ed183a719070639f0bc5e8a | |
parent | 8beb20e5d29f9141ed35dac89e7f90641cd1ca5a (diff) | |
download | ATCD-af888eb6f645cd85d8ad1524c3b9b3185f0424ac.tar.gz |
ChangelogTag: Tue Dec 14 17:38:16 2004 Arvind S. Krishna <arvindk@dre.vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 13 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/Collocation/Client_Task.cpp | 33 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/Collocation/Client_Task.h | 10 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/Collocation/Collocated_Test.cpp | 42 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/Collocation/Server_Task.cpp | 40 | ||||
-rw-r--r-- | TAO/performance-tests/Latency/Collocation/Server_Task.h | 16 | ||||
-rwxr-xr-x | TAO/performance-tests/Latency/Collocation/run_test.pl | 22 |
7 files changed, 88 insertions, 88 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index f4100cd34f0..9982e6e049b 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,16 @@ +Tue Dec 14 17:38:16 2004 Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + + * performance-tests/Latency/Collocation/Client_Task.cpp: + * performance-tests/Latency/Collocation/Client_Task.h: + * performance-tests/Latency/Collocation/Server_Task.h: + * performance-tests/Latency/Collocation/Server_Task.cpp: + * performance-tests/Latency/Collocation/Collocated_Test.cpp: + * performance-tests/Latency/Collocation/run_test.pl + + Fixed this test to directly obtain the reference of the remote + object than from a file. Also removed passing unnecessary ORB + references around. Added run_test.pl to run the test. + Tue Dec 14 14:55:00 2004 Greg Bostrom <greg.bostrom@hp.com> * TAO_IDL/include/idl_uns_long.h: diff --git a/TAO/performance-tests/Latency/Collocation/Client_Task.cpp b/TAO/performance-tests/Latency/Collocation/Client_Task.cpp index db51b1eac45..dbdeba1795e 100644 --- a/TAO/performance-tests/Latency/Collocation/Client_Task.cpp +++ b/TAO/performance-tests/Latency/Collocation/Client_Task.cpp @@ -3,47 +3,31 @@ // #include "Client_Task.h" -#include "TestC.h" #include "ace/Stats.h" #include "ace/Sample_History.h" #include "ace/High_Res_Timer.h" #include "ace/SString.h" -Client_Task::Client_Task (const char *ior, +Client_Task::Client_Task (Test::Roundtrip_ptr reference, int iterations, - CORBA::ORB_ptr corb, ACE_Thread_Manager *thr_mgr) : ACE_Task_Base (thr_mgr), - input_ (ior), niterations (iterations), - corb_ (CORBA::ORB::_duplicate (corb)) + remote_ref_ (Test::Roundtrip::_duplicate (reference)) { } - int Client_Task::svc (void) { ACE_TRY_NEW_ENV { - ACE_TString ior ("file://"); - ior += input_; - - CORBA::Object_var tmp = - this->corb_->string_to_object (ior.c_str() - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - Test::Roundtrip_var rt = - Test::Roundtrip::_narrow(tmp.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (rt.in ())) + if (CORBA::is_nil (this->remote_ref_.in ())) { ACE_ERROR_RETURN ((LM_DEBUG, - "Nil Test::Roundtrip reference <%s>\n", - ior.c_str()) ,1); + "Nil Test::Roundtrip reference\n"), + 1); } //// Start Test /////////////////////////////// @@ -51,7 +35,7 @@ Client_Task::svc (void) // Warm up the system for (int i=0; i < 1000; i++) - rt->test_method (test_time); + this->remote_ref_->test_method (test_time); // Start for actual Measurements ACE_Sample_History history (niterations); @@ -61,7 +45,7 @@ Client_Task::svc (void) { ACE_hrtime_t start = ACE_OS::gethrtime (); - (void) rt->test_method (start ACE_ENV_ARG_PARAMETER); + (void) this->remote_ref_->test_method (start ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; ACE_hrtime_t now = ACE_OS::gethrtime (); @@ -85,9 +69,10 @@ Client_Task::svc (void) stats.samples_count ()); //shutdown the server ORB - rt->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + this->remote_ref_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } + ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, diff --git a/TAO/performance-tests/Latency/Collocation/Client_Task.h b/TAO/performance-tests/Latency/Collocation/Client_Task.h index 358d98e408a..5fe9038a703 100644 --- a/TAO/performance-tests/Latency/Collocation/Client_Task.h +++ b/TAO/performance-tests/Latency/Collocation/Client_Task.h @@ -10,8 +10,9 @@ #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/ORB.h" +#include "tao/ORB.h" +#include "TestC.h" /// Implement a Task to run the client as a thread class Client_Task : public ACE_Task_Base @@ -19,18 +20,17 @@ class Client_Task : public ACE_Task_Base public: /// Constructor - Client_Task (const char *input, + Client_Task (Test::Roundtrip_ptr reference, int iterations, - CORBA::ORB_ptr corb, ACE_Thread_Manager *thr_mgr); /// Thread entry point int svc (void); private: - const char *input_; + const int niterations; - CORBA::ORB_var corb_; + Test::Roundtrip_var remote_ref_; }; diff --git a/TAO/performance-tests/Latency/Collocation/Collocated_Test.cpp b/TAO/performance-tests/Latency/Collocation/Collocated_Test.cpp index 9dd3667fa5d..f4c6d4c2719 100644 --- a/TAO/performance-tests/Latency/Collocation/Collocated_Test.cpp +++ b/TAO/performance-tests/Latency/Collocation/Collocated_Test.cpp @@ -3,14 +3,13 @@ #include "Server_Task.h" #include "Client_Task.h" #include "ace/Get_Opt.h" -#include "ace/Argv_Type_Converter.h" #include "ace/Sched_Params.h" #include "ace/OS_NS_errno.h" +#include "ace/Manual_Event.h" #include "tao/Strategies/advanced_resource.h" -const char *ior_file = "test.ior"; -int niterations = 100; +int niterations = 250000; int parse_args (int argc, char *argv[]) @@ -21,13 +20,10 @@ parse_args (int argc, char *argv[]) while ((c = get_opts ()) != -1) switch (c) { - case 'k': - ior_file = get_opts.opt_arg (); - break; case 'n': niterations = ACE_OS::atoi (get_opts.opt_arg ()); break; - case '?': + default: // This is a hack but that is okay! return 0; @@ -65,28 +61,22 @@ set_priority() int main (int argc, char *argv[]) { - if (parse_args (argc,argv) == -1) - return -1; - //Use Real-time Scheduling class if possible set_priority(); ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - ACE_Argv_Type_Converter satc (argc, argv); CORBA::ORB_var sorb = - CORBA::ORB_init (satc.get_argc (), - satc.get_TCHAR_argv (), - "" - ACE_ENV_ARG_PARAMETER); - + CORBA::ORB_init (argc, argv, 0 ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - ACE_Null_Mutex mutex; - ACE_Null_Condition wait_for_event (mutex); - Server_Task server_task (ior_file, - sorb.in (), + if (parse_args (argc,argv) == -1) + return -1; + + ACE_Manual_Event wait_for_event; + + Server_Task server_task (sorb.in (), wait_for_event, ACE_Thread_Manager::instance ()); @@ -100,17 +90,11 @@ main (int argc, char *argv[]) // Wait for the server thread to do some processing wait_for_event.wait (); - ACE_Argv_Type_Converter catc (argc, argv); - CORBA::ORB_var corb = - CORBA::ORB_init (catc.get_argc (), - catc.get_TCHAR_argv (), - "" - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + // Obtain the object reference + Test::Roundtrip_var reference = server_task.get_reference (); - Client_Task client_task (ior_file, + Client_Task client_task (reference.in (), niterations, - corb.in (), ACE_Thread_Manager::instance ()); if (client_task.activate (THR_NEW_LWP | THR_JOINABLE, diff --git a/TAO/performance-tests/Latency/Collocation/Server_Task.cpp b/TAO/performance-tests/Latency/Collocation/Server_Task.cpp index 341a55d6651..33f309ff316 100644 --- a/TAO/performance-tests/Latency/Collocation/Server_Task.cpp +++ b/TAO/performance-tests/Latency/Collocation/Server_Task.cpp @@ -3,20 +3,22 @@ // #include "Server_Task.h" -#include "TestS.h" #include "Roundtrip.h" -Server_Task::Server_Task (const char* ior_file, - CORBA::ORB_ptr sorb, - ACE_Null_Condition &cond, +Server_Task::Server_Task (CORBA::ORB_ptr sorb, + ACE_Manual_Event &cond, ACE_Thread_Manager *thr_mgr) : ACE_Task_Base (thr_mgr), - ior_file(ior_file), cond_ (cond), sorb_ (CORBA::ORB::_duplicate (sorb)) { } +Test::Roundtrip * +Server_Task::get_reference () +{ + return Test::Roundtrip::_duplicate (this->rt_var_.in ()); +} int Server_Task::svc (void) @@ -50,38 +52,28 @@ Server_Task::svc (void) PortableServer::ServantBase_var owner_transfer(rt_impl); - Test::Roundtrip_var rt_var = + this->rt_var_ = rt_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; - CORBA::String_var ior = - this->sorb_->object_to_string (rt_var.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - // Output the IOR to the <this->output_> - FILE *output_file= ACE_OS::fopen (this->ior_file, - "w"); - if (output_file == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open output file for writing IOR: %s", - this->ior_file), - 1); - - ACE_OS::fprintf (output_file, "%s", ior.in ()); - ACE_OS::fclose (output_file); + if (CORBA::is_nil (this->rt_var_.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Error activating Test::Roundtrip reference\n"), + 1); + } poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; + ACE_DEBUG ((LM_DEBUG, "Server_Task: Object Activation complete\n")); + // Signal the main thread to spawn the client this->cond_.signal (); this->sorb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); - root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; diff --git a/TAO/performance-tests/Latency/Collocation/Server_Task.h b/TAO/performance-tests/Latency/Collocation/Server_Task.h index 1eabdc83191..f9f8a13cf28 100644 --- a/TAO/performance-tests/Latency/Collocation/Server_Task.h +++ b/TAO/performance-tests/Latency/Collocation/Server_Task.h @@ -7,34 +7,38 @@ #include /**/ "ace/pre.h" #include "ace/Task.h" +#include "ace/Manual_Event.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/ORB.h" +#include "TestC.h" /// Implement a Task to run the server in a single thread class Server_Task : public ACE_Task_Base { public: /// Constructor - Server_Task (const char* ior_file, - CORBA::ORB_ptr sorb, - ACE_Null_Condition &cond, + Server_Task (CORBA::ORB_ptr sorb, + ACE_Manual_Event &cond, ACE_Thread_Manager *thr_mgr); /// Thread entry point - int svc (void); + int svc (); + + //Test::Roundtrip_prt get_reference (); + Test::Roundtrip * get_reference (); private: - const char* ior_file; + ACE_Manual_Event &cond_; /// Manual event to wake up the main thread to create a client /// thread. - ACE_Null_Condition &cond_; CORBA::ORB_var sorb_; + Test::Roundtrip_var rt_var_; }; #include /**/ "ace/post.h" diff --git a/TAO/performance-tests/Latency/Collocation/run_test.pl b/TAO/performance-tests/Latency/Collocation/run_test.pl new file mode 100755 index 00000000000..132227f19e8 --- /dev/null +++ b/TAO/performance-tests/Latency/Collocation/run_test.pl @@ -0,0 +1,22 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib '../../../../bin'; +use PerlACE::Run_Test; + +$status = 0; + +$SV = new PerlACE::Process ("Collocated_Test"); + +$server = $SV->SpawnWaitKill (60); + +if ($server != 0) { + print STDERR "ERROR: Collocated_Test returned $server \n"; + $status = 1; +} + +exit $status; |