summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/performance-tests/RTEvent/Roundtrip/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/performance-tests/RTEvent/Roundtrip/client.cpp')
-rw-r--r--TAO/orbsvcs/performance-tests/RTEvent/Roundtrip/client.cpp145
1 files changed, 38 insertions, 107 deletions
diff --git a/TAO/orbsvcs/performance-tests/RTEvent/Roundtrip/client.cpp b/TAO/orbsvcs/performance-tests/RTEvent/Roundtrip/client.cpp
index b6bf6aaf8c3..bdbd2f0774f 100644
--- a/TAO/orbsvcs/performance-tests/RTEvent/Roundtrip/client.cpp
+++ b/TAO/orbsvcs/performance-tests/RTEvent/Roundtrip/client.cpp
@@ -8,10 +8,10 @@
#include "Send_Task.h"
#include "Client_Group.h"
#include "ORB_Task.h"
-#include "Auto_Disconnect.h"
#include "ORB_Task_Activator.h"
#include "Low_Priority_Setup.h"
#include "EC_Destroyer.h"
+#include "Client_Options.h"
#include "orbsvcs/Event_Service_Constants.h"
@@ -20,8 +20,6 @@
#include "tao/RTCORBA/Priority_Mapping_Manager.h"
#include "tao/RTCORBA/Continuous_Priority_Mapping.h"
#include "tao/RTPortableServer/RTPortableServer.h"
-#include "ace/Get_Opt.h"
-#include "ace/Auto_Ptr.h"
#include "ace/High_Res_Timer.h"
#include "ace/Sample_History.h"
#include "ace/Basic_Stats.h"
@@ -30,88 +28,6 @@
ACE_RCSID(TAO_RTEC_PERF_Roundtrip, client, "$Id$")
-const char *ior = "file://test.ior";
-int iterations = 10000;
-int nthreads = 0;
-int do_dump_history = 0;
-int high_priority_period = 0;
-int high_priority_workload = 0;
-int low_priority_period = 0;
-int low_priority_workload = 0;
-int disable_low_priority = 0;
-int use_rt_corba = 0;
-
-int
-parse_args (int argc, char *argv[])
-{
- ACE_Get_Opt get_opts (argc, argv, "k:i:n:l:h:w:v:zdr");
- int c;
-
- while ((c = get_opts ()) != -1)
- switch (c)
- {
- case 'k':
- ior = get_opts.opt_arg ();
- break;
-
- case 'i':
- iterations = ACE_OS::atoi (get_opts.opt_arg ());
- break;
-
- case 'n':
- nthreads = ACE_OS::atoi (get_opts.opt_arg ());
- break;
-
- case 'h':
- high_priority_period = ACE_OS::atoi (get_opts.opt_arg ());
- break;
-
- case 'l':
- low_priority_period = ACE_OS::atoi (get_opts.opt_arg ());
- break;
-
- case 'w':
- high_priority_workload = ACE_OS::atoi (get_opts.opt_arg ());
- break;
-
- case 'v':
- low_priority_workload = ACE_OS::atoi (get_opts.opt_arg ());
- break;
-
- case 'd':
- do_dump_history = 1;
- break;
-
- case 'z':
- disable_low_priority = 1;
- break;
-
- case 'r':
- use_rt_corba = 1;
- break;
-
- case '?':
- default:
- ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s "
- "-k <IOR> "
- "-i iterations (iterations) "
- "-h high_priority_period (usecs) "
- "-l low_priority_period (usecs) "
- "-w high_priority_workload (usecs) "
- "-v low_priority_workload (usecs) "
- "-r (enable RT-CORBA) "
- "-n nthreads (low priority thread) "
- "-d (dump history) "
- "-z (disable low priority) "
- "\n",
- argv [0]),
- -1);
- }
- // Indicates sucessful parsing of the command line
- return 0;
-}
-
int main (int argc, char *argv[])
{
const CORBA::Long experiment_id = 1;
@@ -124,13 +40,29 @@ int main (int argc, char *argv[])
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
- if (parse_args (argc, argv) != 0)
- return 1;
+ Client_Options options (argc, argv);
+ if (argc != 1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Usage: %s "
+ "-i iterations (iterations) "
+ "-h high_priority_period (usecs) "
+ "-l low_priority_period (usecs) "
+ "-w high_priority_workload (usecs) "
+ "-v low_priority_workload (usecs) "
+ "-r (enable RT-CORBA) "
+ "-n nthreads (low priority thread) "
+ "-d (dump history) "
+ "-z (disable low priority) "
+ "\n",
+ argv [0]),
+ 1);
+ }
- RTServer_Setup rtserver_setup (use_rt_corba,
+ RTServer_Setup rtserver_setup (options.use_rt_corba,
orb,
rt_class,
- nthreads
+ options.nthreads
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
@@ -164,7 +96,7 @@ int main (int argc, char *argv[])
ACE_DEBUG ((LM_DEBUG, "ORB is active\n"));
CORBA::Object_var object =
- orb->string_to_object (ior ACE_ENV_ARG_PARAMETER);
+ orb->string_to_object (options.ior ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
RtecEventChannelAdmin::EventChannel_var ec =
@@ -181,9 +113,7 @@ int main (int argc, char *argv[])
ACE_DEBUG ((LM_DEBUG, "Finished EC configuration and activation\n"));
- int thread_count = 1;
- if (disable_low_priority == 0)
- thread_count += nthreads;
+ int thread_count = 1 + options.nthreads;
ACE_Barrier barrier (thread_count);
@@ -193,18 +123,22 @@ int main (int argc, char *argv[])
ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
ACE_DEBUG ((LM_DEBUG, "Done (%d)\n", gsf));
+ int per_thread_period = options.low_priority_period;
+ if (options.global_low_priority_rate)
+ per_thread_period = options.low_priority_period * options.low_priority_consumers;
+
Low_Priority_Setup<Client_Group> low_priority_setup (
- nthreads,
+ options.low_priority_consumers,
0, // no limit on the number of iterations
- 1, // each client gets its own type
+ options.unique_low_priority_event,
experiment_id,
ACE_ES_EVENT_UNDEFINED + 2,
- low_priority_workload,
+ options.low_priority_workload,
gsf,
- disable_low_priority ? 0 : 1,
+ options.nthreads,
rt_class.priority_low (),
rt_class.thr_sched_class (),
- low_priority_period,
+ per_thread_period,
supplier_poa.in (),
consumer_poa.in (),
ec.in (),
@@ -214,8 +148,8 @@ int main (int argc, char *argv[])
Client_Group high_priority_group;
high_priority_group.init (experiment_id,
ACE_ES_EVENT_UNDEFINED,
- iterations,
- high_priority_workload,
+ options.iterations,
+ options.high_priority_workload,
gsf,
supplier_poa.in (),
consumer_poa.in ());
@@ -225,8 +159,8 @@ int main (int argc, char *argv[])
Auto_Disconnect<Client_Group> high_priority_disconnect (&high_priority_group);
Send_Task high_priority_task;
- high_priority_task.init (iterations,
- high_priority_period,
+ high_priority_task.init (options.iterations,
+ options.high_priority_period,
0,
ACE_ES_EVENT_UNDEFINED,
1,
@@ -243,16 +177,13 @@ int main (int argc, char *argv[])
ACE_DEBUG ((LM_DEBUG, "(%P|%t) client - high priority task completed\n"));
- if (disable_low_priority == 0)
- {
- low_priority_setup.stop_all_threads ();
- }
+ low_priority_setup.stop_all_threads ();
ACE_DEBUG ((LM_DEBUG, "(%P|%t) client - low priority task(s) stopped\n"));
ACE_Sample_History &history =
high_priority_group.consumer ()->sample_history ();
- if (do_dump_history)
+ if (options.dump_history)
{
history.dump_samples ("HISTORY", gsf);
}