summaryrefslogtreecommitdiff
path: root/TAO/performance-tests
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-27 21:46:06 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-27 21:46:06 +0000
commit52530ddb030ff3f5e9b0b8b20ea0e15903490f51 (patch)
tree648715b7bce65d4af91ca192c77c7cf749b135af /TAO/performance-tests
parent31c04f11725e43f179e170c84d2cb3a391d071fd (diff)
downloadATCD-52530ddb030ff3f5e9b0b8b20ea0e15903490f51.tar.gz
put in RT class if running as root, and set LWP thread priorities
Diffstat (limited to 'TAO/performance-tests')
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp26
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp16
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp27
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp52
4 files changed, 119 insertions, 2 deletions
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
index 51496c88756..ba512973d01 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -225,6 +225,19 @@ Client::get_low_priority_jitter (void)
int
Client::svc (void)
{
+ // On Solaris 2.5.x, the LWP priority needs to be set. This is the
+ // ACE way to do that . . .
+ ACE_hthread_t thr_handle;
+ ACE_Thread::self (thr_handle);
+ int prio;
+
+ if (ACE_Thread::getprio (thr_handle, prio) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "getprio failed"), -1);
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t): Client::svc; set my priority to %d\n",
+ prio));
+ ACE_OS::thr_setprio (prio);
+
ACE_DEBUG ((LM_DEBUG,
"(%t) Thread created\n"));
@@ -935,6 +948,19 @@ Yield_Test::~Yield_Test()
int
Yield_Test::svc ()
{
+ // On Solaris 2.5.x, the LWP priority needs to be set. This is the
+ // ACE way to do that . . .
+ ACE_hthread_t thr_handle;
+ ACE_Thread::self (thr_handle);
+ int prio;
+
+ if (ACE_Thread::getprio (thr_handle, prio) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "getprio failed"), -1);
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t): Yield_Test::svc; set my priority to %d\n",
+ prio));
+ ACE_OS::thr_setprio (prio);
+
for (unsigned long i = 0; i < iterations_; ++i)
{
ACE_OS::thr_yield ();
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 15a1ba9e1c2..6c426a1f2c8 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
@@ -14,6 +14,19 @@ Util_Thread::Util_Thread (Task_State *ts,
int
Util_Thread::svc (void)
{
+ // On Solaris 2.5.x, the LWP priority needs to be set. This is the
+ // ACE way to do that . . .
+ ACE_hthread_t thr_handle;
+ ACE_Thread::self (thr_handle);
+ int prio;
+
+ if (ACE_Thread::getprio (thr_handle, prio) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "getprio failed"), -1);
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t): Util_Thread::svc; set my priority to %d\n",
+ prio));
+ ACE_OS::thr_setprio (prio);
+
ACE_DEBUG ((LM_DEBUG,
"(%t) Utilization Thread created, "
"waiting for threads to finish binding\n"));
@@ -30,6 +43,7 @@ Util_Thread::svc (void)
"utilization test started\n"));
this->run_computations ();
+
return 0;
}
@@ -62,6 +76,8 @@ Util_Thread::run_computations (void)
{
this->computation ();
this->number_of_computations_ ++;
+ ACE_OS::thr_yield (); // Shouldn't need this. And I'm not sure
+ // if it really helps.
}
return 0;
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
index 1d824651c78..1d92291ed00 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -14,6 +14,7 @@
// ============================================================================
#include "client.h"
+#include "ace/Sched_Params.h"
double csw = 0.0;
@@ -201,7 +202,7 @@ do_priority_inversion_test (Task_State &ts)
// hang the machine, when running on single-processor machines.
// Instead, to find the context switch time, run $ACE/performance-tests/Misc/context_switch_time
csw = context_switch_time ();
-#endif
+#endif
#if defined (VXWORKS)
ACE_OS::printf ("Test done.\n"
@@ -397,8 +398,14 @@ do_thread_per_rate_test (Task_State &ts)
// finish. After they aer done, we compute the latency and jitter
// metrics and print them.
+#if defined (VXWORKS)
+extern "C"
+int
+client (int argc, char *argv[])
+#else
int
-main (int argc, char *argv [])
+main (int argc, char *argv[])
+#endif
{
#if defined (ACE_HAS_THREADS)
#if defined (FORCE_ARGS)
@@ -411,6 +418,22 @@ main (int argc, char *argv [])
"-h",
"mv2604d"}; // Host name
#endif /* defined (FORCE_ARGS) */
+
+ // Enable FIFO scheduling, e.g., RT scheduling class on Solaris.
+ if (ACE_OS::sched_params (
+ ACE_Sched_Params (
+ ACE_SCHED_FIFO,
+ ACE_Sched_Params::priority_min (ACE_SCHED_FIFO),
+ 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);
+ }
+
initialize ();
Task_State ts (argc, argv);
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
index a1a22d9c1e2..9d6564c88b8 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -14,6 +14,7 @@
// ============================================================================
#include "server.h"
+#include "ace/Sched_Params.h"
// Global options used to configure various parameters.
static char hostname[BUFSIZ];
@@ -46,6 +47,19 @@ Cubit_Task::Cubit_Task (const char *args,
int
Cubit_Task::svc (void)
{
+ // On Solaris 2.5.x, the LWP priority needs to be set. This is the
+ // ACE way to do that . . .
+ ACE_hthread_t thr_handle;
+ ACE_Thread::self (thr_handle);
+ int prio;
+
+ if (ACE_Thread::getprio (thr_handle, prio) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "getprio failed"), -1);
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t): Cubit_Task::svc; set my priority to %d\n",
+ prio));
+ ACE_OS::thr_setprio (prio);
+
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Beginning Cubit task with args = '%s'\n",
orbargs_));
@@ -66,7 +80,9 @@ Cubit_Task::svc (void)
this->poa_manager_->activate (TAO_TRY_ENV);
TAO_CHECK_ENV;
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) Cubit_Task::svc, wait on barrier\n"));
this->barrier_->wait ();
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) Cubit_Task::svc, passed barrier\n"));
// Handle requests for this object until we're killed, or one of
// the methods asks us to exit.
@@ -402,6 +418,19 @@ Cubit_Factory_Task::create_factory (void)
int
Cubit_Factory_Task::svc (void)
{
+ // On Solaris 2.5.x, the LWP priority needs to be set. This is the
+ // ACE way to do that . . .
+ ACE_hthread_t thr_handle;
+ ACE_Thread::self (thr_handle);
+ int prio;
+
+ if (ACE_Thread::getprio (thr_handle, prio) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "getprio failed"), -1);
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t): Cubit_Factor_Task::svc; set my priority to %d\n",
+ prio));
+ ACE_OS::thr_setprio (prio);
+
ACE_DEBUG ((LM_DEBUG,
">>> (%P|%t) Beginning Cubit Factory task with args = '%s'\n",
orbargs_));
@@ -748,7 +777,9 @@ start_servants (void)
Cubit_Factory_Task * factory_task;
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) start_servants, wait on barrier\n"));
barrier_.wait ();
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) start_servants, passed barrier\n"));
cubits[0] = high_priority_task->get_servant_ior (0);
@@ -798,10 +829,31 @@ start_servants (void)
// main routine.
+#if defined (VXWORKS)
+extern "C"
+int
+server (int argc, char *argv[])
+#else
int
main (int argc, char *argv[])
+#endif
{
#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,
+ ACE_Sched_Params::priority_min (ACE_SCHED_FIFO),
+ 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);
+ }
+
if (initialize (argc, argv) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Error in Initialization\n"),