summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-08-27 02:45:17 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-08-27 02:45:17 +0000
commitc3265705871848a1fc6ccee57b2f2a5bcf2718e4 (patch)
tree93bf4f61fb36d560a0275b8c64e24177b6449f42
parentae45d29dd1e817e1a60628d26213611bf777d712 (diff)
downloadATCD-c3265705871848a1fc6ccee57b2f2a5bcf2718e4.tar.gz
*** empty log message ***
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Cubit_Task.cpp18
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp19
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.h11
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/README5
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp200
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp21
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp248
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/cubit_i.cpp3
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp73
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/server.h5
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Cubit_Task.cpp18
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Globals.cpp19
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Globals.h11
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/README5
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp200
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp21
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/client.cpp248
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/cubit_i.cpp3
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/server.cpp73
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/server.h5
20 files changed, 696 insertions, 510 deletions
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Cubit_Task.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Cubit_Task.cpp
index 9d0b80dbb3f..fca3502a447 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Cubit_Task.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Cubit_Task.cpp
@@ -103,28 +103,22 @@ Cubit_Task::initialize_orb (void)
int argc = args.argc ();
char **argv = args.argv ();
- // /*DONE*/@@ Naga, can you please try to use the TAO_Object_Manager for
- // /*DONE*/all of this initialization, rather than doing it all by hand?
-
if (this->orb_manager_.init_child_poa (argc,
argv,
"persistent_poa",
TAO_TRY_ENV) == -1)
return -1;
-
this->orb_ = this->orb_manager_.orb ();
// Do the argument parsing.
if (this->task_id_ == 0)
{
- // ACE_DEBUG ((LM_DEBUG,"parsing the arguments\n"));
if (GLOBALS::instance ()->parse_args (argc,
- argv) < 0)
+ argv) == -1)
return -1;
ACE_NEW_RETURN (GLOBALS::instance ()->barrier_,
ACE_Barrier (GLOBALS::instance ()->num_of_objs + 1),
-1);
- // ACE_DEBUG ((LM_DEBUG,"(%t)Arguments parsed successfully\n"));
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ready_mon, GLOBALS::instance ()->ready_mtx_, 1));
GLOBALS::instance ()->ready_ = 1;
GLOBALS::instance ()->ready_cnd_.broadcast ();
@@ -137,6 +131,8 @@ Cubit_Task::initialize_orb (void)
if (GLOBALS::instance ()->use_name_service == 0)
return 0;
+ // @@ Naga, if this code is no longer needed can we please
+ // remove it?
/*
CORBA::Object_var naming_obj =
this->orb_->resolve_initial_references ("NameService");
@@ -156,10 +152,10 @@ Cubit_Task::initialize_orb (void)
return -1;
*/
- // Initialize the naming services
- // Init should be able to be passed the command line arguments,
- // but it isn't possible here, so use dummy values
- if (my_name_client_.init (orb_.in (), 0, 0) != 0)
+ // Initialize the naming services. Init should be able to be
+ // passed the command line arguments, but it isn't possible
+ // here, so use dummy values.
+ if (my_name_client_.init (orb_.in ()) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Unable to initialize "
"the TAO_Naming_Client. \n"),
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp
index 5cdb7a51770..fc222558965 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp
@@ -9,7 +9,7 @@
// Globals.cpp
//
// = AUTHOR
-// Nagarajan Surendran
+// Nagarajan Surendran <naga@cs.wustl.edu>
//
// ============================================================================
@@ -27,7 +27,9 @@ Globals::Globals (void)
barrier_ (0)
{
if (ACE_OS::hostname (hostname, BUFSIZ) != 0)
- ACE_OS::perror ("gethostname");
+ ACE_DEBUG ((LM_DEBUG,
+ "%p\n",
+ "gethostname"));
}
int
@@ -52,28 +54,26 @@ Globals::parse_args (int argc, char *argv[])
thread_per_rate = 1;
break;
case 's':
- // ACE_DEBUG ((LM_DEBUG,"Not using naming service\n"));
use_name_service = 0;
break;
case 'f':
- // ior_file = opts.optarg;
ACE_NEW_RETURN (ior_file,
char[BUFSIZ],-1);
ACE_OS::strcpy (ior_file,
opts.optarg);
- // ACE_DEBUG ((LM_DEBUG,"Using file %s",ior_file));
break;
case 'h':
ACE_OS::strcpy (hostname, opts.optarg);
- // ACE_DEBUG ((LM_DEBUG, "h\n"));
break;
case 'p':
base_port = ACE_OS::atoi (opts.optarg);
- ACE_DEBUG ((LM_DEBUG, "base_port:%d\n",base_port));
+ // @@ Naga, do we need to keep this printout here or can we
+ // remove it?
+ ACE_DEBUG ((LM_DEBUG,
+ "base_port:%d\n",base_port));
break;
case 't':
num_of_objs = ACE_OS::atoi (opts.optarg);
- // ACE_DEBUG ((LM_DEBUG,"num_of_objs:%d\n",num_of_objs));
break;
case '?':
default:
@@ -89,10 +89,11 @@ Globals::parse_args (int argc, char *argv[])
-1);
}
}
+
if (thread_per_rate == 1)
num_of_objs = 4;
- // Indicates successful parsing of command line
+ // Indicates successful parsing of command line.
return 0;
}
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.h b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.h
index 97492534791..3eb4b57589a 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.h
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Globals.h
@@ -2,6 +2,7 @@
#if !defined (GLOBALS_H)
#define GLOBALS_H
+
// ============================================================================
//
// = LIBRARY
@@ -11,7 +12,7 @@
// Globals.h
//
// = AUTHOR
-// Nagarajan Surendran
+// Nagarajan Surendran <naga@cs.wustl.edu>
//
// ============================================================================
@@ -31,8 +32,15 @@ public:
class Globals
{
+ // = TITLE
+ // // @@ Naga, can you please fill in here?
+ // = DESCRIPTION
+ // // @@ Naga, can you please fill in here?
public:
Globals (void);
+
+ // @@ Naga, can you please make sure these fields/methods are
+ // commented briefly?
int parse_args (int argc,char **argv);
char hostname[BUFSIZ];
char *ior_file;
@@ -41,6 +49,7 @@ public:
u_int use_name_service;
u_int thread_per_rate;
u_int use_multiple_priority;
+
int ready_;
// ready flag used by the high priority thread to wake up the low
// priority threads after it's parsed the arguments.
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/README b/TAO/performance-tests/Cubit/TAO/MT_Cubit/README
index 456e3693b1c..f83530d862c 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/README
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/README
@@ -11,12 +11,10 @@ Makefile is provided. Use make to compile.
You can either run the server in the background in the same window as
the client or open a separate window for the client and server.
-
OPTIONS
-------
Options are case sensitive, e.g., "-U" has a different meaning than "-u".
-
(1) server:
./server [-p <port_num>] // starting port
@@ -75,8 +73,6 @@ Options are case sensitive, e.g., "-U" has a different meaning than "-u".
The server will print the IOR of the servants, but it is not required
by the client.
-
-
(2) client:
./client [<ORB OPTIONS>] // ORB options, e.g., "-ORBobjrefstyle url"
@@ -180,7 +176,6 @@ by the client.
Default Value: Disabled. Will use one priority for all low priority clients.
-
Running on VxWorks
------------------
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 d1bec282bdf..0b77330b965 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -86,20 +86,24 @@ Task_State::parse_args (int argc,char **argv)
switch (datatype)
{
case CB_OCTET:
- ACE_DEBUG ((LM_DEBUG, "Testing Octets\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "Testing Octets\n"));
datatype_ = CB_OCTET;
break;
case CB_LONG:
- ACE_DEBUG ((LM_DEBUG, "Testing Longs\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "Testing Longs\n"));
datatype_ = CB_LONG;
break;
case CB_STRUCT:
- ACE_DEBUG ((LM_DEBUG, "Testing Structs\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "Testing Structs\n"));
datatype_ = CB_STRUCT;
break;
case CB_SHORT:
default:
- ACE_DEBUG ((LM_DEBUG, "Testing Shorts\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "Testing Shorts\n"));
datatype_ = CB_SHORT;
break;
}
@@ -148,15 +152,16 @@ Task_State::parse_args (int argc,char **argv)
FILE *ior_file = ACE_OS::fopen (ior_file_, "r");
if (ior_file == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR, "Task_State::parse_args; "
- "unable to open IOR file \"%s\"\n",
- ior_file_), -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Task_State::parse_args; "
+ "unable to open IOR file \"%s\"\n",
+ ior_file_),
+ -1);
while (ACE_OS::fgets (buf, BUFSIZ, ior_file) != 0 && i < thread_count_)
{
- ACE_DEBUG ((LM_DEBUG,buf));
+ ACE_DEBUG ((LM_DEBUG,
+ buf));
j = ACE_OS::strlen (buf);
buf[j - 1] = 0; // this is to delete the "\n" that was read from the file.
iors_[i] = ACE_OS::strdup (buf);
@@ -176,24 +181,18 @@ Task_State::parse_args (int argc,char **argv)
// If we are to use the utilization test, include it in the
// barrier count. See description of this variable in header
// file.
- {
- ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_ + 2),
- -1);
- }
+ ACE_NEW_RETURN (barrier_,
+ ACE_Barrier (thread_count_ + 2),
+ -1);
else
- {
- ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_ + 1),
- -1);
- }
+ ACE_NEW_RETURN (barrier_,
+ ACE_Barrier (thread_count_ + 1),
+ -1);
}
else
- {
- ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_),
- -1);
- }
+ ACE_NEW_RETURN (barrier_,
+ ACE_Barrier (thread_count_),
+ -1);
ACE_NEW_RETURN (semaphore_,
ACE_Thread_Semaphore (0),
@@ -210,16 +209,16 @@ Task_State::parse_args (int argc,char **argv)
return 0;
}
-
Task_State::~Task_State (void)
{
int i;
if (this->ior_file_ != 0)
+ // @@ Naga, should this be delete [] this->ior_file?!
delete this->ior_file_;
- // Delete the strduped memory
- for (i=0;i<this->iors_count_; i++)
+ // Delete the strduped memory.
+ for (i = 0; i < this->iors_count_; i++)
ACE_OS::free (this->iors_ [i]);
// Delete the barrier
@@ -231,7 +230,9 @@ Task_State::~Task_State (void)
delete [] this->count_;
}
-Client::Client (ACE_Thread_Manager *thread_manager, Task_State *ts, u_int id)
+Client::Client (ACE_Thread_Manager *thread_manager,
+ Task_State *ts,
+ u_int id)
: ACE_MT (ACE_Task<ACE_MT_SYNCH> (thread_manager)),
ts_ (ts),
id_ (id)
@@ -250,6 +251,9 @@ Client::put_latency (double *jitter,
ts_->global_jitter_array_[thread_id] = jitter;
ts_->count_[thread_id] = count;
+ // @@ Naga, can you please try to factor out all of the
+ // ACE_LACKS_FLOATING_POINT into a helper class to clean up all of
+ // this code?!
#if defined (ACE_LACKS_FLOATING_POINT)
ACE_DEBUG ((LM_DEBUG,
"(%t) My latency was %u msec\n",
@@ -312,7 +316,10 @@ Client::get_high_priority_jitter (void)
// Return the square root of the sum of the differences computed
// above, i.e. jitter.
- ACE_OS::fprintf (stderr, "high priority jitter:\n");
+ // @@ Naga, can you please replace the fprintf (stderr, ...) calls
+ // with ACE_DEBUG(()) calls throughout this file?
+ ACE_OS::fprintf (stderr,
+ "high priority jitter:\n");
stats.print_summary (3, 1000, stderr);
return sqrt (jitter / (number_of_samples - 1));
@@ -348,7 +355,8 @@ Client::get_low_priority_jitter (void)
}
}
- ACE_OS::fprintf (stderr, "low priority jitter:\n");
+ ACE_OS::fprintf (stderr,
+ "low priority jitter:\n");
stats.print_summary (3, 1000, stderr);
// Return the square root of the sum of the differences computed
@@ -378,7 +386,8 @@ Client::get_jitter (u_int id)
stats.sample ((ACE_UINT32) (ts_->global_jitter_array_ [id][i] * 1000 + 0.5));
}
- ACE_OS::fprintf (stderr, "jitter for thread id %d:\n", id);
+ ACE_OS::fprintf (stderr,
+ "jitter for thread id %d:\n", id);
stats.print_summary (3, 1000, stderr);
// Return the square root of the sum of the differences computed
@@ -433,24 +442,36 @@ Client::svc (void)
env.print_exception ("ORB_init()\n");
return -1;
}
-ACE_DEBUG ((LM_DEBUG, "in svc() ts_->one_ior_ = \"%s\"\n", ts_->one_ior_));
+ ACE_DEBUG ((LM_DEBUG,
+ "in svc() ts_->one_ior_ = \"%s\"\n",
+ ts_->one_ior_));
if (this->id_ == 0)
{
- ACE_DEBUG ((LM_DEBUG,"parsing the arguments\n"));
- int result;
- result = this->ts_->parse_args (argc,argv);
-ACE_DEBUG ((LM_DEBUG, "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n", ts_->one_ior_));
+ ACE_DEBUG ((LM_DEBUG,
+ "parsing the arguments\n"));
+ int result = this->ts_->parse_args (argc,argv);
+
+ ACE_DEBUG ((LM_DEBUG,
+
+ "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n",
+ ts_->one_ior_));
+
if (result < 0)
return -1;
- ACE_DEBUG ((LM_DEBUG,"(%t)Arguments parsed successfully\n"));
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t)Arguments parsed successfully\n"));
+
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ready_mon, this->ts_->ready_mtx_, 1));
this->ts_->ready_ = 1;
this->ts_->ready_cnd_.broadcast ();
ready_mon.release ();
}
- ACE_DEBUG ((LM_DEBUG,"(%t) ORB_init success\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) ORB_init success\n"));
+
if (ts_->use_name_service_ != 0)
{
// Initialize the naming services
@@ -465,7 +486,8 @@ ACE_DEBUG ((LM_DEBUG, "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n",
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ts_->lock_, -1));
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Out of ACE_MT\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Out of ACE_MT\n"));
if (ts_->thread_per_rate_ == 0)
{
if (this->id_ == 0)
@@ -519,12 +541,14 @@ ACE_DEBUG ((LM_DEBUG, "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n",
this->id_));
break;
default:
- ACE_DEBUG ((LM_DEBUG, "(%t) Invalid Thread ID!!!!\n", this->id_));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Invalid Thread ID!!!!\n",
+ this->id_));
}
TAO_TRY
{
- // if the naming service was resolved successsfully ...
+ // If the naming service was resolved successsfully ...
if (!CORBA::is_nil (this->my_name_client_.get_context ()))
{
ACE_DEBUG ((LM_DEBUG,
@@ -534,7 +558,8 @@ ACE_DEBUG ((LM_DEBUG, "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n",
// Construct the key for the name service lookup.
CosNaming::Name mt_cubit_context_name (1);
mt_cubit_context_name.length (1);
- mt_cubit_context_name[0].id = CORBA::string_dup ("MT_Cubit");
+ mt_cubit_context_name[0].id =
+ CORBA::string_dup ("MT_Cubit");
objref =
this->my_name_client_->resolve (mt_cubit_context_name,
@@ -582,13 +607,20 @@ ACE_DEBUG ((LM_DEBUG, "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n",
}
}
-ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", ts_->one_ior_, this->id_, naming_success));
+ ACE_DEBUG ((LM_DEBUG,
+ "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n",
+ ts_->one_ior_,
+ this->id_,
+ naming_success));
if (naming_success == CORBA::B_FALSE)
{
- char *my_ior = ts_->use_utilization_test_ == 1? ts_->one_ior_ : ts_->iors_[this->id_];
+ char *my_ior =
+ ts_->use_utilization_test_ == 1
+ ? ts_->one_ior_
+ : ts_->iors_[this->id_];
- // if we are running the "1 to n" test make sure all low
+ // If we are running the "1 to n" test make sure all low
// priority clients use only 1 low priority servant.
if (this->id_ > 0 && ts_->one_to_n_test_ == 1)
my_ior = ts_->iors_[1];
@@ -599,8 +631,10 @@ ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", t
" naming service, or ior filename\n"),
-1);
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) my ior is:%s\n",my_ior));
- // if we are running the "1 to n" test make sure all low
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) my ior is:%s\n",
+ my_ior));
+ // If we are running the "1 to n" test make sure all low
// priority clients use only 1 low priority servant.
if (this->id_ > 0 && ts_->one_to_n_test_ == 1)
my_ior = ts_->iors_[1];
@@ -613,7 +647,8 @@ ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", t
objref = orb->string_to_object (my_ior,
TAO_TRY_ENV);
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) String_to_object success\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) String_to_object success\n"));
TAO_CHECK_ENV;
}
@@ -628,7 +663,8 @@ ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", t
TAO_TRY_ENV);
TAO_CHECK_ENV;
- ACE_DEBUG ((LM_DEBUG,"(%t) _narrow done\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) _narrow done\n"));
if (CORBA::is_nil (cb))
ACE_ERROR_RETURN ((LM_ERROR,
@@ -675,7 +711,8 @@ ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", t
ts_->datatype_,
frequency);
- if (ts_->thread_per_rate_ == 1 && this->id_ == (ts_->thread_count_ - 1) )
+ if (ts_->thread_per_rate_ == 1
+ && this->id_ == ts_->thread_count_ - 1)
ts_->semaphore_->release (ts_->thread_count_ - 1);
else
ts_->semaphore_->release ();
@@ -697,7 +734,6 @@ ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", t
}
// Delete dynamic memory
-
CORBA::release (cb);
return 0;
@@ -710,6 +746,8 @@ Client::run_tests (Cubit_ptr cb,
Cubit_Datatypes datatype,
double frequency)
{
+ // @@ Naga, this function is WAY too long! Can you please try to
+ // split it up?!
Cubit_i cb_impl;
CORBA::Environment env;
u_int i = 0;
@@ -719,14 +757,18 @@ Client::run_tests (Cubit_ptr cb,
double *my_jitter_array;
if (id_ == 0 && ts_->thread_count_ > 1)
+
+ // @@ Naga, can you please generalize this magic number?
ACE_NEW_RETURN (my_jitter_array,
- double [(loop_count/ts_->granularity_)*30], // magic number, for now.
+ double [(loop_count/ts_->granularity_) * 30],
-1);
else
ACE_NEW_RETURN (my_jitter_array,
- double [loop_count/ts_->granularity_*15],
+ double [loop_count/ts_->granularity_ * 15],
-1);
+ // @@ Naga, can you please replace this CHORUS stuff with the
+ // ACE_timer_t stuff throughout the file?!
#if defined (CHORUS)
long latency = 0;
long sleep_time = (1 / frequency) * ACE_ONE_SECOND_IN_USECS * ts_->granularity_; // usec
@@ -735,9 +777,9 @@ Client::run_tests (Cubit_ptr cb,
double latency = 0;
double sleep_time = (1 / frequency) * ACE_ONE_SECOND_IN_USECS * ts_->granularity_; // usec
double delta = 0;
-#endif
+#endif /* CHORUS */
- // time to wait for utilization tests to know when to stop.
+ // Time to wait for utilization tests to know when to stop.
ACE_Time_Value max_wait_time (ts_->util_time_, 0);
ACE_Countdown_Time countdown (&max_wait_time);
@@ -747,7 +789,7 @@ Client::run_tests (Cubit_ptr cb,
long real_time = 0;
#else /* CHORUS */
double real_time = 0.0;
-#endif
+#endif /* CHORUS */
ACE_High_Res_Timer timer_;
@@ -759,7 +801,9 @@ Client::run_tests (Cubit_ptr cb,
// Make the calls in a loop.
- ACE_DEBUG((LM_DEBUG,"(%P|%t)loop_count:%d",loop_count));
+ ACE_DEBUG((LM_DEBUG,
+ "(%P|%t)loop_count:%d",
+ loop_count));
for (i = 0;
// keep running for loop count, OR
i < loop_count ||
@@ -772,16 +816,15 @@ Client::run_tests (Cubit_ptr cb,
i++)
{
// start timing a call
- if ( (i % ts_->granularity_) == 0 &&
- (ts_->use_utilization_test_ == 0)
- )
+ if ((i % ts_->granularity_) == 0 &&
+ ts_->use_utilization_test_ == 0)
{
- // delay a sufficient amount of time to be able to enforce
+ // Delay a sufficient amount of time to be able to enforce
// the calling frequency (i.e., 20Hz, 10Hz, 5Hz, 1Hz).
ACE_Time_Value tv (0,
- (u_long) ((sleep_time - delta) < 0
+ (u_long) (sleep_time - delta < 0
? 0
- : (sleep_time - delta)));
+ : sleep_time - delta));
ACE_OS::sleep (tv);
#if defined (CHORUS)
pstartTime = pccTime1Get();
@@ -796,19 +839,17 @@ Client::run_tests (Cubit_ptr cb,
{
case CB_OCTET:
{
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Cubing Octet\n"));
// Cube an octet.
CORBA::Octet arg_octet = func (i), ret_octet = 0;
#if defined (NO_ACE_QUANTIFY)
- /* start recording quantify data from here */
+ // start recording quantify data from here.
quantify_start_recording_data ();
#endif /* NO_ACE_QUANTIFY */
if (ts_->remote_invocations_ == 1)
ret_octet = cb->cube_octet (arg_octet, env);
else
ret_octet = cb_impl.cube_octet (arg_octet, env);
-
#if defined (NO_ACE_QUANTIFY)
quantify_stop_recording_data();
#endif /* NO_ACE_QUANTIFY */
@@ -821,8 +862,6 @@ Client::run_tests (Cubit_ptr cb,
env.exception ()),
2);
}
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Cube_Octed call success\n"));
-
arg_octet = arg_octet * arg_octet * arg_octet;
if (arg_octet != ret_octet)
@@ -843,6 +882,11 @@ Client::run_tests (Cubit_ptr cb,
CORBA::Short arg_short = func (i), ret_short;
+ // @@ Naga, can you please do two things:
+ // 1. Move this quantify stuff into a macro so that it
+ // doesn't clutter the code everywhere?
+ // 2. Reconsider why this macro is named NO_ACE_QUANTIFY?
+ // It doesn't seem to make much sense!
#if defined (NO_ACE_QUANTIFY)
// start recording quantify data from here.
quantify_start_recording_data ();
@@ -885,7 +929,7 @@ Client::run_tests (Cubit_ptr cb,
CORBA::Long ret_long;
#if defined (NO_ACE_QUANTIFY)
- /* start recording quantify data from here */
+ // start recording quantify data from here.
quantify_start_recording_data ();
#endif /* NO_ACE_QUANTIFY */
@@ -985,20 +1029,19 @@ Client::run_tests (Cubit_ptr cb,
}
}
- // stop the timer
- if ( (i % ts_->granularity_) == (ts_->granularity_ - 1) &&
- (ts_->use_utilization_test_ == 0)
- )
+ // Stop the timer.
+ if ( (i % ts_->granularity_) == ts_->granularity_ - 1 &&
+ ts_->use_utilization_test_ == 0)
{
#if defined (CHORUS)
- pstopTime = pccTime1Get();
+ pstopTime = pccTime1Get ();
#else /* CHORUS */
// if CHORUS is not defined just use plain timer_.stop ().
timer_.stop ();
timer_.elapsed_time (delta_t);
#endif /* !CHORUS */
- // Calculate time elapsed
+ // Calculate time elapsed.
#if defined (ACE_LACKS_FLOATING_POINT)
# if defined (CHORUS)
real_time = (pstopTime - pstartTime) / ts_->granularity_;
@@ -1088,11 +1131,10 @@ Client::run_tests (Cubit_ptr cb,
(double) delta_t.usec () / (double) ACE_ONE_SECOND_IN_USECS);
}
- // perform latency stats onlt if we are not running the utilization
+ // Perform latency stats only if we are not running the utilization
// tests.
if (call_count > 0 &&
- (ts_->use_utilization_test_ == 0)
- )
+ ts_->use_utilization_test_ == 0)
{
if (error_count == 0)
{
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 f7de864742b..5f7e7cecd48 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
@@ -25,13 +25,13 @@ Util_Thread::svc (void)
ACE_DEBUG ((LM_DEBUG,
"(%t) Utilization Thread created with priority %d, "
- "waiting for threads to finish binding\n", prio));
+ "waiting for threads to finish binding\n",
+ prio));
- // this barrier synchronizes the utilization thread with
- // the client threads
- // i.e., the Util_thread should wait until all the
- // clients have finished binding, and only then
- // start measuring the utilization.
+ // This barrier synchronizes the utilization thread with the client
+ // threads i.e., the Util_thread should wait until all the clients
+ // have finished binding, and only then start measuring the
+ // utilization.
this->ts_->barrier_->wait ();
ACE_DEBUG ((LM_DEBUG,
@@ -57,9 +57,9 @@ Util_Thread::get_number_of_computations (void)
return this->number_of_computations_;
}
-// computation performed by the Utilization thread. We need this in a
+// Computation performed by the Utilization thread. We need this in a
// separate function to get it's execution time.
-//inline
+
void
Util_Thread::computation (void)
{
@@ -77,13 +77,14 @@ Util_Thread::computation (void)
// Perform repeated prime factor computations on an arbitrary number.
// And you thought your life was boring... :-)
+
int
Util_Thread::run_computations (void)
{
while (this->done_ == 0)
{
- // bound the number of computations, since we can potentially
- // block the machine if this thread never leaves the loop.
+ // 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)) // magic number
{
ACE_DEBUG ((LM_DEBUG,
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
index bee9036d42c..851124c8f5f 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -28,27 +28,32 @@ ACE_RCSID(MT_Cubit, client, "$Id$")
u_int ctx = 0;
u_int ct = 0;
-typedef struct {
+typedef struct
+{
char name[15];
WIND_TCB *tcb;
- INSTR * pc;
+ INSTR *pc;
} task_info;
+// @@ Naga, does this really need to be a #define? Can it be a const
+// int instead?!
#define SWITCHES 25000
task_info tInfo[SWITCHES];
extern "C"
int
-switchHook ( WIND_TCB *pOldTcb, /* pointer to old task's WIND_TCB */
- WIND_TCB *pNewTcb ) /* pointer to new task's WIND_TCB */
+switchHook ( WIND_TCB *pOldTcb, // pointer to old task's WIND_TCB.
+ WIND_TCB *pNewTcb ) // pointer to new task's WIND_TCB.
{
// We create the client threads with names starting with "@".
- if ( pNewTcb->name[0] == '@')
+ if (pNewTcb->name[0] == '@')
ctx++;
if (ct < SWITCHES)
{
- strncpy (tInfo[ct].name, pNewTcb->name, 14);
+ ACE_OS::strncpy (tInfo[ct].name,
+ pNewTcb->name,
+ 14); // @@ Naga, can you please fix this "magic number" 14?!
tInfo[ct].tcb = pNewTcb;
tInfo[ct].pc = pNewTcb->regs.pc;
ct++;
@@ -62,18 +67,21 @@ int
initialize (void)
{
#if defined (VXWORKS) && defined (VME_DRIVER)
+ // @@ Naga, can you please factor these initialization functions
+ // into a separate function somehow?
STATUS status = vmeDrv ();
if (status != OK)
- printf ("ERROR on call to vmeDrv()\n");
+ ACE_DEBUG ((LM_DEBUG,
+ "ERROR on call to vmeDrv()\n"));
status = vmeDevCreate ("/vme");
if (status != OK)
- printf ("ERROR on call to vmeDevCreate()\n");
+ ACE_DEBUG ((LM_DEBUG,
+ "ERROR on call to vmeDevCreate()\n"));
#endif /* VXWORKS && VME_DRIVER */
- // Make sure we've got plenty of socket handles. This call will
- // use the default maximum.
+ // Make sure we've got plenty of socket handles. This call will use
+ // the default maximum.
ACE::set_handle_limit ();
-
return 0;
}
@@ -89,7 +97,8 @@ output_taskinfo (void)
ACE_OS::fprintf(stderr,
"--->Output file for taskinfo data is \"taskinfo.txt\"\n");
- // This loop visits each client. thread_count_ is the number of clients.
+ // This loop visits each client. thread_count_ is the number of
+ // clients.
for (u_int j = 0; j < SWITCHES; j ++)
{
ACE_OS::fprintf(file_handle,
@@ -120,15 +129,18 @@ output_latency (Task_State *ts)
latency_file_handle = ACE_OS::fopen (latency_file, "w");
- // This loop visits each client. thread_count_ is the number of clients.
+ // This loop visits each client. thread_count_ is the number of
+ // clients.
for (u_int j = 0; j < ts->thread_count_; j ++)
{
ACE_OS::sprintf(buffer,
"%s #%d",
j==0? "High Priority": "Low Priority",
j);
- // this loop visits each request latency from a client
- for (u_int i = 0; i < (j==0? ts->high_priority_loop_count_:ts->loop_count_)/ts->granularity_; i ++)
+ // This loop visits each request latency from a client.
+ for (u_int i = 0;
+ i < (j == 0 ? ts->high_priority_loop_count_ : ts->loop_count_) / ts->granularity_;
+ i ++)
{
ACE_OS::sprintf(buffer+strlen(buffer),
#if defined (CHORUS)
@@ -148,17 +160,15 @@ output_latency (Task_State *ts)
int
start_servant (Task_State *ts, ACE_Thread_Manager &thread_manager)
{
- // ACE_ARGV tmp_args (this->argv_);
char high_thread_args[BUFSIZ];
static char hostname[BUFSIZ];
if (ACE_OS::hostname (hostname, BUFSIZ) != 0)
- {
- perror ("gethostname");
- return -1;
- }
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "hostname"),
+ -1);
ACE_OS::sprintf (high_thread_args,
"-ORBport %d "
"-ORBhost %s "
@@ -178,6 +188,9 @@ start_servant (Task_State *ts, ACE_Thread_Manager &thread_manager)
(u_int) 0), //task id 0.
-1);
+ // @@ Naga, can you please generalize this #ifdef so that it doesn't
+ // go into the code, but goes into a header file or inline function
+ // or something instead?!
#if defined (VXWORKS)
ACE_Sched_Priority priority = ACE_THR_PRI_FIFO_DEF;
#elif defined (ACE_WIN32)
@@ -197,26 +210,37 @@ start_servant (Task_State *ts, ACE_Thread_Manager &thread_manager)
0,
priority) == -1)
{
- ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n"
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) %p\n"
"\thigh_priority_task->activate failed"));
}
- ACE_DEBUG ((LM_DEBUG,"(%t) Waiting for argument parsing\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Waiting for argument parsing\n"));
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ready_mon, GLOBALS::instance ()->ready_mtx_,-1));
while (!GLOBALS::instance ()->ready_)
GLOBALS::instance ()->ready_cnd_.wait ();
- ACE_DEBUG ((LM_DEBUG,"(%t) Argument parsing waiting done\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Argument parsing waiting done\n"));
- ACE_DEBUG ((LM_DEBUG, "<< Before start_barrier.wait()\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "<< Before start_barrier.wait()\n"));
GLOBALS::instance ()->barrier_->wait ();
- ACE_DEBUG ((LM_DEBUG, ">> After start_barrier.wait()\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ ">> After start_barrier.wait()\n"));
ts->one_ior_ = high_priority_task->get_servant_ior (0);
- ACE_DEBUG ((LM_DEBUG, "ts->one_ior_ = \"%s\"\n", ts->one_ior_));
+ ACE_DEBUG ((LM_DEBUG,
+ "ts->one_ior_ = \"%s\"\n",
+ ts->one_ior_));
return 0;
}
+// @@ Naga, can this function be either (1) made static to the file or
+// (2) moved into a class somewhere (I prefer the latter, if
+// possible). Moreover, this function is VERY long. Can you please
+// break it up somehow?
int
do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
Task_State *ts)
@@ -224,7 +248,7 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
int i;
u_int j;
- char * task_id = 0;
+ char *task_id = 0;
ACE_High_Res_Timer timer_;
ACE_Time_Value delta_t;
@@ -238,9 +262,10 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
-1);
#endif /* VXWORKS */
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) <<<<<<< starting test on %D\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) <<<<<<< starting test on %D\n"));
- // stores the total number of context switches incurred by the
+ // Stores the total number of context switches incurred by the
// program while making CORBA requests
#if defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)
u_int context_switch = 0;
@@ -255,12 +280,14 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
ACE_Thread_Manager server_thread_manager;
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) ts->argc_=%d\n", ts->argc_));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) ts->argc_=%d\n",
+ ts->argc_));
GLOBALS::instance ()->use_name_service = 0;
for (j = 0; j < ts->argc_; j++)
- if (strcmp (ts->argv_[j], "-u") == 0)
+ if (ACE_OS::strcmp (ts->argv_[j], "-u") == 0)
{
start_servant (ts, server_thread_manager);
break;
@@ -276,7 +303,7 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
Client *[ts->thread_count_],
-1);
- // hack to make sure we have something in this pointer, when
+ // Hack to make sure we have something in this pointer, when
// thread_count == 1
low_priority_client[0] = &high_priority_client;
@@ -285,9 +312,10 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
Util_Thread util_thread (ts, &util_thr_mgr);
- //
// Time the utilization thread' "computation" to get %IdleCPU at the end of the test.
- //
+
+ // @@ Naga, can you please clean up the following code? It's VERY
+ // complicated and needs to be refactored into a separate abstraction.
#if defined (CHORUS)
int pstartTime = 0;
int pstopTime = 0;
@@ -316,11 +344,13 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
ACE_Sched_Priority priority;
#if defined (VXWORKS)
- // set a task_id string starting with "@", so we are able to
+ // Set a task_id string starting with "@", so we are able to
// accurately count the number of context switches.
strcpy (task_id, "@High");
#endif /* VXWORKS */
+ // @@ Naga, again, this code is repeated from earlier. Can you
+ // please factor this out somehow?!
// Now activate the high priority client.
#if defined (VXWORKS)
priority = ACE_THR_PRI_FIFO_DEF;
@@ -350,11 +380,13 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
"activate failed",
priority));
- ACE_DEBUG ((LM_DEBUG,"(%t) Waiting for argument parsing\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Waiting for argument parsing\n"));
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ready_mon, ts->ready_mtx_,-1));
while (!ts->ready_)
ts->ready_cnd_.wait ();
- ACE_DEBUG ((LM_DEBUG,"(%t) Argument parsing waiting done\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Argument parsing waiting done\n"));
u_int number_of_low_priority_client = 0;
u_int number_of_priorities = 0;
@@ -363,15 +395,15 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
number_of_low_priority_client = ts->thread_count_ - 1;
- // mechanism to distribute the available priorities among the
+ // Mechanism to distribute the available priorities among the
// threads when there are not enough different priorities for all
// threads.
if (ts->use_multiple_priority_ == 1)
{
ACE_Sched_Priority_Iterator priority_iterator (ACE_SCHED_FIFO,
ACE_SCOPE_THREAD);
-
number_of_priorities = 0;
+
while (priority_iterator.more ())
{
number_of_priorities ++;
@@ -384,9 +416,7 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
// if utilization thread is present, reduce in 1 the available
// priorities.
if (ts->use_utilization_test_ == 1)
- {
- number_of_priorities --;
- }
+ number_of_priorities --;
// Drop the priority, so that the priority of clients will
// increase with increasing client number.
@@ -395,18 +425,18 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
priority,
ACE_SCOPE_THREAD);
- // if the lowest priority of the "low priority clients" is the
+ // If the lowest priority of the "low priority clients" is the
// minimum, and we are running the utilization thread, increment
// the priority, since we don't want the utlization thread and a
// "low priority thread" to have the same priority.
- if ( priority == ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
- ACE_SCOPE_THREAD) &&
- ts->use_utilization_test_ == 1)
+ if (priority == ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
+ ACE_SCOPE_THREAD)
+ && ts->use_utilization_test_ == 1)
priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
priority,
ACE_SCOPE_THREAD);
- // granularity of the assignment of the priorities. Some OSs
+ // Granularity of the assignment of the priorities. Some OSs
// have fewer levels of priorities than we have threads in our
// test, so with this mechanism we assign priorities to groups
// of threads when there are more threads than priorities.
@@ -417,12 +447,10 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
grain = 1;
}
else
- {
- // Drop the priority one level
- priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
- priority,
- ACE_SCOPE_THREAD);
- }
+ // Drop the priority one level.
+ priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
+ priority,
+ ACE_SCOPE_THREAD);
ACE_DEBUG ((LM_DEBUG,
"Creating %d clients at priority %d\n",
@@ -440,7 +468,7 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
const ACE_Time_Value delay (0L, 500000L);
ACE_OS::sleep (delay);
- // set a task_id string startiing with "@", so we are able to
+ // Set a task_id string startiing with "@", so we are able to
// accurately count the number of context switches on VXWORKS
sprintf (task_id, "@Low%u", i);
#endif /* VXWORKS */
@@ -470,22 +498,19 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
if (ts->use_multiple_priority_ == 1)
{
counter = (counter + 1) % grain;
- if ( (counter == 0) &&
- //Just so when we distribute the priorities among the
- //threads, we make sure we don't go overboard.
- ((number_of_priorities * grain) > (number_of_low_priority_client - (i - 1))) )
- {
- // Get the next higher priority.
- priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
- priority,
- ACE_SCOPE_THREAD);
- }
-
+ if (counter == 0 &&
+ // Just so when we distribute the priorities among the
+ // threads, we make sure we don't go overboard.
+ number_of_priorities * grain > number_of_low_priority_client - (i - 1))
+ // Get the next higher priority.
+ priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
+ priority,
+ ACE_SCOPE_THREAD);
}
} /* end of for () */
if (ts->use_utilization_test_ == 1)
- // activate the utilization thread only if specified. See
+ // Activate the utilization thread only if specified. See
// description of this variable in header file.
{
priority =
@@ -495,17 +520,16 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
"Creating utilization thread with priority of %d\n",
priority));
- // activate the Utilization thread. It will wait until
- // all threads have finished binding.
+ // Activate the Utilization thread. It will wait until all
+ // threads have finished binding.
util_thread.activate (THR_BOUND | ACE_SCHED_FIFO,
1,
0,
priority);
}
else
- {
- util_thread.close ();
- }
+ util_thread.close ();
+
// Wait for all the client threads to be initialized before going
// any further.
ts->barrier_->wait ();
@@ -534,27 +558,28 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
#if defined (VXWORKS)
if (ts->context_switch_test_ == 1)
{
- fprintf(stderr, "Adding the context switch hook!\n");
- taskSwitchHookAdd ((FUNCPTR)&switchHook);
+ ACE_DEBUG ((LM_DEBUG,
+ "Adding the context switch hook!\n"));
+ taskSwitchHookAdd ((FUNCPTR) &switchHook);
}
-#endif
+#endif /* VXWORKS */
// Wait for all the client threads to exit (except the utilization
// thread).
thread_manager->wait ();
- //server_thread_manager.wait ();
#if defined (NO_ACE_QUANTIFY)
quantify_stop_recording_data();
#endif /* NO_ACE_QUANTIFY */
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) >>>>>>> ending test on %D\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) >>>>>>> ending test on %D\n"));
timer_.stop ();
timer_.elapsed_time (delta_t);
if (ts->use_utilization_test_ == 1)
- // signal the utilization thread to finish with its work.. only
+ // Signal the utilization thread to finish with its work.. only
// if utilization test was specified. See description of this
// variable in header file.
{
@@ -594,10 +619,10 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
ACE_DEBUG ((LM_DEBUG,
"Context switches=%d\n",
ctx));
-#endif
+#endif /* ACE_HAS_PRUSAGE_T */
}
- // if running the utilization test, don't report latency nor jitter.
+ // If running the utilization test, don't report latency nor jitter.
if (ts->use_utilization_test_ == 0)
{
#if defined (VXWORKS)
@@ -638,13 +663,15 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
if (ts->use_utilization_test_ == 1)
{
- total_util_task_duration = util_task_duration * util_thread.get_number_of_computations ();
+ total_util_task_duration =
+ util_task_duration * util_thread.get_number_of_computations ();
total_latency = (delta_t.sec () *
ACE_ONE_SECOND_IN_MSECS +
(double)delta_t.usec () / ACE_ONE_SECOND_IN_MSECS);
- total_latency_high = total_latency - total_util_task_duration;
+ total_latency_high =
+ total_latency - total_util_task_duration;
// Calc and print the CPU percentage. I add 0.5 to round to the
// nearest integer before casting it to int.
@@ -685,10 +712,12 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
for (i = number_of_low_priority_client; i > 0; i--)
delete low_priority_client [i - 1];
- delete[] low_priority_client;
+ delete [] low_priority_client;
return 0;
}
+// @@ Naga, can you please either (1) make this a static or (2) move
+// it into a class?!
int
do_thread_per_rate_test (ACE_Thread_Manager *thread_manager,
Task_State *ts)
@@ -713,17 +742,23 @@ do_thread_per_rate_test (ACE_Thread_Manager *thread_manager,
"Creating 20 Hz client with priority %d\n",
priority));
- if (CB_20Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO, 1, 1, priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) errno = %p: activate failed\n"));
+ if (CB_20Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO,
+ 1,
+ 1,
+ priority) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) errno = %p: activate failed\n"));
// The high priority thread is parsing the arguments, so wait on the
// condition variable until it wakes us up.
- ACE_DEBUG ((LM_DEBUG,"(%t) Waiting for argument parsing\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Waiting for argument parsing\n"));
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ready_mon, ts->ready_mtx_,-1));
while (!ts->ready_)
ts->ready_cnd_.wait ();
- ACE_DEBUG ((LM_DEBUG,"(%t) Argument parsing waiting done\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Argument parsing waiting done\n"));
priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
priority,
@@ -733,8 +768,12 @@ do_thread_per_rate_test (ACE_Thread_Manager *thread_manager,
"Creating 10 Hz client with priority %d\n",
priority));
- if (CB_10Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO, 1, 1, priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) errno = %p: activate failed\n"));
+ if (CB_10Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO,
+ 1,
+ 1,
+ priority) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) errno = %p: activate failed\n"));
priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
priority,
@@ -743,8 +782,12 @@ do_thread_per_rate_test (ACE_Thread_Manager *thread_manager,
"Creating 5 Hz client with priority %d\n",
priority));
- if (CB_5Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO, 1, 1, priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) errno = %p: activate failed\n"));
+ if (CB_5Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO,
+ 1,
+ 1,
+ priority) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) errno = %p: activate failed\n"));
priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
priority,
@@ -753,8 +796,12 @@ do_thread_per_rate_test (ACE_Thread_Manager *thread_manager,
"Creating 1 Hz client with priority %d\n",
priority));
- if (CB_1Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO, 1, 1, priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) errno = %p: activate failed\n"));
+ if (CB_1Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO,
+ 1,
+ 1,
+ priority) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) errno = %p: activate failed\n"));
// Wait for all the threads to exit.
thread_manager->wait ();
@@ -801,7 +848,7 @@ client (int argc, char *argv[])
int
main (int argc, char *argv[])
{
-#endif
+#endif /* VXWORKS */
#if defined (ACE_HAS_THREADS)
#if defined (FORCE_ARGS)
@@ -890,14 +937,13 @@ ACE_DEBUG ((LM_DEBUG, "argv[1]=%s\n", argv[1]));
do_thread_per_rate_test (&client_thread_manager, &ts);
#if defined (CHORUS)
- if(pccTimer(PCC2_TIMER1_STOP,&pTime) !=K_OK)
- {
- printf("pccTimer has a pending bench mark\n");
- }
+ if (pccTimer (PCC2_TIMER1_STOP, &pTime) != K_OK)
+ ACE_DEBUG ((LM_DEBUG,
+ "pccTimer has a pending bench mark\n"));
#elif defined (VXWORKS)
- // Shoot myself. Otherwise, there's a General Protection Fault. This
- // will leak memory, but that's preferable. It looks like the problem
- // might be due to static objects in libTAO or liborbsvcs?
+ // Shoot myself. Otherwise, there's a General Protection Fault.
+ // This will leak memory, but that's preferable. It looks like the
+ // problem might be due to static objects in libTAO or liborbsvcs?
int status;
ACE_OS::thr_exit (&status);
#endif /* CHORUS */
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/cubit_i.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/cubit_i.cpp
index 69993a84bf8..d8739441abf 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/cubit_i.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/cubit_i.cpp
@@ -57,5 +57,8 @@ void Cubit_i::shutdown (CORBA::Environment &)
ACE_DEBUG ((LM_DEBUG,
"(%t) Calling TAO_ORB_Core_instance ()->orb ()->shutdown ()\n"));
+ // @@ Naga, can you please revise this so that it doesn't use
+ // TAO-specific features? Please see how Irfan fixed IDL_Cubit's
+ // shutdown () so that it wasn't TAO-specific!
TAO_ORB_Core_instance ()->orb ()->shutdown ();
}
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
index d803109c47a..52102b8532a 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -41,17 +41,21 @@ Server::initialize (int argc, char **argv)
{
this->argc_ = argc;
this->argv_ = argv;
+
#if defined (VXWORKS)
+ // @@ Naga, can you please factor this code into a separate file?!
#if defined (VME_DRIVER)
STATUS status = vmeDrv ();
if (status != OK)
- printf ("ERROR on call to vmeDrv()\n");
+ ACE_DEBUG ((LM_DEBUG,
+ "ERROR on call to vmeDrv()\n"));
status = vmeDevCreate ("/vme");
if (status != OK)
- printf ("ERROR on call to vmeDevCreate()\n");
+ ACE_DEBUG ((LM_DEBUG,
+ "ERROR on call to vmeDevCreate()\n"));
#endif /* defined (VME_DRIVER) */
#if defined (FORCE_ARGS)
@@ -75,14 +79,6 @@ Server::initialize (int argc, char **argv)
int
Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
{
- //DONE// @@ Naga, can you please explain why you need to do all of this?
- //DONE// i.e, we need some comments here! In particular, what is args1
- //DONE// being used for and how will we know that ACE_DEFAULT_ARGV_BUFSIZ
- //DONE// is an appropriate size? It seems to me that we should either (1)
- //DONE// add an accessor on ACE_ARGV to determine what this size ought to
- //DONE// be or (2) we should try to use/add a method on ACE_ARGV that
- //DONE// converts the argv back into a char * buffer or something! At any
- //DONE// rate, this code should be cleaned up and abstracted better.
int i;
for (i = 0; i < this->argc_ ; i++)
@@ -143,6 +139,9 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
0), //task id 0.
-1);
+ // @@ Naga, here's another place where we write the same code again.
+ // Please make sure that this gets factored out into a macro or an
+ // inline function!
#if defined (VXWORKS)
ACE_Sched_Priority priority = ACE_THR_PRI_FIFO_DEF;
#elif defined (ACE_WIN32)
@@ -164,17 +163,15 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
1,
0,
priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n"
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) %p\n"
"\thigh_priority_task->activate failed"));
- // ACE_DEBUG ((LM_DEBUG,"(%t) Waiting for argument parsing\n"));
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ready_mon, GLOBALS::instance ()->ready_mtx_,-1));
while (!GLOBALS::instance ()->ready_)
GLOBALS::instance ()->ready_cnd_.wait ();
- // ACE_DEBUG ((LM_DEBUG,"(%t) Argument parsing waiting done\n"));
-
// Create an array to hold pointers to the low priority tasks.
Cubit_Task **low_priority_task;
@@ -244,7 +241,9 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
{
ACE_OS::sprintf (orbport,
"-ORBport %d",
- (GLOBALS::instance ()->base_port == 0) ? (int) 0 :GLOBALS::instance ()->base_port+i);
+ GLOBALS::instance ()->base_port == 0
+ ? (int) 0
+ : GLOBALS::instance ()->base_port + i);
char *low_second_argv[] = {orbport,
orbhost,
@@ -253,7 +252,8 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
"-ORBrcvsock 32768 ",
0};
ACE_NEW_RETURN (low_argv,
- ACE_ARGV (this->argv_,low_second_argv),
+ ACE_ARGV (this->argv_,
+ low_second_argv),
-1);
ACE_NEW_RETURN (low_priority_task [i - 1],
@@ -266,10 +266,11 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
// Make the low priority task an active object.
if (low_priority_task [i - 1]->activate (THR_BOUND | ACE_SCHED_FIFO,
- 1,
- 0,
- priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n"
+ 1,
+ 0,
+ priority) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) %p\n"
"\tlow_priority_task[i]->activate"));
ACE_DEBUG ((LM_DEBUG,
"Created servant %d with priority %d\n",
@@ -286,12 +287,11 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
&&
//Just so when we distribute the priorities among the
//threads, we make sure we don't go overboard.
- (number_of_priorities * grain > number_of_low_priority_servants - (i - 1)))
+ number_of_priorities * grain > number_of_low_priority_servants - (i - 1))
// Get the next higher priority.
priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
priority,
ACE_SCOPE_THREAD);
-
}
} /* end of for() */
@@ -302,17 +302,15 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
cubits[0] = high_priority_task->get_servant_ior (0);
for (j = 0;
- j < GLOBALS::instance ()->num_of_objs-1;
+ j < GLOBALS::instance ()->num_of_objs - 1;
++j)
cubits[j + 1] = low_priority_task[j]->get_servant_ior (0);
FILE *ior_f = 0;
if (GLOBALS::instance ()->ior_file != 0)
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Opening file:%s\n",GLOBALS::instance ()->ior_file));
- ior_f = ACE_OS::fopen (GLOBALS::instance ()->ior_file, "w");
- }
+ ior_f = ACE_OS::fopen (GLOBALS::instance ()->ior_file,
+ "w");
for (j = 0;
j < GLOBALS::instance ()->num_of_objs;
@@ -320,19 +318,16 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
{
if (ior_f != 0)
{
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) ior_file is open :%s",GLOBALS::instance ()->ior_file));
ACE_OS::fprintf (ior_f, "%s\n", cubits[j]);
- ACE_OS::printf ("cubits[%d] ior = %s\n",
- j,
- cubits[j]);
+ ACE_DEBUG ((LM_DEBUG,
+ "cubits[%d] ior = %s\n",
+ j,
+ cubits[j]));
}
}
if (ior_f != 0)
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Closing ior file\n"));
- ACE_OS::fclose (ior_f);
- }
+ ACE_OS::fclose (ior_f);
}
return 0;
@@ -352,7 +347,7 @@ server (int argc, char *argv[])
int
main (int argc, char *argv[])
{
-#endif
+#endif /* VXWORKS */
// Dummy code to create the GLOBALS object in the global memory
// instead of TSS.
GLOBALS::instance ();
@@ -376,10 +371,12 @@ main (int argc, char *argv[])
ACE_SCOPE_PROCESS)) != 0)
{
if (ACE_OS::last_error () == EPERM)
- ACE_DEBUG ((LM_MAX, "preempt: user is not superuser, "
+ 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"),
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%n: ACE_OS::sched_params failed\n%a"),
-1);
}
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.h b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.h
index 31a023a58ac..b4257725c4d 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.h
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.h
@@ -125,9 +125,12 @@ private:
// objects.
};
-
class Server
{
+ // = TITLE
+ // @@ Naga, can you please fill in here?
+ // = DESCRIPTION
+ // @@ Naga, can you please fill in here?
public:
// default constructor
int initialize (int argc, char **argv);
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Cubit_Task.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Cubit_Task.cpp
index 9d0b80dbb3f..fca3502a447 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Cubit_Task.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Cubit_Task.cpp
@@ -103,28 +103,22 @@ Cubit_Task::initialize_orb (void)
int argc = args.argc ();
char **argv = args.argv ();
- // /*DONE*/@@ Naga, can you please try to use the TAO_Object_Manager for
- // /*DONE*/all of this initialization, rather than doing it all by hand?
-
if (this->orb_manager_.init_child_poa (argc,
argv,
"persistent_poa",
TAO_TRY_ENV) == -1)
return -1;
-
this->orb_ = this->orb_manager_.orb ();
// Do the argument parsing.
if (this->task_id_ == 0)
{
- // ACE_DEBUG ((LM_DEBUG,"parsing the arguments\n"));
if (GLOBALS::instance ()->parse_args (argc,
- argv) < 0)
+ argv) == -1)
return -1;
ACE_NEW_RETURN (GLOBALS::instance ()->barrier_,
ACE_Barrier (GLOBALS::instance ()->num_of_objs + 1),
-1);
- // ACE_DEBUG ((LM_DEBUG,"(%t)Arguments parsed successfully\n"));
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ready_mon, GLOBALS::instance ()->ready_mtx_, 1));
GLOBALS::instance ()->ready_ = 1;
GLOBALS::instance ()->ready_cnd_.broadcast ();
@@ -137,6 +131,8 @@ Cubit_Task::initialize_orb (void)
if (GLOBALS::instance ()->use_name_service == 0)
return 0;
+ // @@ Naga, if this code is no longer needed can we please
+ // remove it?
/*
CORBA::Object_var naming_obj =
this->orb_->resolve_initial_references ("NameService");
@@ -156,10 +152,10 @@ Cubit_Task::initialize_orb (void)
return -1;
*/
- // Initialize the naming services
- // Init should be able to be passed the command line arguments,
- // but it isn't possible here, so use dummy values
- if (my_name_client_.init (orb_.in (), 0, 0) != 0)
+ // Initialize the naming services. Init should be able to be
+ // passed the command line arguments, but it isn't possible
+ // here, so use dummy values.
+ if (my_name_client_.init (orb_.in ()) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
" (%P|%t) Unable to initialize "
"the TAO_Naming_Client. \n"),
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Globals.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Globals.cpp
index 5cdb7a51770..fc222558965 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Globals.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Globals.cpp
@@ -9,7 +9,7 @@
// Globals.cpp
//
// = AUTHOR
-// Nagarajan Surendran
+// Nagarajan Surendran <naga@cs.wustl.edu>
//
// ============================================================================
@@ -27,7 +27,9 @@ Globals::Globals (void)
barrier_ (0)
{
if (ACE_OS::hostname (hostname, BUFSIZ) != 0)
- ACE_OS::perror ("gethostname");
+ ACE_DEBUG ((LM_DEBUG,
+ "%p\n",
+ "gethostname"));
}
int
@@ -52,28 +54,26 @@ Globals::parse_args (int argc, char *argv[])
thread_per_rate = 1;
break;
case 's':
- // ACE_DEBUG ((LM_DEBUG,"Not using naming service\n"));
use_name_service = 0;
break;
case 'f':
- // ior_file = opts.optarg;
ACE_NEW_RETURN (ior_file,
char[BUFSIZ],-1);
ACE_OS::strcpy (ior_file,
opts.optarg);
- // ACE_DEBUG ((LM_DEBUG,"Using file %s",ior_file));
break;
case 'h':
ACE_OS::strcpy (hostname, opts.optarg);
- // ACE_DEBUG ((LM_DEBUG, "h\n"));
break;
case 'p':
base_port = ACE_OS::atoi (opts.optarg);
- ACE_DEBUG ((LM_DEBUG, "base_port:%d\n",base_port));
+ // @@ Naga, do we need to keep this printout here or can we
+ // remove it?
+ ACE_DEBUG ((LM_DEBUG,
+ "base_port:%d\n",base_port));
break;
case 't':
num_of_objs = ACE_OS::atoi (opts.optarg);
- // ACE_DEBUG ((LM_DEBUG,"num_of_objs:%d\n",num_of_objs));
break;
case '?':
default:
@@ -89,10 +89,11 @@ Globals::parse_args (int argc, char *argv[])
-1);
}
}
+
if (thread_per_rate == 1)
num_of_objs = 4;
- // Indicates successful parsing of command line
+ // Indicates successful parsing of command line.
return 0;
}
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Globals.h b/TAO/tests/Cubit/TAO/MT_Cubit/Globals.h
index 97492534791..3eb4b57589a 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Globals.h
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Globals.h
@@ -2,6 +2,7 @@
#if !defined (GLOBALS_H)
#define GLOBALS_H
+
// ============================================================================
//
// = LIBRARY
@@ -11,7 +12,7 @@
// Globals.h
//
// = AUTHOR
-// Nagarajan Surendran
+// Nagarajan Surendran <naga@cs.wustl.edu>
//
// ============================================================================
@@ -31,8 +32,15 @@ public:
class Globals
{
+ // = TITLE
+ // // @@ Naga, can you please fill in here?
+ // = DESCRIPTION
+ // // @@ Naga, can you please fill in here?
public:
Globals (void);
+
+ // @@ Naga, can you please make sure these fields/methods are
+ // commented briefly?
int parse_args (int argc,char **argv);
char hostname[BUFSIZ];
char *ior_file;
@@ -41,6 +49,7 @@ public:
u_int use_name_service;
u_int thread_per_rate;
u_int use_multiple_priority;
+
int ready_;
// ready flag used by the high priority thread to wake up the low
// priority threads after it's parsed the arguments.
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/README b/TAO/tests/Cubit/TAO/MT_Cubit/README
index 456e3693b1c..f83530d862c 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/README
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/README
@@ -11,12 +11,10 @@ Makefile is provided. Use make to compile.
You can either run the server in the background in the same window as
the client or open a separate window for the client and server.
-
OPTIONS
-------
Options are case sensitive, e.g., "-U" has a different meaning than "-u".
-
(1) server:
./server [-p <port_num>] // starting port
@@ -75,8 +73,6 @@ Options are case sensitive, e.g., "-U" has a different meaning than "-u".
The server will print the IOR of the servants, but it is not required
by the client.
-
-
(2) client:
./client [<ORB OPTIONS>] // ORB options, e.g., "-ORBobjrefstyle url"
@@ -180,7 +176,6 @@ by the client.
Default Value: Disabled. Will use one priority for all low priority clients.
-
Running on VxWorks
------------------
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
index d1bec282bdf..0b77330b965 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -86,20 +86,24 @@ Task_State::parse_args (int argc,char **argv)
switch (datatype)
{
case CB_OCTET:
- ACE_DEBUG ((LM_DEBUG, "Testing Octets\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "Testing Octets\n"));
datatype_ = CB_OCTET;
break;
case CB_LONG:
- ACE_DEBUG ((LM_DEBUG, "Testing Longs\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "Testing Longs\n"));
datatype_ = CB_LONG;
break;
case CB_STRUCT:
- ACE_DEBUG ((LM_DEBUG, "Testing Structs\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "Testing Structs\n"));
datatype_ = CB_STRUCT;
break;
case CB_SHORT:
default:
- ACE_DEBUG ((LM_DEBUG, "Testing Shorts\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "Testing Shorts\n"));
datatype_ = CB_SHORT;
break;
}
@@ -148,15 +152,16 @@ Task_State::parse_args (int argc,char **argv)
FILE *ior_file = ACE_OS::fopen (ior_file_, "r");
if (ior_file == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR, "Task_State::parse_args; "
- "unable to open IOR file \"%s\"\n",
- ior_file_), -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Task_State::parse_args; "
+ "unable to open IOR file \"%s\"\n",
+ ior_file_),
+ -1);
while (ACE_OS::fgets (buf, BUFSIZ, ior_file) != 0 && i < thread_count_)
{
- ACE_DEBUG ((LM_DEBUG,buf));
+ ACE_DEBUG ((LM_DEBUG,
+ buf));
j = ACE_OS::strlen (buf);
buf[j - 1] = 0; // this is to delete the "\n" that was read from the file.
iors_[i] = ACE_OS::strdup (buf);
@@ -176,24 +181,18 @@ Task_State::parse_args (int argc,char **argv)
// If we are to use the utilization test, include it in the
// barrier count. See description of this variable in header
// file.
- {
- ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_ + 2),
- -1);
- }
+ ACE_NEW_RETURN (barrier_,
+ ACE_Barrier (thread_count_ + 2),
+ -1);
else
- {
- ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_ + 1),
- -1);
- }
+ ACE_NEW_RETURN (barrier_,
+ ACE_Barrier (thread_count_ + 1),
+ -1);
}
else
- {
- ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_),
- -1);
- }
+ ACE_NEW_RETURN (barrier_,
+ ACE_Barrier (thread_count_),
+ -1);
ACE_NEW_RETURN (semaphore_,
ACE_Thread_Semaphore (0),
@@ -210,16 +209,16 @@ Task_State::parse_args (int argc,char **argv)
return 0;
}
-
Task_State::~Task_State (void)
{
int i;
if (this->ior_file_ != 0)
+ // @@ Naga, should this be delete [] this->ior_file?!
delete this->ior_file_;
- // Delete the strduped memory
- for (i=0;i<this->iors_count_; i++)
+ // Delete the strduped memory.
+ for (i = 0; i < this->iors_count_; i++)
ACE_OS::free (this->iors_ [i]);
// Delete the barrier
@@ -231,7 +230,9 @@ Task_State::~Task_State (void)
delete [] this->count_;
}
-Client::Client (ACE_Thread_Manager *thread_manager, Task_State *ts, u_int id)
+Client::Client (ACE_Thread_Manager *thread_manager,
+ Task_State *ts,
+ u_int id)
: ACE_MT (ACE_Task<ACE_MT_SYNCH> (thread_manager)),
ts_ (ts),
id_ (id)
@@ -250,6 +251,9 @@ Client::put_latency (double *jitter,
ts_->global_jitter_array_[thread_id] = jitter;
ts_->count_[thread_id] = count;
+ // @@ Naga, can you please try to factor out all of the
+ // ACE_LACKS_FLOATING_POINT into a helper class to clean up all of
+ // this code?!
#if defined (ACE_LACKS_FLOATING_POINT)
ACE_DEBUG ((LM_DEBUG,
"(%t) My latency was %u msec\n",
@@ -312,7 +316,10 @@ Client::get_high_priority_jitter (void)
// Return the square root of the sum of the differences computed
// above, i.e. jitter.
- ACE_OS::fprintf (stderr, "high priority jitter:\n");
+ // @@ Naga, can you please replace the fprintf (stderr, ...) calls
+ // with ACE_DEBUG(()) calls throughout this file?
+ ACE_OS::fprintf (stderr,
+ "high priority jitter:\n");
stats.print_summary (3, 1000, stderr);
return sqrt (jitter / (number_of_samples - 1));
@@ -348,7 +355,8 @@ Client::get_low_priority_jitter (void)
}
}
- ACE_OS::fprintf (stderr, "low priority jitter:\n");
+ ACE_OS::fprintf (stderr,
+ "low priority jitter:\n");
stats.print_summary (3, 1000, stderr);
// Return the square root of the sum of the differences computed
@@ -378,7 +386,8 @@ Client::get_jitter (u_int id)
stats.sample ((ACE_UINT32) (ts_->global_jitter_array_ [id][i] * 1000 + 0.5));
}
- ACE_OS::fprintf (stderr, "jitter for thread id %d:\n", id);
+ ACE_OS::fprintf (stderr,
+ "jitter for thread id %d:\n", id);
stats.print_summary (3, 1000, stderr);
// Return the square root of the sum of the differences computed
@@ -433,24 +442,36 @@ Client::svc (void)
env.print_exception ("ORB_init()\n");
return -1;
}
-ACE_DEBUG ((LM_DEBUG, "in svc() ts_->one_ior_ = \"%s\"\n", ts_->one_ior_));
+ ACE_DEBUG ((LM_DEBUG,
+ "in svc() ts_->one_ior_ = \"%s\"\n",
+ ts_->one_ior_));
if (this->id_ == 0)
{
- ACE_DEBUG ((LM_DEBUG,"parsing the arguments\n"));
- int result;
- result = this->ts_->parse_args (argc,argv);
-ACE_DEBUG ((LM_DEBUG, "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n", ts_->one_ior_));
+ ACE_DEBUG ((LM_DEBUG,
+ "parsing the arguments\n"));
+ int result = this->ts_->parse_args (argc,argv);
+
+ ACE_DEBUG ((LM_DEBUG,
+
+ "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n",
+ ts_->one_ior_));
+
if (result < 0)
return -1;
- ACE_DEBUG ((LM_DEBUG,"(%t)Arguments parsed successfully\n"));
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t)Arguments parsed successfully\n"));
+
ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ready_mon, this->ts_->ready_mtx_, 1));
this->ts_->ready_ = 1;
this->ts_->ready_cnd_.broadcast ();
ready_mon.release ();
}
- ACE_DEBUG ((LM_DEBUG,"(%t) ORB_init success\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) ORB_init success\n"));
+
if (ts_->use_name_service_ != 0)
{
// Initialize the naming services
@@ -465,7 +486,8 @@ ACE_DEBUG ((LM_DEBUG, "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n",
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, ts_->lock_, -1));
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Out of ACE_MT\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Out of ACE_MT\n"));
if (ts_->thread_per_rate_ == 0)
{
if (this->id_ == 0)
@@ -519,12 +541,14 @@ ACE_DEBUG ((LM_DEBUG, "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n",
this->id_));
break;
default:
- ACE_DEBUG ((LM_DEBUG, "(%t) Invalid Thread ID!!!!\n", this->id_));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Invalid Thread ID!!!!\n",
+ this->id_));
}
TAO_TRY
{
- // if the naming service was resolved successsfully ...
+ // If the naming service was resolved successsfully ...
if (!CORBA::is_nil (this->my_name_client_.get_context ()))
{
ACE_DEBUG ((LM_DEBUG,
@@ -534,7 +558,8 @@ ACE_DEBUG ((LM_DEBUG, "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n",
// Construct the key for the name service lookup.
CosNaming::Name mt_cubit_context_name (1);
mt_cubit_context_name.length (1);
- mt_cubit_context_name[0].id = CORBA::string_dup ("MT_Cubit");
+ mt_cubit_context_name[0].id =
+ CORBA::string_dup ("MT_Cubit");
objref =
this->my_name_client_->resolve (mt_cubit_context_name,
@@ -582,13 +607,20 @@ ACE_DEBUG ((LM_DEBUG, "in svc(), AFTER parse_args() ts_->one_ior_ = \"%s\"\n",
}
}
-ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", ts_->one_ior_, this->id_, naming_success));
+ ACE_DEBUG ((LM_DEBUG,
+ "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n",
+ ts_->one_ior_,
+ this->id_,
+ naming_success));
if (naming_success == CORBA::B_FALSE)
{
- char *my_ior = ts_->use_utilization_test_ == 1? ts_->one_ior_ : ts_->iors_[this->id_];
+ char *my_ior =
+ ts_->use_utilization_test_ == 1
+ ? ts_->one_ior_
+ : ts_->iors_[this->id_];
- // if we are running the "1 to n" test make sure all low
+ // If we are running the "1 to n" test make sure all low
// priority clients use only 1 low priority servant.
if (this->id_ > 0 && ts_->one_to_n_test_ == 1)
my_ior = ts_->iors_[1];
@@ -599,8 +631,10 @@ ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", t
" naming service, or ior filename\n"),
-1);
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) my ior is:%s\n",my_ior));
- // if we are running the "1 to n" test make sure all low
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) my ior is:%s\n",
+ my_ior));
+ // If we are running the "1 to n" test make sure all low
// priority clients use only 1 low priority servant.
if (this->id_ > 0 && ts_->one_to_n_test_ == 1)
my_ior = ts_->iors_[1];
@@ -613,7 +647,8 @@ ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", t
objref = orb->string_to_object (my_ior,
TAO_TRY_ENV);
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) String_to_object success\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) String_to_object success\n"));
TAO_CHECK_ENV;
}
@@ -628,7 +663,8 @@ ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", t
TAO_TRY_ENV);
TAO_CHECK_ENV;
- ACE_DEBUG ((LM_DEBUG,"(%t) _narrow done\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) _narrow done\n"));
if (CORBA::is_nil (cb))
ACE_ERROR_RETURN ((LM_ERROR,
@@ -675,7 +711,8 @@ ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", t
ts_->datatype_,
frequency);
- if (ts_->thread_per_rate_ == 1 && this->id_ == (ts_->thread_count_ - 1) )
+ if (ts_->thread_per_rate_ == 1
+ && this->id_ == ts_->thread_count_ - 1)
ts_->semaphore_->release (ts_->thread_count_ - 1);
else
ts_->semaphore_->release ();
@@ -697,7 +734,6 @@ ACE_DEBUG ((LM_DEBUG, "ts_->one_ior_=%s, this->id_=%d \t naming_success=%d\n", t
}
// Delete dynamic memory
-
CORBA::release (cb);
return 0;
@@ -710,6 +746,8 @@ Client::run_tests (Cubit_ptr cb,
Cubit_Datatypes datatype,
double frequency)
{
+ // @@ Naga, this function is WAY too long! Can you please try to
+ // split it up?!
Cubit_i cb_impl;
CORBA::Environment env;
u_int i = 0;
@@ -719,14 +757,18 @@ Client::run_tests (Cubit_ptr cb,
double *my_jitter_array;
if (id_ == 0 && ts_->thread_count_ > 1)
+
+ // @@ Naga, can you please generalize this magic number?
ACE_NEW_RETURN (my_jitter_array,
- double [(loop_count/ts_->granularity_)*30], // magic number, for now.
+ double [(loop_count/ts_->granularity_) * 30],
-1);
else
ACE_NEW_RETURN (my_jitter_array,
- double [loop_count/ts_->granularity_*15],
+ double [loop_count/ts_->granularity_ * 15],
-1);
+ // @@ Naga, can you please replace this CHORUS stuff with the
+ // ACE_timer_t stuff throughout the file?!
#if defined (CHORUS)
long latency = 0;
long sleep_time = (1 / frequency) * ACE_ONE_SECOND_IN_USECS * ts_->granularity_; // usec
@@ -735,9 +777,9 @@ Client::run_tests (Cubit_ptr cb,
double latency = 0;
double sleep_time = (1 / frequency) * ACE_ONE_SECOND_IN_USECS * ts_->granularity_; // usec
double delta = 0;
-#endif
+#endif /* CHORUS */
- // time to wait for utilization tests to know when to stop.
+ // Time to wait for utilization tests to know when to stop.
ACE_Time_Value max_wait_time (ts_->util_time_, 0);
ACE_Countdown_Time countdown (&max_wait_time);
@@ -747,7 +789,7 @@ Client::run_tests (Cubit_ptr cb,
long real_time = 0;
#else /* CHORUS */
double real_time = 0.0;
-#endif
+#endif /* CHORUS */
ACE_High_Res_Timer timer_;
@@ -759,7 +801,9 @@ Client::run_tests (Cubit_ptr cb,
// Make the calls in a loop.
- ACE_DEBUG((LM_DEBUG,"(%P|%t)loop_count:%d",loop_count));
+ ACE_DEBUG((LM_DEBUG,
+ "(%P|%t)loop_count:%d",
+ loop_count));
for (i = 0;
// keep running for loop count, OR
i < loop_count ||
@@ -772,16 +816,15 @@ Client::run_tests (Cubit_ptr cb,
i++)
{
// start timing a call
- if ( (i % ts_->granularity_) == 0 &&
- (ts_->use_utilization_test_ == 0)
- )
+ if ((i % ts_->granularity_) == 0 &&
+ ts_->use_utilization_test_ == 0)
{
- // delay a sufficient amount of time to be able to enforce
+ // Delay a sufficient amount of time to be able to enforce
// the calling frequency (i.e., 20Hz, 10Hz, 5Hz, 1Hz).
ACE_Time_Value tv (0,
- (u_long) ((sleep_time - delta) < 0
+ (u_long) (sleep_time - delta < 0
? 0
- : (sleep_time - delta)));
+ : sleep_time - delta));
ACE_OS::sleep (tv);
#if defined (CHORUS)
pstartTime = pccTime1Get();
@@ -796,19 +839,17 @@ Client::run_tests (Cubit_ptr cb,
{
case CB_OCTET:
{
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Cubing Octet\n"));
// Cube an octet.
CORBA::Octet arg_octet = func (i), ret_octet = 0;
#if defined (NO_ACE_QUANTIFY)
- /* start recording quantify data from here */
+ // start recording quantify data from here.
quantify_start_recording_data ();
#endif /* NO_ACE_QUANTIFY */
if (ts_->remote_invocations_ == 1)
ret_octet = cb->cube_octet (arg_octet, env);
else
ret_octet = cb_impl.cube_octet (arg_octet, env);
-
#if defined (NO_ACE_QUANTIFY)
quantify_stop_recording_data();
#endif /* NO_ACE_QUANTIFY */
@@ -821,8 +862,6 @@ Client::run_tests (Cubit_ptr cb,
env.exception ()),
2);
}
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Cube_Octed call success\n"));
-
arg_octet = arg_octet * arg_octet * arg_octet;
if (arg_octet != ret_octet)
@@ -843,6 +882,11 @@ Client::run_tests (Cubit_ptr cb,
CORBA::Short arg_short = func (i), ret_short;
+ // @@ Naga, can you please do two things:
+ // 1. Move this quantify stuff into a macro so that it
+ // doesn't clutter the code everywhere?
+ // 2. Reconsider why this macro is named NO_ACE_QUANTIFY?
+ // It doesn't seem to make much sense!
#if defined (NO_ACE_QUANTIFY)
// start recording quantify data from here.
quantify_start_recording_data ();
@@ -885,7 +929,7 @@ Client::run_tests (Cubit_ptr cb,
CORBA::Long ret_long;
#if defined (NO_ACE_QUANTIFY)
- /* start recording quantify data from here */
+ // start recording quantify data from here.
quantify_start_recording_data ();
#endif /* NO_ACE_QUANTIFY */
@@ -985,20 +1029,19 @@ Client::run_tests (Cubit_ptr cb,
}
}
- // stop the timer
- if ( (i % ts_->granularity_) == (ts_->granularity_ - 1) &&
- (ts_->use_utilization_test_ == 0)
- )
+ // Stop the timer.
+ if ( (i % ts_->granularity_) == ts_->granularity_ - 1 &&
+ ts_->use_utilization_test_ == 0)
{
#if defined (CHORUS)
- pstopTime = pccTime1Get();
+ pstopTime = pccTime1Get ();
#else /* CHORUS */
// if CHORUS is not defined just use plain timer_.stop ().
timer_.stop ();
timer_.elapsed_time (delta_t);
#endif /* !CHORUS */
- // Calculate time elapsed
+ // Calculate time elapsed.
#if defined (ACE_LACKS_FLOATING_POINT)
# if defined (CHORUS)
real_time = (pstopTime - pstartTime) / ts_->granularity_;
@@ -1088,11 +1131,10 @@ Client::run_tests (Cubit_ptr cb,
(double) delta_t.usec () / (double) ACE_ONE_SECOND_IN_USECS);
}
- // perform latency stats onlt if we are not running the utilization
+ // Perform latency stats only if we are not running the utilization
// tests.
if (call_count > 0 &&
- (ts_->use_utilization_test_ == 0)
- )
+ ts_->use_utilization_test_ == 0)
{
if (error_count == 0)
{
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
index f7de864742b..5f7e7cecd48 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp
@@ -25,13 +25,13 @@ Util_Thread::svc (void)
ACE_DEBUG ((LM_DEBUG,
"(%t) Utilization Thread created with priority %d, "
- "waiting for threads to finish binding\n", prio));
+ "waiting for threads to finish binding\n",
+ prio));
- // this barrier synchronizes the utilization thread with
- // the client threads
- // i.e., the Util_thread should wait until all the
- // clients have finished binding, and only then
- // start measuring the utilization.
+ // This barrier synchronizes the utilization thread with the client
+ // threads i.e., the Util_thread should wait until all the clients
+ // have finished binding, and only then start measuring the
+ // utilization.
this->ts_->barrier_->wait ();
ACE_DEBUG ((LM_DEBUG,
@@ -57,9 +57,9 @@ Util_Thread::get_number_of_computations (void)
return this->number_of_computations_;
}
-// computation performed by the Utilization thread. We need this in a
+// Computation performed by the Utilization thread. We need this in a
// separate function to get it's execution time.
-//inline
+
void
Util_Thread::computation (void)
{
@@ -77,13 +77,14 @@ Util_Thread::computation (void)
// Perform repeated prime factor computations on an arbitrary number.
// And you thought your life was boring... :-)
+
int
Util_Thread::run_computations (void)
{
while (this->done_ == 0)
{
- // bound the number of computations, since we can potentially
- // block the machine if this thread never leaves the loop.
+ // 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)) // magic number
{
ACE_DEBUG ((LM_DEBUG,
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
index bee9036d42c..851124c8f5f 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -28,27 +28,32 @@ ACE_RCSID(MT_Cubit, client, "$Id$")
u_int ctx = 0;
u_int ct = 0;
-typedef struct {
+typedef struct
+{
char name[15];
WIND_TCB *tcb;
- INSTR * pc;
+ INSTR *pc;
} task_info;
+// @@ Naga, does this really need to be a #define? Can it be a const
+// int instead?!
#define SWITCHES 25000
task_info tInfo[SWITCHES];
extern "C"
int
-switchHook ( WIND_TCB *pOldTcb, /* pointer to old task's WIND_TCB */
- WIND_TCB *pNewTcb ) /* pointer to new task's WIND_TCB */
+switchHook ( WIND_TCB *pOldTcb, // pointer to old task's WIND_TCB.
+ WIND_TCB *pNewTcb ) // pointer to new task's WIND_TCB.
{
// We create the client threads with names starting with "@".
- if ( pNewTcb->name[0] == '@')
+ if (pNewTcb->name[0] == '@')
ctx++;
if (ct < SWITCHES)
{
- strncpy (tInfo[ct].name, pNewTcb->name, 14);
+ ACE_OS::strncpy (tInfo[ct].name,
+ pNewTcb->name,
+ 14); // @@ Naga, can you please fix this "magic number" 14?!
tInfo[ct].tcb = pNewTcb;
tInfo[ct].pc = pNewTcb->regs.pc;
ct++;
@@ -62,18 +67,21 @@ int
initialize (void)
{
#if defined (VXWORKS) && defined (VME_DRIVER)
+ // @@ Naga, can you please factor these initialization functions
+ // into a separate function somehow?
STATUS status = vmeDrv ();
if (status != OK)
- printf ("ERROR on call to vmeDrv()\n");
+ ACE_DEBUG ((LM_DEBUG,
+ "ERROR on call to vmeDrv()\n"));
status = vmeDevCreate ("/vme");
if (status != OK)
- printf ("ERROR on call to vmeDevCreate()\n");
+ ACE_DEBUG ((LM_DEBUG,
+ "ERROR on call to vmeDevCreate()\n"));
#endif /* VXWORKS && VME_DRIVER */
- // Make sure we've got plenty of socket handles. This call will
- // use the default maximum.
+ // Make sure we've got plenty of socket handles. This call will use
+ // the default maximum.
ACE::set_handle_limit ();
-
return 0;
}
@@ -89,7 +97,8 @@ output_taskinfo (void)
ACE_OS::fprintf(stderr,
"--->Output file for taskinfo data is \"taskinfo.txt\"\n");
- // This loop visits each client. thread_count_ is the number of clients.
+ // This loop visits each client. thread_count_ is the number of
+ // clients.
for (u_int j = 0; j < SWITCHES; j ++)
{
ACE_OS::fprintf(file_handle,
@@ -120,15 +129,18 @@ output_latency (Task_State *ts)
latency_file_handle = ACE_OS::fopen (latency_file, "w");
- // This loop visits each client. thread_count_ is the number of clients.
+ // This loop visits each client. thread_count_ is the number of
+ // clients.
for (u_int j = 0; j < ts->thread_count_; j ++)
{
ACE_OS::sprintf(buffer,
"%s #%d",
j==0? "High Priority": "Low Priority",
j);
- // this loop visits each request latency from a client
- for (u_int i = 0; i < (j==0? ts->high_priority_loop_count_:ts->loop_count_)/ts->granularity_; i ++)
+ // This loop visits each request latency from a client.
+ for (u_int i = 0;
+ i < (j == 0 ? ts->high_priority_loop_count_ : ts->loop_count_) / ts->granularity_;
+ i ++)
{
ACE_OS::sprintf(buffer+strlen(buffer),
#if defined (CHORUS)
@@ -148,17 +160,15 @@ output_latency (Task_State *ts)
int
start_servant (Task_State *ts, ACE_Thread_Manager &thread_manager)
{
- // ACE_ARGV tmp_args (this->argv_);
char high_thread_args[BUFSIZ];
static char hostname[BUFSIZ];
if (ACE_OS::hostname (hostname, BUFSIZ) != 0)
- {
- perror ("gethostname");
- return -1;
- }
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "hostname"),
+ -1);
ACE_OS::sprintf (high_thread_args,
"-ORBport %d "
"-ORBhost %s "
@@ -178,6 +188,9 @@ start_servant (Task_State *ts, ACE_Thread_Manager &thread_manager)
(u_int) 0), //task id 0.
-1);
+ // @@ Naga, can you please generalize this #ifdef so that it doesn't
+ // go into the code, but goes into a header file or inline function
+ // or something instead?!
#if defined (VXWORKS)
ACE_Sched_Priority priority = ACE_THR_PRI_FIFO_DEF;
#elif defined (ACE_WIN32)
@@ -197,26 +210,37 @@ start_servant (Task_State *ts, ACE_Thread_Manager &thread_manager)
0,
priority) == -1)
{
- ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n"
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) %p\n"
"\thigh_priority_task->activate failed"));
}
- ACE_DEBUG ((LM_DEBUG,"(%t) Waiting for argument parsing\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Waiting for argument parsing\n"));
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ready_mon, GLOBALS::instance ()->ready_mtx_,-1));
while (!GLOBALS::instance ()->ready_)
GLOBALS::instance ()->ready_cnd_.wait ();
- ACE_DEBUG ((LM_DEBUG,"(%t) Argument parsing waiting done\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Argument parsing waiting done\n"));
- ACE_DEBUG ((LM_DEBUG, "<< Before start_barrier.wait()\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "<< Before start_barrier.wait()\n"));
GLOBALS::instance ()->barrier_->wait ();
- ACE_DEBUG ((LM_DEBUG, ">> After start_barrier.wait()\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ ">> After start_barrier.wait()\n"));
ts->one_ior_ = high_priority_task->get_servant_ior (0);
- ACE_DEBUG ((LM_DEBUG, "ts->one_ior_ = \"%s\"\n", ts->one_ior_));
+ ACE_DEBUG ((LM_DEBUG,
+ "ts->one_ior_ = \"%s\"\n",
+ ts->one_ior_));
return 0;
}
+// @@ Naga, can this function be either (1) made static to the file or
+// (2) moved into a class somewhere (I prefer the latter, if
+// possible). Moreover, this function is VERY long. Can you please
+// break it up somehow?
int
do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
Task_State *ts)
@@ -224,7 +248,7 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
int i;
u_int j;
- char * task_id = 0;
+ char *task_id = 0;
ACE_High_Res_Timer timer_;
ACE_Time_Value delta_t;
@@ -238,9 +262,10 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
-1);
#endif /* VXWORKS */
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) <<<<<<< starting test on %D\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) <<<<<<< starting test on %D\n"));
- // stores the total number of context switches incurred by the
+ // Stores the total number of context switches incurred by the
// program while making CORBA requests
#if defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)
u_int context_switch = 0;
@@ -255,12 +280,14 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
ACE_Thread_Manager server_thread_manager;
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) ts->argc_=%d\n", ts->argc_));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) ts->argc_=%d\n",
+ ts->argc_));
GLOBALS::instance ()->use_name_service = 0;
for (j = 0; j < ts->argc_; j++)
- if (strcmp (ts->argv_[j], "-u") == 0)
+ if (ACE_OS::strcmp (ts->argv_[j], "-u") == 0)
{
start_servant (ts, server_thread_manager);
break;
@@ -276,7 +303,7 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
Client *[ts->thread_count_],
-1);
- // hack to make sure we have something in this pointer, when
+ // Hack to make sure we have something in this pointer, when
// thread_count == 1
low_priority_client[0] = &high_priority_client;
@@ -285,9 +312,10 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
Util_Thread util_thread (ts, &util_thr_mgr);
- //
// Time the utilization thread' "computation" to get %IdleCPU at the end of the test.
- //
+
+ // @@ Naga, can you please clean up the following code? It's VERY
+ // complicated and needs to be refactored into a separate abstraction.
#if defined (CHORUS)
int pstartTime = 0;
int pstopTime = 0;
@@ -316,11 +344,13 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
ACE_Sched_Priority priority;
#if defined (VXWORKS)
- // set a task_id string starting with "@", so we are able to
+ // Set a task_id string starting with "@", so we are able to
// accurately count the number of context switches.
strcpy (task_id, "@High");
#endif /* VXWORKS */
+ // @@ Naga, again, this code is repeated from earlier. Can you
+ // please factor this out somehow?!
// Now activate the high priority client.
#if defined (VXWORKS)
priority = ACE_THR_PRI_FIFO_DEF;
@@ -350,11 +380,13 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
"activate failed",
priority));
- ACE_DEBUG ((LM_DEBUG,"(%t) Waiting for argument parsing\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Waiting for argument parsing\n"));
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ready_mon, ts->ready_mtx_,-1));
while (!ts->ready_)
ts->ready_cnd_.wait ();
- ACE_DEBUG ((LM_DEBUG,"(%t) Argument parsing waiting done\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Argument parsing waiting done\n"));
u_int number_of_low_priority_client = 0;
u_int number_of_priorities = 0;
@@ -363,15 +395,15 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
number_of_low_priority_client = ts->thread_count_ - 1;
- // mechanism to distribute the available priorities among the
+ // Mechanism to distribute the available priorities among the
// threads when there are not enough different priorities for all
// threads.
if (ts->use_multiple_priority_ == 1)
{
ACE_Sched_Priority_Iterator priority_iterator (ACE_SCHED_FIFO,
ACE_SCOPE_THREAD);
-
number_of_priorities = 0;
+
while (priority_iterator.more ())
{
number_of_priorities ++;
@@ -384,9 +416,7 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
// if utilization thread is present, reduce in 1 the available
// priorities.
if (ts->use_utilization_test_ == 1)
- {
- number_of_priorities --;
- }
+ number_of_priorities --;
// Drop the priority, so that the priority of clients will
// increase with increasing client number.
@@ -395,18 +425,18 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
priority,
ACE_SCOPE_THREAD);
- // if the lowest priority of the "low priority clients" is the
+ // If the lowest priority of the "low priority clients" is the
// minimum, and we are running the utilization thread, increment
// the priority, since we don't want the utlization thread and a
// "low priority thread" to have the same priority.
- if ( priority == ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
- ACE_SCOPE_THREAD) &&
- ts->use_utilization_test_ == 1)
+ if (priority == ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
+ ACE_SCOPE_THREAD)
+ && ts->use_utilization_test_ == 1)
priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
priority,
ACE_SCOPE_THREAD);
- // granularity of the assignment of the priorities. Some OSs
+ // Granularity of the assignment of the priorities. Some OSs
// have fewer levels of priorities than we have threads in our
// test, so with this mechanism we assign priorities to groups
// of threads when there are more threads than priorities.
@@ -417,12 +447,10 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
grain = 1;
}
else
- {
- // Drop the priority one level
- priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
- priority,
- ACE_SCOPE_THREAD);
- }
+ // Drop the priority one level.
+ priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
+ priority,
+ ACE_SCOPE_THREAD);
ACE_DEBUG ((LM_DEBUG,
"Creating %d clients at priority %d\n",
@@ -440,7 +468,7 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
const ACE_Time_Value delay (0L, 500000L);
ACE_OS::sleep (delay);
- // set a task_id string startiing with "@", so we are able to
+ // Set a task_id string startiing with "@", so we are able to
// accurately count the number of context switches on VXWORKS
sprintf (task_id, "@Low%u", i);
#endif /* VXWORKS */
@@ -470,22 +498,19 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
if (ts->use_multiple_priority_ == 1)
{
counter = (counter + 1) % grain;
- if ( (counter == 0) &&
- //Just so when we distribute the priorities among the
- //threads, we make sure we don't go overboard.
- ((number_of_priorities * grain) > (number_of_low_priority_client - (i - 1))) )
- {
- // Get the next higher priority.
- priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
- priority,
- ACE_SCOPE_THREAD);
- }
-
+ if (counter == 0 &&
+ // Just so when we distribute the priorities among the
+ // threads, we make sure we don't go overboard.
+ number_of_priorities * grain > number_of_low_priority_client - (i - 1))
+ // Get the next higher priority.
+ priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
+ priority,
+ ACE_SCOPE_THREAD);
}
} /* end of for () */
if (ts->use_utilization_test_ == 1)
- // activate the utilization thread only if specified. See
+ // Activate the utilization thread only if specified. See
// description of this variable in header file.
{
priority =
@@ -495,17 +520,16 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
"Creating utilization thread with priority of %d\n",
priority));
- // activate the Utilization thread. It will wait until
- // all threads have finished binding.
+ // Activate the Utilization thread. It will wait until all
+ // threads have finished binding.
util_thread.activate (THR_BOUND | ACE_SCHED_FIFO,
1,
0,
priority);
}
else
- {
- util_thread.close ();
- }
+ util_thread.close ();
+
// Wait for all the client threads to be initialized before going
// any further.
ts->barrier_->wait ();
@@ -534,27 +558,28 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
#if defined (VXWORKS)
if (ts->context_switch_test_ == 1)
{
- fprintf(stderr, "Adding the context switch hook!\n");
- taskSwitchHookAdd ((FUNCPTR)&switchHook);
+ ACE_DEBUG ((LM_DEBUG,
+ "Adding the context switch hook!\n"));
+ taskSwitchHookAdd ((FUNCPTR) &switchHook);
}
-#endif
+#endif /* VXWORKS */
// Wait for all the client threads to exit (except the utilization
// thread).
thread_manager->wait ();
- //server_thread_manager.wait ();
#if defined (NO_ACE_QUANTIFY)
quantify_stop_recording_data();
#endif /* NO_ACE_QUANTIFY */
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) >>>>>>> ending test on %D\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) >>>>>>> ending test on %D\n"));
timer_.stop ();
timer_.elapsed_time (delta_t);
if (ts->use_utilization_test_ == 1)
- // signal the utilization thread to finish with its work.. only
+ // Signal the utilization thread to finish with its work.. only
// if utilization test was specified. See description of this
// variable in header file.
{
@@ -594,10 +619,10 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
ACE_DEBUG ((LM_DEBUG,
"Context switches=%d\n",
ctx));
-#endif
+#endif /* ACE_HAS_PRUSAGE_T */
}
- // if running the utilization test, don't report latency nor jitter.
+ // If running the utilization test, don't report latency nor jitter.
if (ts->use_utilization_test_ == 0)
{
#if defined (VXWORKS)
@@ -638,13 +663,15 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
if (ts->use_utilization_test_ == 1)
{
- total_util_task_duration = util_task_duration * util_thread.get_number_of_computations ();
+ total_util_task_duration =
+ util_task_duration * util_thread.get_number_of_computations ();
total_latency = (delta_t.sec () *
ACE_ONE_SECOND_IN_MSECS +
(double)delta_t.usec () / ACE_ONE_SECOND_IN_MSECS);
- total_latency_high = total_latency - total_util_task_duration;
+ total_latency_high =
+ total_latency - total_util_task_duration;
// Calc and print the CPU percentage. I add 0.5 to round to the
// nearest integer before casting it to int.
@@ -685,10 +712,12 @@ do_priority_inversion_test (ACE_Thread_Manager *thread_manager,
for (i = number_of_low_priority_client; i > 0; i--)
delete low_priority_client [i - 1];
- delete[] low_priority_client;
+ delete [] low_priority_client;
return 0;
}
+// @@ Naga, can you please either (1) make this a static or (2) move
+// it into a class?!
int
do_thread_per_rate_test (ACE_Thread_Manager *thread_manager,
Task_State *ts)
@@ -713,17 +742,23 @@ do_thread_per_rate_test (ACE_Thread_Manager *thread_manager,
"Creating 20 Hz client with priority %d\n",
priority));
- if (CB_20Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO, 1, 1, priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) errno = %p: activate failed\n"));
+ if (CB_20Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO,
+ 1,
+ 1,
+ priority) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) errno = %p: activate failed\n"));
// The high priority thread is parsing the arguments, so wait on the
// condition variable until it wakes us up.
- ACE_DEBUG ((LM_DEBUG,"(%t) Waiting for argument parsing\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Waiting for argument parsing\n"));
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ready_mon, ts->ready_mtx_,-1));
while (!ts->ready_)
ts->ready_cnd_.wait ();
- ACE_DEBUG ((LM_DEBUG,"(%t) Argument parsing waiting done\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%t) Argument parsing waiting done\n"));
priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
priority,
@@ -733,8 +768,12 @@ do_thread_per_rate_test (ACE_Thread_Manager *thread_manager,
"Creating 10 Hz client with priority %d\n",
priority));
- if (CB_10Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO, 1, 1, priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) errno = %p: activate failed\n"));
+ if (CB_10Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO,
+ 1,
+ 1,
+ priority) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) errno = %p: activate failed\n"));
priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
priority,
@@ -743,8 +782,12 @@ do_thread_per_rate_test (ACE_Thread_Manager *thread_manager,
"Creating 5 Hz client with priority %d\n",
priority));
- if (CB_5Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO, 1, 1, priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) errno = %p: activate failed\n"));
+ if (CB_5Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO,
+ 1,
+ 1,
+ priority) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) errno = %p: activate failed\n"));
priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
priority,
@@ -753,8 +796,12 @@ do_thread_per_rate_test (ACE_Thread_Manager *thread_manager,
"Creating 1 Hz client with priority %d\n",
priority));
- if (CB_1Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO, 1, 1, priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) errno = %p: activate failed\n"));
+ if (CB_1Hz_client.activate (THR_BOUND | ACE_SCHED_FIFO,
+ 1,
+ 1,
+ priority) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) errno = %p: activate failed\n"));
// Wait for all the threads to exit.
thread_manager->wait ();
@@ -801,7 +848,7 @@ client (int argc, char *argv[])
int
main (int argc, char *argv[])
{
-#endif
+#endif /* VXWORKS */
#if defined (ACE_HAS_THREADS)
#if defined (FORCE_ARGS)
@@ -890,14 +937,13 @@ ACE_DEBUG ((LM_DEBUG, "argv[1]=%s\n", argv[1]));
do_thread_per_rate_test (&client_thread_manager, &ts);
#if defined (CHORUS)
- if(pccTimer(PCC2_TIMER1_STOP,&pTime) !=K_OK)
- {
- printf("pccTimer has a pending bench mark\n");
- }
+ if (pccTimer (PCC2_TIMER1_STOP, &pTime) != K_OK)
+ ACE_DEBUG ((LM_DEBUG,
+ "pccTimer has a pending bench mark\n"));
#elif defined (VXWORKS)
- // Shoot myself. Otherwise, there's a General Protection Fault. This
- // will leak memory, but that's preferable. It looks like the problem
- // might be due to static objects in libTAO or liborbsvcs?
+ // Shoot myself. Otherwise, there's a General Protection Fault.
+ // This will leak memory, but that's preferable. It looks like the
+ // problem might be due to static objects in libTAO or liborbsvcs?
int status;
ACE_OS::thr_exit (&status);
#endif /* CHORUS */
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/cubit_i.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/cubit_i.cpp
index 69993a84bf8..d8739441abf 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/cubit_i.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/cubit_i.cpp
@@ -57,5 +57,8 @@ void Cubit_i::shutdown (CORBA::Environment &)
ACE_DEBUG ((LM_DEBUG,
"(%t) Calling TAO_ORB_Core_instance ()->orb ()->shutdown ()\n"));
+ // @@ Naga, can you please revise this so that it doesn't use
+ // TAO-specific features? Please see how Irfan fixed IDL_Cubit's
+ // shutdown () so that it wasn't TAO-specific!
TAO_ORB_Core_instance ()->orb ()->shutdown ();
}
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
index d803109c47a..52102b8532a 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -41,17 +41,21 @@ Server::initialize (int argc, char **argv)
{
this->argc_ = argc;
this->argv_ = argv;
+
#if defined (VXWORKS)
+ // @@ Naga, can you please factor this code into a separate file?!
#if defined (VME_DRIVER)
STATUS status = vmeDrv ();
if (status != OK)
- printf ("ERROR on call to vmeDrv()\n");
+ ACE_DEBUG ((LM_DEBUG,
+ "ERROR on call to vmeDrv()\n"));
status = vmeDevCreate ("/vme");
if (status != OK)
- printf ("ERROR on call to vmeDevCreate()\n");
+ ACE_DEBUG ((LM_DEBUG,
+ "ERROR on call to vmeDevCreate()\n"));
#endif /* defined (VME_DRIVER) */
#if defined (FORCE_ARGS)
@@ -75,14 +79,6 @@ Server::initialize (int argc, char **argv)
int
Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
{
- //DONE// @@ Naga, can you please explain why you need to do all of this?
- //DONE// i.e, we need some comments here! In particular, what is args1
- //DONE// being used for and how will we know that ACE_DEFAULT_ARGV_BUFSIZ
- //DONE// is an appropriate size? It seems to me that we should either (1)
- //DONE// add an accessor on ACE_ARGV to determine what this size ought to
- //DONE// be or (2) we should try to use/add a method on ACE_ARGV that
- //DONE// converts the argv back into a char * buffer or something! At any
- //DONE// rate, this code should be cleaned up and abstracted better.
int i;
for (i = 0; i < this->argc_ ; i++)
@@ -143,6 +139,9 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
0), //task id 0.
-1);
+ // @@ Naga, here's another place where we write the same code again.
+ // Please make sure that this gets factored out into a macro or an
+ // inline function!
#if defined (VXWORKS)
ACE_Sched_Priority priority = ACE_THR_PRI_FIFO_DEF;
#elif defined (ACE_WIN32)
@@ -164,17 +163,15 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
1,
0,
priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n"
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) %p\n"
"\thigh_priority_task->activate failed"));
- // ACE_DEBUG ((LM_DEBUG,"(%t) Waiting for argument parsing\n"));
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ready_mon, GLOBALS::instance ()->ready_mtx_,-1));
while (!GLOBALS::instance ()->ready_)
GLOBALS::instance ()->ready_cnd_.wait ();
- // ACE_DEBUG ((LM_DEBUG,"(%t) Argument parsing waiting done\n"));
-
// Create an array to hold pointers to the low priority tasks.
Cubit_Task **low_priority_task;
@@ -244,7 +241,9 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
{
ACE_OS::sprintf (orbport,
"-ORBport %d",
- (GLOBALS::instance ()->base_port == 0) ? (int) 0 :GLOBALS::instance ()->base_port+i);
+ GLOBALS::instance ()->base_port == 0
+ ? (int) 0
+ : GLOBALS::instance ()->base_port + i);
char *low_second_argv[] = {orbport,
orbhost,
@@ -253,7 +252,8 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
"-ORBrcvsock 32768 ",
0};
ACE_NEW_RETURN (low_argv,
- ACE_ARGV (this->argv_,low_second_argv),
+ ACE_ARGV (this->argv_,
+ low_second_argv),
-1);
ACE_NEW_RETURN (low_priority_task [i - 1],
@@ -266,10 +266,11 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
// Make the low priority task an active object.
if (low_priority_task [i - 1]->activate (THR_BOUND | ACE_SCHED_FIFO,
- 1,
- 0,
- priority) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n"
+ 1,
+ 0,
+ priority) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) %p\n"
"\tlow_priority_task[i]->activate"));
ACE_DEBUG ((LM_DEBUG,
"Created servant %d with priority %d\n",
@@ -286,12 +287,11 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
&&
//Just so when we distribute the priorities among the
//threads, we make sure we don't go overboard.
- (number_of_priorities * grain > number_of_low_priority_servants - (i - 1)))
+ number_of_priorities * grain > number_of_low_priority_servants - (i - 1))
// Get the next higher priority.
priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
priority,
ACE_SCOPE_THREAD);
-
}
} /* end of for() */
@@ -302,17 +302,15 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
cubits[0] = high_priority_task->get_servant_ior (0);
for (j = 0;
- j < GLOBALS::instance ()->num_of_objs-1;
+ j < GLOBALS::instance ()->num_of_objs - 1;
++j)
cubits[j + 1] = low_priority_task[j]->get_servant_ior (0);
FILE *ior_f = 0;
if (GLOBALS::instance ()->ior_file != 0)
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Opening file:%s\n",GLOBALS::instance ()->ior_file));
- ior_f = ACE_OS::fopen (GLOBALS::instance ()->ior_file, "w");
- }
+ ior_f = ACE_OS::fopen (GLOBALS::instance ()->ior_file,
+ "w");
for (j = 0;
j < GLOBALS::instance ()->num_of_objs;
@@ -320,19 +318,16 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
{
if (ior_f != 0)
{
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) ior_file is open :%s",GLOBALS::instance ()->ior_file));
ACE_OS::fprintf (ior_f, "%s\n", cubits[j]);
- ACE_OS::printf ("cubits[%d] ior = %s\n",
- j,
- cubits[j]);
+ ACE_DEBUG ((LM_DEBUG,
+ "cubits[%d] ior = %s\n",
+ j,
+ cubits[j]));
}
}
if (ior_f != 0)
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Closing ior file\n"));
- ACE_OS::fclose (ior_f);
- }
+ ACE_OS::fclose (ior_f);
}
return 0;
@@ -352,7 +347,7 @@ server (int argc, char *argv[])
int
main (int argc, char *argv[])
{
-#endif
+#endif /* VXWORKS */
// Dummy code to create the GLOBALS object in the global memory
// instead of TSS.
GLOBALS::instance ();
@@ -376,10 +371,12 @@ main (int argc, char *argv[])
ACE_SCOPE_PROCESS)) != 0)
{
if (ACE_OS::last_error () == EPERM)
- ACE_DEBUG ((LM_MAX, "preempt: user is not superuser, "
+ 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"),
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%n: ACE_OS::sched_params failed\n%a"),
-1);
}
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/server.h b/TAO/tests/Cubit/TAO/MT_Cubit/server.h
index 31a023a58ac..b4257725c4d 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/server.h
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/server.h
@@ -125,9 +125,12 @@ private:
// objects.
};
-
class Server
{
+ // = TITLE
+ // @@ Naga, can you please fill in here?
+ // = DESCRIPTION
+ // @@ Naga, can you please fill in here?
public:
// default constructor
int initialize (int argc, char **argv);