summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-13 23:18:27 +0000
committernaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-13 23:18:27 +0000
commitf1f9ae15aceddfc5c990d2bc5b7f774b3cbc34a3 (patch)
tree769efc7eba74464aca035a31eff61984ff527edc
parentc4342aa3a7316943bb5acdf32b6dd97d6b6cb9cf (diff)
downloadATCD-f1f9ae15aceddfc5c990d2bc5b7f774b3cbc34a3.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-98c9
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp26
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.h58
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp4
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp90
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp57
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Globals.cpp26
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Globals.h58
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp4
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/client.cpp90
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/server.cpp57
11 files changed, 221 insertions, 258 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 0209f36c41b..3d9ca0affb2 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,12 @@
+Sun Sep 13 18:16:46 1998 Nagarajan Surendran <naga@cs.wustl.edu>
+
+ * tests/Cubit/TAO/MT_Cubit/Globals.{h,cpp}: Converted some old
+ #ifdefed code in server.cpp and client.cpp into macros
+ for sched_params and new method for fifo scheduling initialization.
+
+ * tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp: Replaced magic numbers
+ with symbolic constants.
+
Sun Sep 13 00:44:07 1998 Sergio Flores <sergio@tango.cs.wustl.edu>
* tests/Cubit/TAO/MT_Cubit/server.cpp:
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp
index a30d36c392b..0fa47612917 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp
@@ -81,6 +81,32 @@ Globals::parse_args (int argc, char *argv[])
return 0;
}
+int
+Globals::sched_fifo_init (void)
+{
+ int result;
+#if defined (ACE_HAS_THREADS)
+ // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+ result = SCHED_PARAMS_FIFO;
+ if (result != 0)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ ACE_DEBUG ((LM_MAX,
+ "preempt: user is not superuser, "
+ "so remain in time-sharing class\n"));
+ else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%n: ACE_OS::sched_params failed\n%a"),
+ -1);
+ }
+#else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Test will not run. This platform doesn't seem to have threads.\n"),
+ -1);
+#endif /* ACE_HAS_THREADS */
+ return 0;
+}
+
MT_Priority::MT_Priority (void)
: num_priorities_ (0),
grain_ (0)
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.h b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.h
index ddd6e8b0292..3b6f18bc86d 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.h
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.h
@@ -40,6 +40,58 @@ if (status != OK)\
#define VX_VME_INIT
#endif /* VXWORKS && VME_DRIVER */
+#if defined (__Lynx__)
+#define SCHED_PRIORITY 30
+#elif defined (VXWORKS)
+#define SCHED_PRIORITY 6
+#elif defined (ACE_WIN32)
+#define SCHED_PRIORITY \
+ACE_Sched_Params::priority_max(ACE_SCHED_INFO,ACE_SCOPE_THREAD)
+#else
+#define SCHED_PRIORITY \
+ACE_THR_PRI_FIFO_DEF + 25
+#endif /* ! __Lynx__ */
+
+// Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+#define SCHED_PARAMS_FIFO \
+ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,\
+ SCHED_PRIORITY,\
+ ACE_SCOPE_PROCESS))
+
+#if defined (CHORUS)
+#define PCCTIMER_INIT \
+{\
+int pTime;\
+// Initialize the PCC timer chip
+pccTimerInit ();\
+if (pccTimer (PCC2_TIMER1_START, &pTime) != K_OK)\
+ACE_DEBUG ((LM_DEBUG,"pccTimer has a pending benchmark\n"));\
+}
+#else /* !CHORUS */
+#define PCCTIMER_INIT
+#endif /* !CHORUS */
+
+#if defined (VXWORKS) && defined (FORCE_ARGS)
+static char *force_argv[]=
+{
+ "server",
+ "-s",
+ "-f",
+ "ior.txt"
+};
+#endif /* defined (VXWORKS) && defined (FORCE_ARGS) */
+
+#if defined (VXWORKS) && defined (FORCE_ARGS)
+#define FORCE_ARGV(argc,argv) \
+argc = 4;
+argv = force_argv;
+#else /* !VXWORKS && !FORCE_ARGS */
+#define FORCE_ARGV(argc,argv)
+#endif
+// Number of utilisation computations to compute the duration of one
+// util computation.
+#define NUM_UTIL_COMPUTATIONS 10000
+
#define THREAD_PER_RATE_OBJS 4
// Number of cubit objects in the thread per rate test.
@@ -52,6 +104,10 @@ if (status != OK)\
#define TASKNAME_LEN 14
// Length of the task name in the task control block for vxworks.
+#define UTIL_BOUND_CONSTANT 1000
+// A constant to avoid the utility thread blocking the machine and to
+// bound its number of computations.
+
class Globals
{
// = TITLE
@@ -66,6 +122,8 @@ public:
int parse_args (int argc, char **argv);
// parse the arguments.
+ static int sched_fifo_init (void);
+ // enables fifo scheduling eg.RT scheduling class on solaris.
char hostname[BUFSIZ];
// hostname to be used for ORB_init.
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
index cf107db0914..815d01d152a 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
@@ -82,9 +82,7 @@ Util_Thread::run_computations (void)
{
// Bound the number of computations, since we can potentially
// block the machine if this thread never leaves the loop.
- if (this->number_of_computations_ > (ts_->loop_count_ * 1000))
- // @@ Naga, can you please remove this magic number and replace
- // it with a symbolic constant?
+ if (this->number_of_computations_ > (ts_->loop_count_ * UTIL_BOUND_CONSTANT))
{
ACE_DEBUG ((LM_DEBUG,
"\t(%t) utilization test breaking loop so machine won't block.\n"));
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
index 9b84bb72219..924619ba2d0 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -11,13 +11,6 @@
ACE_RCSID(MT_Cubit, client, "$Id$")
-#if defined (FORCE_ARGS)
-char *force_argv[] = {"client",
- "-s",
- "-f",
- "ior.txt"};
-#endif /* FORCE_ARGS */
-
#if defined (VXWORKS)
u_int ctx = 0;
u_int ct = 0;
@@ -91,48 +84,15 @@ Client_i::~Client_i (void)
int
Client_i::init (int argc, char *argv[])
{
-#if defined (ACE_HAS_THREADS)
- // @@ Naga, can you please abstract this stuff out into the
- // Global.{h,cpp} class since I think it's rather messy?
-
- // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
- if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,
-#if defined (__Lynx__)
- 30,
-#elif defined (VXWORKS) /* ! __Lynx__ */
- 6,
-#elif defined (ACE_WIN32)
- ACE_Sched_Params::priority_max
- (ACE_SCHED_FIFO, ACE_SCOPE_THREAD),
-#else
- ACE_THR_PRI_FIFO_DEF + 25,
-#endif /* ! __Lynx__ */
- ACE_SCOPE_PROCESS)) != 0)
- {
- if (ACE_OS::last_error () == EPERM)
- ACE_DEBUG ((LM_MAX,
- "preempt: user is not superuser, "
- "so remain in time-sharing class\n"));
- else
- ACE_ERROR_RETURN ((LM_ERROR,
- "%n: ACE_OS::sched_params failed\n%a"),
- -1);
- }
-#else
- ACE_ERROR_RETURN ((LM_ERROR,
- "Test will not run. This platform doesn't seem to have threads.\n"),
- -1);
-#endif /* ACE_HAS_THREADS */
-
this->argc_ = argc;
this->argv_ = argv;
+ int result;
+ result = GLOBALS::instance ()->sched_fifo_init ();
+ if (result != 0)
+ return result;
VX_VME_INIT;
-
-#if defined (VXWORKS) && defined (FORCE_ARGS)
- this->argc_ = 4;
- this->argv_ = force_argv;
-#endif /* VXWORKS && FORCE_ARGS */
+ FORCE_ARGV (this->argc_,this->argv_);
// Make sure we've got plenty of socket handles. This call will use
// the default maximum.
ACE::set_handle_limit ();
@@ -154,20 +114,7 @@ Client_i::init (int argc, char *argv[])
this->ts_->thread_count_ =
ACE_OS::atoi (this->argv_[i+1]);
}
-#if defined (CHORUS)
- // @@ Naga, can you please abstract this out into a macro or
- // something in Global.h, like you did for the VxWorks VME driver?
- // start the pccTimer for Chorus ClassiX.
- int pTime;
-
- // Initialize the PCC timer Chip
- pccTimerInit ();
-
- if (pccTimer (PCC2_TIMER1_START,
- &pTime) != K_OK)
- ACE_DEBUG ((LM_DEBUG,
- "pccTimer has a pending benchmark\n"));
-#endif /* CHORUS */
+ PCCTIMER_INIT;
return 0;
}
@@ -330,14 +277,12 @@ Client_i::calc_util_time (void)
this->util_task_duration_ = timer.get_elapsed ();
#else
for (u_int i = 0;
- // @@ Naga, can you please "abstract" out this magic number and
- // replace it with a symbolic constant?
- i < 10000;
+ i < NUM_UTIL_COMPUTATIONS;
i++)
this->util_thread_->computation ();
timer.stop ();
- this->util_task_duration_ = timer.get_elapsed () / 10000;
+ this->util_task_duration_ = timer.get_elapsed () / NUM_UTIL_COMPUTATIONS;
#endif /* !CHORUS */
}
@@ -677,11 +622,11 @@ Client_i::start_servant (void)
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ready_mon, GLOBALS::instance ()->ready_mtx_,-1));
- // @@ Naga, can you please add a comment documenting what's going
- // on here?
+ // Wait on the condition variable till the high priority cubit_task
+ // has finished argument processing.
while (!GLOBALS::instance ()->ready_)
GLOBALS::instance ()->ready_cnd_.wait ();
-
+ // wait on the barrier till the servant writes its ior.
GLOBALS::instance ()->barrier_->wait ();
this->ts_->one_ior_ =
@@ -787,17 +732,8 @@ Client_i::do_thread_per_rate_test (void)
this->ts_,
CB_1HZ_CONSUMER);
ACE_Sched_Priority priority;
-
- // @@ Naga, shouldn't this be abstracted into the Globals.* file?
-#if defined (VXWORKS)
- priority = ACE_THR_PRI_FIFO_DEF;
-#elif defined (ACE_WIN32)
- priority = ACE_Sched_Params::priority_max (ACE_SCHED_FIFO,
- ACE_SCOPE_THREAD);
-#else /* ! VXWORKS */
- priority = ACE_THR_PRI_FIFO_DEF + 25;
-#endif /* ! ACE_WIN32 */
-
+
+ priority = this->priority_.get_high_priority ();
ACE_DEBUG ((LM_DEBUG,
"Creating 20 Hz client with priority %d\n",
priority));
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
index d6783888e96..15262958073 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -25,16 +25,6 @@
ACE_RCSID(MT_Cubit, server, "$Id$")
-#if defined (VXWORKS) && defined (FORCE_ARGS)
-char *force_argv[]=
-{
- "server",
- "-s",
- "-f",
- "ior.txt"
-};
-#endif /* defined (VXWORKS) && defined (FORCE_ARGS) */
-
Server::Server (void)
:argc_ (0),
argv_ (0),
@@ -49,52 +39,21 @@ Server::Server (void)
int
Server::init (int argc, char **argv)
{
- // @@ Naga, can't this be abstracted away into the Globals.* files?!
-#if defined (ACE_HAS_THREADS)
- // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
- if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,
-#if defined (__Lynx__)
- 30,
-#elif defined (VXWORKS) /* ! __Lynx__ */
- 6,
-#elif defined (ACE_WIN32)
- ACE_Sched_Params::priority_max
- (ACE_SCHED_FIFO, ACE_SCOPE_THREAD),
-#else
- ACE_THR_PRI_FIFO_DEF + 25,
-#endif /* ! __Lynx__ */
- ACE_SCOPE_PROCESS)) != 0)
- {
- if (ACE_OS::last_error () == EPERM)
- ACE_DEBUG ((LM_MAX,
- "preempt: user is not superuser, "
- "so remain in time-sharing class\n"));
- else
- ACE_ERROR_RETURN ((LM_ERROR,
- "%n: ACE_OS::sched_params failed\n%a"),
- -1);
- }
-#else
- ACE_ERROR_RETURN ((LM_ERROR,
- "Test will not run. This platform doesn't seem to have threads.\n"),
- -1);
-#endif /* ACE_HAS_THREADS */
+ int result;
+
+ result = GLOBALS::instance ()->sched_fifo_init ();
+ if (result != 0)
+ return result;
this->argc_ = argc;
this->argv_ = argv;
VX_VME_INIT;
-
-#if defined (VXWORKS) && defined (FORCE_ARGS)
- this->argc_ = 4;
- this->argv_ = force_argv;
-#endif /* VXWORKS && FORCE_ARGS */
-
+ FORCE_ARGV (this->argc_,this->argv_);
// Make sure we've got plenty of socket handles. This call will use
// the default maximum.
- ACE::set_handle_limit ();
-
- return 0;
+ ACE::set_handle_limit ();
+ return 0;
}
int
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Globals.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Globals.cpp
index a30d36c392b..0fa47612917 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Globals.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Globals.cpp
@@ -81,6 +81,32 @@ Globals::parse_args (int argc, char *argv[])
return 0;
}
+int
+Globals::sched_fifo_init (void)
+{
+ int result;
+#if defined (ACE_HAS_THREADS)
+ // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+ result = SCHED_PARAMS_FIFO;
+ if (result != 0)
+ {
+ if (ACE_OS::last_error () == EPERM)
+ ACE_DEBUG ((LM_MAX,
+ "preempt: user is not superuser, "
+ "so remain in time-sharing class\n"));
+ else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%n: ACE_OS::sched_params failed\n%a"),
+ -1);
+ }
+#else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Test will not run. This platform doesn't seem to have threads.\n"),
+ -1);
+#endif /* ACE_HAS_THREADS */
+ return 0;
+}
+
MT_Priority::MT_Priority (void)
: num_priorities_ (0),
grain_ (0)
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Globals.h b/TAO/tests/Cubit/TAO/MT_Cubit/Globals.h
index ddd6e8b0292..3b6f18bc86d 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Globals.h
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Globals.h
@@ -40,6 +40,58 @@ if (status != OK)\
#define VX_VME_INIT
#endif /* VXWORKS && VME_DRIVER */
+#if defined (__Lynx__)
+#define SCHED_PRIORITY 30
+#elif defined (VXWORKS)
+#define SCHED_PRIORITY 6
+#elif defined (ACE_WIN32)
+#define SCHED_PRIORITY \
+ACE_Sched_Params::priority_max(ACE_SCHED_INFO,ACE_SCOPE_THREAD)
+#else
+#define SCHED_PRIORITY \
+ACE_THR_PRI_FIFO_DEF + 25
+#endif /* ! __Lynx__ */
+
+// Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+#define SCHED_PARAMS_FIFO \
+ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,\
+ SCHED_PRIORITY,\
+ ACE_SCOPE_PROCESS))
+
+#if defined (CHORUS)
+#define PCCTIMER_INIT \
+{\
+int pTime;\
+// Initialize the PCC timer chip
+pccTimerInit ();\
+if (pccTimer (PCC2_TIMER1_START, &pTime) != K_OK)\
+ACE_DEBUG ((LM_DEBUG,"pccTimer has a pending benchmark\n"));\
+}
+#else /* !CHORUS */
+#define PCCTIMER_INIT
+#endif /* !CHORUS */
+
+#if defined (VXWORKS) && defined (FORCE_ARGS)
+static char *force_argv[]=
+{
+ "server",
+ "-s",
+ "-f",
+ "ior.txt"
+};
+#endif /* defined (VXWORKS) && defined (FORCE_ARGS) */
+
+#if defined (VXWORKS) && defined (FORCE_ARGS)
+#define FORCE_ARGV(argc,argv) \
+argc = 4;
+argv = force_argv;
+#else /* !VXWORKS && !FORCE_ARGS */
+#define FORCE_ARGV(argc,argv)
+#endif
+// Number of utilisation computations to compute the duration of one
+// util computation.
+#define NUM_UTIL_COMPUTATIONS 10000
+
#define THREAD_PER_RATE_OBJS 4
// Number of cubit objects in the thread per rate test.
@@ -52,6 +104,10 @@ if (status != OK)\
#define TASKNAME_LEN 14
// Length of the task name in the task control block for vxworks.
+#define UTIL_BOUND_CONSTANT 1000
+// A constant to avoid the utility thread blocking the machine and to
+// bound its number of computations.
+
class Globals
{
// = TITLE
@@ -66,6 +122,8 @@ public:
int parse_args (int argc, char **argv);
// parse the arguments.
+ static int sched_fifo_init (void);
+ // enables fifo scheduling eg.RT scheduling class on solaris.
char hostname[BUFSIZ];
// hostname to be used for ORB_init.
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
index cf107db0914..815d01d152a 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
@@ -82,9 +82,7 @@ Util_Thread::run_computations (void)
{
// Bound the number of computations, since we can potentially
// block the machine if this thread never leaves the loop.
- if (this->number_of_computations_ > (ts_->loop_count_ * 1000))
- // @@ Naga, can you please remove this magic number and replace
- // it with a symbolic constant?
+ if (this->number_of_computations_ > (ts_->loop_count_ * UTIL_BOUND_CONSTANT))
{
ACE_DEBUG ((LM_DEBUG,
"\t(%t) utilization test breaking loop so machine won't block.\n"));
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
index 9b84bb72219..924619ba2d0 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -11,13 +11,6 @@
ACE_RCSID(MT_Cubit, client, "$Id$")
-#if defined (FORCE_ARGS)
-char *force_argv[] = {"client",
- "-s",
- "-f",
- "ior.txt"};
-#endif /* FORCE_ARGS */
-
#if defined (VXWORKS)
u_int ctx = 0;
u_int ct = 0;
@@ -91,48 +84,15 @@ Client_i::~Client_i (void)
int
Client_i::init (int argc, char *argv[])
{
-#if defined (ACE_HAS_THREADS)
- // @@ Naga, can you please abstract this stuff out into the
- // Global.{h,cpp} class since I think it's rather messy?
-
- // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
- if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,
-#if defined (__Lynx__)
- 30,
-#elif defined (VXWORKS) /* ! __Lynx__ */
- 6,
-#elif defined (ACE_WIN32)
- ACE_Sched_Params::priority_max
- (ACE_SCHED_FIFO, ACE_SCOPE_THREAD),
-#else
- ACE_THR_PRI_FIFO_DEF + 25,
-#endif /* ! __Lynx__ */
- ACE_SCOPE_PROCESS)) != 0)
- {
- if (ACE_OS::last_error () == EPERM)
- ACE_DEBUG ((LM_MAX,
- "preempt: user is not superuser, "
- "so remain in time-sharing class\n"));
- else
- ACE_ERROR_RETURN ((LM_ERROR,
- "%n: ACE_OS::sched_params failed\n%a"),
- -1);
- }
-#else
- ACE_ERROR_RETURN ((LM_ERROR,
- "Test will not run. This platform doesn't seem to have threads.\n"),
- -1);
-#endif /* ACE_HAS_THREADS */
-
this->argc_ = argc;
this->argv_ = argv;
+ int result;
+ result = GLOBALS::instance ()->sched_fifo_init ();
+ if (result != 0)
+ return result;
VX_VME_INIT;
-
-#if defined (VXWORKS) && defined (FORCE_ARGS)
- this->argc_ = 4;
- this->argv_ = force_argv;
-#endif /* VXWORKS && FORCE_ARGS */
+ FORCE_ARGV (this->argc_,this->argv_);
// Make sure we've got plenty of socket handles. This call will use
// the default maximum.
ACE::set_handle_limit ();
@@ -154,20 +114,7 @@ Client_i::init (int argc, char *argv[])
this->ts_->thread_count_ =
ACE_OS::atoi (this->argv_[i+1]);
}
-#if defined (CHORUS)
- // @@ Naga, can you please abstract this out into a macro or
- // something in Global.h, like you did for the VxWorks VME driver?
- // start the pccTimer for Chorus ClassiX.
- int pTime;
-
- // Initialize the PCC timer Chip
- pccTimerInit ();
-
- if (pccTimer (PCC2_TIMER1_START,
- &pTime) != K_OK)
- ACE_DEBUG ((LM_DEBUG,
- "pccTimer has a pending benchmark\n"));
-#endif /* CHORUS */
+ PCCTIMER_INIT;
return 0;
}
@@ -330,14 +277,12 @@ Client_i::calc_util_time (void)
this->util_task_duration_ = timer.get_elapsed ();
#else
for (u_int i = 0;
- // @@ Naga, can you please "abstract" out this magic number and
- // replace it with a symbolic constant?
- i < 10000;
+ i < NUM_UTIL_COMPUTATIONS;
i++)
this->util_thread_->computation ();
timer.stop ();
- this->util_task_duration_ = timer.get_elapsed () / 10000;
+ this->util_task_duration_ = timer.get_elapsed () / NUM_UTIL_COMPUTATIONS;
#endif /* !CHORUS */
}
@@ -677,11 +622,11 @@ Client_i::start_servant (void)
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ready_mon, GLOBALS::instance ()->ready_mtx_,-1));
- // @@ Naga, can you please add a comment documenting what's going
- // on here?
+ // Wait on the condition variable till the high priority cubit_task
+ // has finished argument processing.
while (!GLOBALS::instance ()->ready_)
GLOBALS::instance ()->ready_cnd_.wait ();
-
+ // wait on the barrier till the servant writes its ior.
GLOBALS::instance ()->barrier_->wait ();
this->ts_->one_ior_ =
@@ -787,17 +732,8 @@ Client_i::do_thread_per_rate_test (void)
this->ts_,
CB_1HZ_CONSUMER);
ACE_Sched_Priority priority;
-
- // @@ Naga, shouldn't this be abstracted into the Globals.* file?
-#if defined (VXWORKS)
- priority = ACE_THR_PRI_FIFO_DEF;
-#elif defined (ACE_WIN32)
- priority = ACE_Sched_Params::priority_max (ACE_SCHED_FIFO,
- ACE_SCOPE_THREAD);
-#else /* ! VXWORKS */
- priority = ACE_THR_PRI_FIFO_DEF + 25;
-#endif /* ! ACE_WIN32 */
-
+
+ priority = this->priority_.get_high_priority ();
ACE_DEBUG ((LM_DEBUG,
"Creating 20 Hz client with priority %d\n",
priority));
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
index d6783888e96..15262958073 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -25,16 +25,6 @@
ACE_RCSID(MT_Cubit, server, "$Id$")
-#if defined (VXWORKS) && defined (FORCE_ARGS)
-char *force_argv[]=
-{
- "server",
- "-s",
- "-f",
- "ior.txt"
-};
-#endif /* defined (VXWORKS) && defined (FORCE_ARGS) */
-
Server::Server (void)
:argc_ (0),
argv_ (0),
@@ -49,52 +39,21 @@ Server::Server (void)
int
Server::init (int argc, char **argv)
{
- // @@ Naga, can't this be abstracted away into the Globals.* files?!
-#if defined (ACE_HAS_THREADS)
- // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
- if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO,
-#if defined (__Lynx__)
- 30,
-#elif defined (VXWORKS) /* ! __Lynx__ */
- 6,
-#elif defined (ACE_WIN32)
- ACE_Sched_Params::priority_max
- (ACE_SCHED_FIFO, ACE_SCOPE_THREAD),
-#else
- ACE_THR_PRI_FIFO_DEF + 25,
-#endif /* ! __Lynx__ */
- ACE_SCOPE_PROCESS)) != 0)
- {
- if (ACE_OS::last_error () == EPERM)
- ACE_DEBUG ((LM_MAX,
- "preempt: user is not superuser, "
- "so remain in time-sharing class\n"));
- else
- ACE_ERROR_RETURN ((LM_ERROR,
- "%n: ACE_OS::sched_params failed\n%a"),
- -1);
- }
-#else
- ACE_ERROR_RETURN ((LM_ERROR,
- "Test will not run. This platform doesn't seem to have threads.\n"),
- -1);
-#endif /* ACE_HAS_THREADS */
+ int result;
+
+ result = GLOBALS::instance ()->sched_fifo_init ();
+ if (result != 0)
+ return result;
this->argc_ = argc;
this->argv_ = argv;
VX_VME_INIT;
-
-#if defined (VXWORKS) && defined (FORCE_ARGS)
- this->argc_ = 4;
- this->argv_ = force_argv;
-#endif /* VXWORKS && FORCE_ARGS */
-
+ FORCE_ARGV (this->argc_,this->argv_);
// Make sure we've got plenty of socket handles. This call will use
// the default maximum.
- ACE::set_handle_limit ();
-
- return 0;
+ ACE::set_handle_limit ();
+ return 0;
}
int