diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-09-26 04:48:10 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-09-26 04:48:10 +0000 |
commit | b76123eb8d3f38319faed8a7ecdc6d2a8be5648c (patch) | |
tree | 47b8b0fab85e8ee88ca4117b12b6839226e434fc | |
parent | 90daabfba972b01c35708b67ac57b318574985c0 (diff) | |
download | ATCD-b76123eb8d3f38319faed8a7ecdc6d2a8be5648c.tar.gz |
ChangeLogTag: Tue Sep 25 23:45:30 2001 Irfan Pyarali <irfan@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 35 | ||||
-rw-r--r-- | TAO/performance-tests/RTCorba/Thread_Pool/bands | 1 | ||||
-rw-r--r-- | TAO/performance-tests/RTCorba/Thread_Pool/client.cpp | 183 | ||||
-rw-r--r-- | TAO/performance-tests/RTCorba/Thread_Pool/empty_file | 0 | ||||
-rw-r--r-- | TAO/performance-tests/RTCorba/Thread_Pool/invocation_priorities | 1 | ||||
-rw-r--r-- | TAO/performance-tests/RTCorba/Thread_Pool/lanes | 1 | ||||
-rw-r--r-- | TAO/performance-tests/RTCorba/Thread_Pool/server.cpp | 141 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Linear_Priority/client.cpp | 10 | ||||
-rw-r--r-- | TAO/tests/RTCORBA/Linear_Priority/readers.cpp | 109 |
9 files changed, 276 insertions, 205 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 2d27d88811f..ac46e321802 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,38 @@ +Tue Sep 25 23:45:30 2001 Irfan Pyarali <irfan@cs.wustl.edu> + + * performance-tests/RTCorba/Thread_Pool/client.cpp: + + - Include tests/RTCORBA/Linear_Priority/readers.cpp to reuse + common file parsing code. This way we can removed the + get_rates() function. + + - Invocation priorities can either be automatically + calculated (as before) or can be explicitly specified + through the <invocation_priorities_file> option. + + * performance-tests/RTCorba/Thread_Pool/server.cpp: + + - Include tests/RTCORBA/Linear_Priority/readers.cpp to reuse + common file parsing code. Auto lane priorities and bands + calculations were moved to readers.cpp. + + - Lane priorities and bands can either be automatically + calculated (as before) or can be explicitly specified + through the <bands_file> and <lanes_file> options. + + * performance-tests/RTCorba/Thread_Pool/empty_file + * performance-tests/RTCorba/Thread_Pool/invocation_priorities + * performance-tests/RTCorba/Thread_Pool/lanes + * performance-tests/RTCorba/Thread_Pool/bands + + New files. + + * tests/RTCORBA/Linear_Priority/client.cpp (main): Renamed + Priorities to Short_Array. + + * tests/RTCORBA/Linear_Priority/readers.cpp: Generalized some + methods. + Tue Sep 25 17:40:08 2001 Balachandran Natarajan <bala@cs.wustl.edu> * tests/AMI_Buffering/client.cpp (run_buffer_size): diff --git a/TAO/performance-tests/RTCorba/Thread_Pool/bands b/TAO/performance-tests/RTCorba/Thread_Pool/bands new file mode 100644 index 00000000000..a3f7158df97 --- /dev/null +++ b/TAO/performance-tests/RTCorba/Thread_Pool/bands @@ -0,0 +1 @@ +0 5000 5000 10000 10000 15000 15000 20000 20000 25000 25000 30000 diff --git a/TAO/performance-tests/RTCorba/Thread_Pool/client.cpp b/TAO/performance-tests/RTCorba/Thread_Pool/client.cpp index 25baf99424b..b772d329c85 100644 --- a/TAO/performance-tests/RTCorba/Thread_Pool/client.cpp +++ b/TAO/performance-tests/RTCorba/Thread_Pool/client.cpp @@ -11,6 +11,7 @@ #include "tao/RTCORBA/RTCORBA.h" #include "tao/RTCORBA/Priority_Mapping_Manager.h" #include "testC.h" +#include "tests/RTCORBA/Linear_Priority/readers.cpp" ACE_RCSID(Thread_Pool, client, "$Id$") @@ -19,6 +20,7 @@ static int shutdown_server = 0; static int do_dump_history = 0; static ACE_UINT32 gsf = 0; static const char *rates_file = "rates"; +static const char *invocation_priorities_file = "empty_file"; static CORBA::ULong continuous_workers = 0; static int done = 0; static CORBA::ULong time_for_test = 10; @@ -51,18 +53,24 @@ struct Synchronizers int parse_args (int argc, char *argv[]) { - ACE_Get_Opt get_opts (argc, argv, "hxk:r:c:w:t:p:i:m:z:"); + ACE_Get_Opt get_opts (argc, argv, "c:hi:k:m:p:r:t:w:xy:z:"); int c; while ((c = get_opts ()) != -1) switch (c) { + case 'c': + continuous_workers = + ACE_OS::atoi (get_opts.optarg); + break; + case 'h': do_dump_history = 1; break; - case 'x': - shutdown_server = 1; + case 'i': + individual_continuous_worker_stats = + ACE_OS::atoi (get_opts.optarg); break; case 'k': @@ -70,19 +78,19 @@ parse_args (int argc, char *argv[]) get_opts.optarg; break; - case 'r': - rates_file = - get_opts.optarg; + case 'm': + print_missed_invocations = + ACE_OS::atoi (get_opts.optarg); break; - case 'c': - continuous_workers = - ACE_OS::atoi (get_opts.optarg); + case 'p': + invocation_priorities_file = + get_opts.optarg; break; - case 'w': - work = - ACE_OS::atoi (get_opts.optarg); + case 'r': + rates_file = + get_opts.optarg; break; case 't': @@ -90,18 +98,17 @@ parse_args (int argc, char *argv[]) ACE_OS::atoi (get_opts.optarg); break; - case 'p': - set_priority = + case 'w': + work = ACE_OS::atoi (get_opts.optarg); break; - case 'i': - individual_continuous_worker_stats = - ACE_OS::atoi (get_opts.optarg); + case 'x': + shutdown_server = 1; break; - case 'm': - print_missed_invocations = + case 'y': + set_priority = ACE_OS::atoi (get_opts.optarg); break; @@ -114,16 +121,17 @@ parse_args (int argc, char *argv[]) default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s " + "-c <number of continuous workers> " "-h <show history> " - "-x [shutdown server] " + "-i <print stats of individual continuous workers> " "-k <ior> " + "-m <print missed invocations for paced workers> " + "-p <invocation priorities file> " "-r <rates file> " - "-c <number of continuous workers> " - "-w <work> " "-t <time for test> " - "-p <set priorities> " - "-i <print stats of individual continuous workers> " - "-m <print missed invocations for paced workers> " + "-w <work> " + "-x [shutdown server] " + "-y <set invocation priorities> " "-z <timeout for max throughput measurement> " "\n", argv [0]), @@ -134,87 +142,6 @@ parse_args (int argc, char *argv[]) return 0; } -typedef ACE_Array_Base<CORBA::ULong> Rates; - -int -get_rates (const char *file_name, - Rates &rates, - CORBA::ULong &lowest_rate) -{ - // - // Read rates from a file. - // - FILE* file = - ACE_OS::fopen (file_name, "r"); - - if (file == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot open rates file %s\n", - file_name), - -1); - } - - ACE_Read_Buffer reader (file, 1); - - char *string = - reader.read (EOF, ' ', '\0'); - - // Check for empty lanes file. - if (string == 0) - { - ACE_DEBUG ((LM_DEBUG, - "\nNo rates set!\n")); - return 0; - } - - CORBA::ULong length = - reader.replaced () + 1; - - rates.size (length); - - ACE_DEBUG ((LM_DEBUG, - "\nThere are %d rates: ", - length)); - - int result = 1; - char* working_string = string; - lowest_rate = ACE_UINT32_MAX; - for (CORBA::ULong i = 0; i < length; ++i) - { - result = ::sscanf (working_string, - "%d", - &rates[i]); - if (result == 0 || result == EOF) - break; - - working_string += ACE_OS::strlen (working_string); - working_string += 1; - - if (lowest_rate > rates[i]) - lowest_rate = rates[i]; - - ACE_DEBUG ((LM_DEBUG, - "[%d] ", - rates[i])); - } - - reader.alloc ()->free (string); - - if (result == 0 || result == EOF) - { - ACE_ERROR_RETURN ((LM_ERROR, - "Parsing error in rates file %s\n", - file_name), - -1); - } - - ACE_DEBUG ((LM_DEBUG, - "\n")); - - return 0; -} - int synchronize (test_ptr test, Synchronizers &synchronizers) @@ -272,7 +199,7 @@ class Paced_Worker : public: Paced_Worker (ACE_Thread_Manager &thread_manager, test_ptr test, - CORBA::ULong rate, + CORBA::Short rate, CORBA::ULong iterations, CORBA::Short priority, RTCORBA::Current_ptr current, @@ -294,7 +221,7 @@ public: Paced_Worker::Paced_Worker (ACE_Thread_Manager &thread_manager, test_ptr test, - CORBA::ULong rate, + CORBA::Short rate, CORBA::ULong iterations, CORBA::Short priority, RTCORBA::Current_ptr current, @@ -696,16 +623,32 @@ main (int argc, char *argv[]) RTCORBA::PriorityMapping &priority_mapping = *mapping_manager->mapping (); - Rates rates; - CORBA::ULong lowest_rate = 0; + Short_Array rates; + result = + get_values ("client", + rates_file, + "rates", + rates); + if (result != 0) + return result; + Short_Array invocation_priorities; result = - get_rates (rates_file, - rates, - lowest_rate); + get_values ("client", + invocation_priorities_file, + "invocation priorities", + invocation_priorities); if (result != 0) return result; + if (invocation_priorities.size () != 0 && + invocation_priorities.size () != rates.size ()) + ACE_ERROR_RETURN ((LM_ERROR, + "Number of invocation priorities (%d) != Number of rates (%d)\n", + invocation_priorities.size (), + rates.size ()), + -1); + synchronizers.number_of_workers_ = rates.size () + continuous_workers; @@ -731,10 +674,16 @@ main (int argc, char *argv[]) i < rates.size (); ++i) { - CORBA::Short priority = - CORBA::Short ((priority_range / - double (rates.size ())) * - (i + 1)); + CORBA::Short priority = 0; + + if (invocation_priorities.size () == 0) + priority = + CORBA::Short ((priority_range / + double (rates.size ())) * + (i + 1)); + else + priority = + invocation_priorities[i]; paced_workers[i] = new Paced_Worker (paced_workers_manager, diff --git a/TAO/performance-tests/RTCorba/Thread_Pool/empty_file b/TAO/performance-tests/RTCorba/Thread_Pool/empty_file new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/TAO/performance-tests/RTCorba/Thread_Pool/empty_file diff --git a/TAO/performance-tests/RTCorba/Thread_Pool/invocation_priorities b/TAO/performance-tests/RTCorba/Thread_Pool/invocation_priorities new file mode 100644 index 00000000000..1b1f9421c50 --- /dev/null +++ b/TAO/performance-tests/RTCorba/Thread_Pool/invocation_priorities @@ -0,0 +1 @@ +1000 20000 30000
\ No newline at end of file diff --git a/TAO/performance-tests/RTCorba/Thread_Pool/lanes b/TAO/performance-tests/RTCorba/Thread_Pool/lanes new file mode 100644 index 00000000000..02162bc453f --- /dev/null +++ b/TAO/performance-tests/RTCorba/Thread_Pool/lanes @@ -0,0 +1 @@ +0 5000 10000 15000 20000 25000
\ No newline at end of file diff --git a/TAO/performance-tests/RTCorba/Thread_Pool/server.cpp b/TAO/performance-tests/RTCorba/Thread_Pool/server.cpp index 79e4d5603c3..25e16111412 100644 --- a/TAO/performance-tests/RTCorba/Thread_Pool/server.cpp +++ b/TAO/performance-tests/RTCorba/Thread_Pool/server.cpp @@ -6,6 +6,7 @@ #include "tao/debug.h" #include "tao/RTPortableServer/RTPortableServer.h" #include "testS.h" +#include "tests/RTCORBA/Linear_Priority/readers.cpp" ACE_RCSID(Thread_Pools, server, "$Id$") @@ -76,15 +77,26 @@ static CORBA::ULong static_threads = 1; static CORBA::ULong dynamic_threads = 0; static CORBA::ULong number_of_lanes = 0; +static const char *bands_file = "empty_file"; +static const char *lanes_file = "empty_file"; + int parse_args (int argc, char *argv[]) { - ACE_Get_Opt get_opts (argc, argv, "o:s:l:"); + ACE_Get_Opt get_opts (argc, argv, "b:l:o:s:n:"); int c; while ((c = get_opts ()) != -1) switch (c) { + case 'b': + bands_file = get_opts.optarg; + break; + + case 'l': + lanes_file = get_opts.optarg; + break; + case 'o': ior_output_file = get_opts.optarg; break; @@ -93,7 +105,7 @@ parse_args (int argc, char *argv[]) static_threads = ACE_OS::atoi (get_opts.optarg); break; - case 'l': + case 'n': number_of_lanes = ACE_OS::atoi (get_opts.optarg); break; @@ -101,9 +113,11 @@ parse_args (int argc, char *argv[]) default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s " - "-o <iorfile> " + "-b <bands file> " + "-l <lanes file> " + "-o <ior file> " "-s <static threads> " - "-l <lanes> " + "-n <number of lanes> " "\n", argv [0]), -1); @@ -202,75 +216,62 @@ main (int argc, char *argv[]) CORBA::ULong max_buffered_requests = 0; CORBA::ULong max_request_buffer_size = 0; - RTCORBA::ThreadpoolId threadpool_id; CORBA::PolicyList policies; + CORBA::Boolean allow_borrowing = 0; if (number_of_lanes != 0) { - CORBA::Boolean allow_borrowing = 0; - - RTCORBA::ThreadpoolLanes lanes; - lanes.length (number_of_lanes); - - RTCORBA::PriorityBands bands; - bands.length (number_of_lanes); - - CORBA::Short priority_range = - RTCORBA::maxPriority - RTCORBA::minPriority; - - ACE_DEBUG ((LM_DEBUG, - "\nUsing %d lanes\n", - number_of_lanes)); - - for (CORBA::ULong i = 0; - i < number_of_lanes; - ++i) - { - CORBA::Short high_priority = - CORBA::Short ( - ACE_OS::floor ((priority_range / - double (number_of_lanes)) * - (i + 1))); - - CORBA::Short low_priority = - CORBA::Short ( - ACE_OS::ceil ((priority_range / - double (number_of_lanes)) * - i)); - - lanes[i].lane_priority = high_priority; - lanes[i].static_threads = static_threads; - lanes[i].dynamic_threads = dynamic_threads; - - bands[i].high = high_priority; - bands[i].low = low_priority; - - ACE_DEBUG ((LM_DEBUG, - "%d: [%d %d] ", - i + 1, - low_priority, - high_priority)); - } - - ACE_DEBUG ((LM_DEBUG, - "\n\n")); - - threadpool_id = - rt_orb->create_threadpool_with_lanes (stacksize, - lanes, - allow_borrowing, - allow_request_buffering, - max_buffered_requests, - max_request_buffer_size, - ACE_TRY_ENV); + get_auto_priority_lanes_and_bands (number_of_lanes, + rt_orb.in (), + stacksize, + static_threads, + dynamic_threads, + allow_request_buffering, + max_buffered_requests, + max_request_buffer_size, + allow_borrowing, + policies, + ACE_TRY_ENV); ACE_TRY_CHECK; policies.length (policies.length () + 1); policies[policies.length () - 1] = - rt_orb->create_priority_banded_connection_policy (bands, - ACE_TRY_ENV); + rt_orb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED, + default_thread_priority, + ACE_TRY_ENV); + ACE_TRY_CHECK; + } + else if (ACE_OS::strcmp (lanes_file, "empty_file") != 0) + { + result = + get_priority_lanes ("server", + lanes_file, + rt_orb.in (), + stacksize, + static_threads, + dynamic_threads, + allow_request_buffering, + max_buffered_requests, + max_request_buffer_size, + allow_borrowing, + policies, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (result != 0) + return result; + + result = + get_priority_bands ("server", + bands_file, + rt_orb.in (), + policies, + ACE_TRY_ENV); ACE_TRY_CHECK; + if (result != 0) + return result; + policies.length (policies.length () + 1); policies[policies.length () - 1] = rt_orb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED, @@ -280,7 +281,7 @@ main (int argc, char *argv[]) } else { - threadpool_id = + RTCORBA::ThreadpoolId threadpool_id = rt_orb->create_threadpool (stacksize, static_threads, dynamic_threads, @@ -290,6 +291,12 @@ main (int argc, char *argv[]) max_request_buffer_size, ACE_TRY_ENV); ACE_TRY_CHECK; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + rt_orb->create_threadpool_policy (threadpool_id, + ACE_TRY_ENV); + ACE_TRY_CHECK; } policies.length (policies.length () + 1); @@ -299,12 +306,6 @@ main (int argc, char *argv[]) ACE_TRY_ENV); ACE_TRY_CHECK; - policies.length (policies.length () + 1); - policies[policies.length () - 1] = - rt_orb->create_threadpool_policy (threadpool_id, - ACE_TRY_ENV); - ACE_TRY_CHECK; - PortableServer::POA_var poa = root_poa->create_POA ("RT POA", poa_manager.in (), diff --git a/TAO/tests/RTCORBA/Linear_Priority/client.cpp b/TAO/tests/RTCORBA/Linear_Priority/client.cpp index 91afdc1ea2a..c55f59580c5 100644 --- a/TAO/tests/RTCORBA/Linear_Priority/client.cpp +++ b/TAO/tests/RTCORBA/Linear_Priority/client.cpp @@ -175,12 +175,12 @@ main (int argc, char **argv) ACE_TRY_ENV); ACE_TRY_CHECK; - Priorities priorities; + Short_Array priorities; result = - get_priorities ("client", - invocation_priorities_file, - "invocation priorities", - priorities); + get_values ("client", + invocation_priorities_file, + "invocation priorities", + priorities); if (result != 0) return result; diff --git a/TAO/tests/RTCORBA/Linear_Priority/readers.cpp b/TAO/tests/RTCORBA/Linear_Priority/readers.cpp index 44d8c7baeef..b4918cc2bc5 100644 --- a/TAO/tests/RTCORBA/Linear_Priority/readers.cpp +++ b/TAO/tests/RTCORBA/Linear_Priority/readers.cpp @@ -3,7 +3,7 @@ #include "ace/Read_Buffer.h" #include "ace/Array_Base.h" -typedef ACE_Array_Base<CORBA::Short> Priorities; +typedef ACE_Array_Base<CORBA::Short> Short_Array; int get_priority_bands (const char *test_type, @@ -95,10 +95,10 @@ get_priority_bands (const char *test_type, } int -get_priorities (const char *test_type, - const char *file_name, - const char *name, - Priorities &priorities) +get_values (const char *test_type, + const char *file_name, + const char *name, + Short_Array &values) { // // Read lanes from a file. @@ -127,7 +127,7 @@ get_priorities (const char *test_type, size_t length = reader.replaced () + 1; - priorities.size (length); + values.size (length); ACE_DEBUG ((LM_DEBUG, "\n%s: There are %d %s: ", @@ -141,7 +141,7 @@ get_priorities (const char *test_type, { result = ::sscanf (working_string, "%hd", - &priorities[i]); + &values[i]); if (result == 0 || result == EOF) break; @@ -150,7 +150,7 @@ get_priorities (const char *test_type, ACE_DEBUG ((LM_DEBUG, "[%d] ", - priorities[i])); + values[i])); } reader.alloc ()->free (string); @@ -178,12 +178,12 @@ get_priority_lanes (const char *test_type, CORBA::PolicyList &policies, CORBA::Environment &ACE_TRY_ENV) { - Priorities priorities; + Short_Array priorities; int result = - get_priorities (test_type, - lanes_file, - "lanes", - priorities); + get_values (test_type, + lanes_file, + "lanes", + priorities); if (result != 0 || priorities.size () == 0) return result; @@ -222,6 +222,89 @@ get_priority_lanes (const char *test_type, return 0; } +void +get_auto_priority_lanes_and_bands (CORBA::ULong number_of_lanes, + RTCORBA::RTORB_ptr rt_orb, + CORBA::ULong stacksize, + CORBA::ULong static_threads, + CORBA::ULong dynamic_threads, + CORBA::Boolean allow_request_buffering, + CORBA::ULong max_buffered_requests, + CORBA::ULong max_request_buffer_size, + CORBA::Boolean allow_borrowing, + CORBA::PolicyList &policies, + CORBA::Environment &ACE_TRY_ENV) +{ + RTCORBA::ThreadpoolLanes lanes; + lanes.length (number_of_lanes); + + RTCORBA::PriorityBands bands; + bands.length (number_of_lanes); + + CORBA::Short priority_range = + RTCORBA::maxPriority - RTCORBA::minPriority; + + ACE_DEBUG ((LM_DEBUG, + "\nUsing %d lanes\n", + number_of_lanes)); + + for (CORBA::ULong i = 0; + i < number_of_lanes; + ++i) + { + CORBA::Short high_priority = + CORBA::Short ( + ACE_OS::floor ((priority_range / + double (number_of_lanes)) * + (i + 1))); + + CORBA::Short low_priority = + CORBA::Short ( + ACE_OS::ceil ((priority_range / + double (number_of_lanes)) * + i)); + + lanes[i].lane_priority = high_priority; + lanes[i].static_threads = static_threads; + lanes[i].dynamic_threads = dynamic_threads; + + bands[i].high = high_priority; + bands[i].low = low_priority; + + ACE_DEBUG ((LM_DEBUG, + "%d: [%d %d] ", + i + 1, + low_priority, + high_priority)); + } + + ACE_DEBUG ((LM_DEBUG, + "\n\n")); + + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool_with_lanes (stacksize, + lanes, + allow_borrowing, + allow_request_buffering, + max_buffered_requests, + max_request_buffer_size, + ACE_TRY_ENV); + ACE_CHECK; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + rt_orb->create_priority_banded_connection_policy (bands, + ACE_TRY_ENV); + ACE_CHECK; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + rt_orb->create_threadpool_policy (threadpool_id, + ACE_TRY_ENV); + ACE_TRY_CHECK; + +} + #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Array_Base<CORBA::Short>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) |