// $Id$ #include "ace/Get_Opt.h" #include "ace/High_Res_Timer.h" #include "ace/Stats.h" #include "ace/Throughput_Stats.h" #include "ace/Sample_History.h" #include "ace/Read_Buffer.h" #include "ace/Array_Base.h" #include "ace/Task.h" #include "ace/OS_NS_unistd.h" #include "tao/ORB_Core.h" #include "tao/debug.h" #include "tao/RTCORBA/RTCORBA.h" #include "tao/RTCORBA/Priority_Mapping_Manager.h" #include "testC.h" #include "tests/RTCORBA/common_args.cpp" #include "tests/RTCORBA/check_supported_priorities.cpp" #include "ace/Event.h" enum Priority_Setting { AT_THREAD_CREATION = 0, AFTER_THREAD_CREATION = 1 }; static const ACE_TCHAR *ior = ACE_TEXT("file://ior"); static const ACE_TCHAR *rates_file = ACE_TEXT("rates"); static const ACE_TCHAR *invocation_priorities_file = ACE_TEXT("empty-file"); static int shutdown_server = 0; static int do_dump_history = 0; static ACE_High_Res_Timer::global_scale_factor_type gsf = 0; static CORBA::ULong continuous_workers = 0; static int done = 0; static CORBA::ULong time_for_test = 10; static CORBA::ULong work = 10; static CORBA::ULong max_throughput_timeout = 5; static CORBA::ULong continuous_worker_priority = 0; static int set_priority = 1; static Priority_Setting priority_setting = AFTER_THREAD_CREATION; static int individual_continuous_worker_stats = 0; static int print_missed_invocations = 0; static ACE_hrtime_t test_start; static CORBA::ULong prime_number = 9619; static int count_missed_end_deadlines = 0; struct Synchronizers { Synchronizers (void) : worker_lock_ (), workers_ (1), workers_ready_ (0), number_of_workers_ (0) { } TAO_SYNCH_MUTEX worker_lock_; ACE_Event workers_; CORBA::ULong workers_ready_; CORBA::ULong number_of_workers_; }; int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opts (argc, argv, "c:e:g:hi:k:m:p:q:r:t:u:v:w:x:y:z:" //client options "b:f:hl:n:o:s:" // server options ); int c; while ((c = get_opts ()) != -1) switch (c) { case 'c': continuous_workers = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'e': count_missed_end_deadlines = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'g': do_dump_history = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'i': individual_continuous_worker_stats = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'k': ior = get_opts.opt_arg (); break; case 'm': print_missed_invocations = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'p': invocation_priorities_file = get_opts.opt_arg (); break; case 'q': prime_number = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'r': rates_file = get_opts.opt_arg (); break; case 't': time_for_test = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'u': continuous_worker_priority = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'v': priority_setting = Priority_Setting (ACE_OS::atoi (get_opts.opt_arg ())); break; case 'w': work = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'x': shutdown_server = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'y': set_priority = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'z': max_throughput_timeout = ACE_OS::atoi (get_opts.opt_arg ()); break; case 'b': case 'f': case 'l': case 'n': case 'o': case 's': // server options: ignored. break; case 'h': case '?': default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s\n" "\t-c (defaults to %d)\n" "\t-e (defaults to %d)\n" "\t-g (defaults to %d)\n" "\t-h \n" "\t-i (defaults to %d)\n" "\t-k (defaults to %s)\n" "\t-m (defaults to %d)\n" "\t-p (defaults to %s)\n" "\t-q (defaults to %d)\n" "\t-r (defaults to %s)\n" "\t-t