summaryrefslogtreecommitdiff
path: root/TAO/tests
diff options
context:
space:
mode:
authornaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-11 17:09:33 +0000
committernaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-11 17:09:33 +0000
commitb44d255b75ed04052062197807c76f44d254afd3 (patch)
tree44722dd88f2f25c4cabbd1da5295d6b428fa43ca /TAO/tests
parent85c5d65ce4b9ed790bcc4db593647fe73c076227 (diff)
downloadATCD-b44d255b75ed04052062197807c76f44d254afd3.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/tests')
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp105
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h26
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/client.cpp2
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/cubit.idl1
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/server.cpp27
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/server.h2
6 files changed, 112 insertions, 51 deletions
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
index 2f711935136..8f158b67116 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -11,23 +11,31 @@
ACE_RCSID(MT_Cubit, Task_Client, "$Id$")
Task_State::Task_State (int argc, char **argv)
- : key_ ("Cubit"),
+ : barrier_ (0),
+ key_ ("Cubit"),
loop_count_ (1000),
thread_count_ (2),
+ latency_ (0),
+ ave_latency_ (0),
datatype_ (CB_OCTET),
argc_ (ACE_static_cast (u_int, argc)),
argv_ (argv),
thread_per_rate_ (0),
global_jitter_array_ (0),
+ count_ (0),
shutdown_ (0),
oneway_ (0),
+ one_ior_ (0),
use_name_service_ (1),
one_to_n_test_ (0),
context_switch_test_ (0),
+ iors_ (0),
+ iors_count_ (0),
ior_file_ (0),
granularity_ (1),
use_utilization_test_ (0),
high_priority_loop_count_ (0),
+ semaphore_ (0),
use_multiple_priority_ (0),
utilization_task_started_ (0),
util_time_ (0),
@@ -202,8 +210,11 @@ Task_State::parse_args (int argc,char **argv)
ACE_timer_t [thread_count_],
-1);
ACE_NEW_RETURN (this->global_jitter_array_,
- ACE_timer_t *[thread_count_],
+ JITTER_ARRAY *[this->thread_count_],
-1);
+// ACE_NEW_RETURN (this->global_jitter_iterator_,
+// JITTER_ARRAY_ITERATOR *[this->thread_count_],
+// -1);
ACE_NEW_RETURN (this->count_,
u_int [thread_count_],
-1);
@@ -236,9 +247,17 @@ Client::Client (ACE_Thread_Manager *thread_manager,
: ACE_MT (ACE_Task<ACE_MT_SYNCH> (thread_manager)),
cubit_impl_ (0),
ts_ (ts),
+ num_ (0),
id_ (id),
+ call_count_ (0),
+ error_count_ (0),
+ my_jitter_array_ (0),// just an arbitrary size.
+ // my_jitter_iterator_ (my_jitter_array_),
+ timer_ (0),
frequency_ (0),
- naming_success_ (0)
+ orb_ (0),
+ naming_success_ (0),
+ latency_ (0)
{
}
@@ -249,7 +268,7 @@ Client::func (u_int i)
}
void
-Client::put_latency (ACE_timer_t *jitter,
+Client::put_latency (JITTER_ARRAY *jitter,
ACE_timer_t latency,
u_int thread_id,
u_int count)
@@ -258,6 +277,7 @@ Client::put_latency (ACE_timer_t *jitter,
this->ts_->latency_[thread_id] = latency;
this->ts_->global_jitter_array_[thread_id] = jitter;
+ // this->ts_->global_jitter_iterator_ [thread_id] = iterator;
this->ts_->count_[thread_id] = count;
ACE_DEBUG ((LM_DEBUG,
@@ -311,14 +331,19 @@ Client::get_high_priority_jitter (void)
// We first compute the sum of the squares of the differences each
// latency has from the average.
+ // JITTER_ARRAY high_array (*this->ts_->global_jitter_array_ [0]);
for (u_int i = 0; i < number_of_samples; i ++)
{
- ACE_timer_t difference =
- this->ts_->global_jitter_array_ [0][i] - average;
-
+ // ACE_timer_t latency = high_array [i];
+ // ACE_timer_t difference =
+ // latency - average;
+ // (*(this->ts_->global_jitter_array_))[i] - average;
+ ACE_timer_t difference = this->ts_->global_jitter_array_ [0][i] -average;
jitter += difference * difference;
- stats.sample ((ACE_UINT32) (this->ts_->global_jitter_array_ [0][i] * 1000 + 0.5));
+ // stats.sample ((ACE_UINT32) ((*(this->ts_->global_jitter_array_))[i] * 1000 + 0.5));
+ // stats.sample ((ACE_UINT32) (high_array [i] * 1000 + 0.5));
+ stats.sample ((ACE_UINT32) (this->ts_->global_jitter_array_ [0][i] *1000 + 0.5));
}
// Return the square root of the sum of the differences computed
@@ -355,16 +380,23 @@ Client::get_low_priority_jitter (void)
{
number_of_samples += this->ts_->count_[j];
+ // JITTER_ARRAY low_array (*this->ts_->global_jitter_array_ [j]);
for (u_int i = 0;
i < this->ts_->count_[j] / this->ts_->granularity_;
i ++)
{
- ACE_timer_t difference =
- this->ts_->global_jitter_array_[j][i] - average;
+ // ACE_timer_t latency = low_array [i];
+ // ACE_timer_t difference = latency - average;
+// ACE_timer_t difference =
+// (*(this->ts_->global_jitter_array_ + j))[i] - average;
+ ACE_timer_t difference =
+ this->ts_->global_jitter_array_ [j][i] - average;
jitter += difference * difference;
- stats.sample ((ACE_UINT32) (this->ts_->global_jitter_array_ [j][i] * 1000 + 0.5));
+ // stats.sample ((ACE_UINT32) (*(this->ts_->global_jitter_array_ + j)) [i] * 1000 + 0.5));
+ // stats.sample ((ACE_UINT32) (low_array [i] * 1000 + 0.5));
+ stats.sample ((ACE_UINT32) (this->ts_->global_jitter_array_ [j][i] *1000 + 0.5));
}
}
@@ -393,15 +425,21 @@ Client::get_jitter (u_int id)
// We first compute the sum of the squares of the differences each
// latency has from the average.
- for (u_int i = 0;
- i < this->ts_->count_[id] / this->ts_->granularity_;
- i ++)
- {
- ACE_timer_t difference =
- this->ts_->global_jitter_array_[id][i] - average;
-
+ // JITTER_ARRAY low_array (*this->ts_->global_jitter_array_ [id]);
+ for (u_int i = 0;
+ i < this->ts_->count_[id] / this->ts_->granularity_;
+ i ++)
+ {
+ // ACE_timer_t latency = low_array [i];
+ // ACE_timer_t difference = latency -average;
+// ACE_timer_t difference =
+// (*(this->ts_->global_jitter_array_ + id) [i] - average;
+ ACE_timer_t difference =
+ this->ts_->global_jitter_array_ [id][i] - average;
jitter += difference * difference;
+ // stats.sample ((ACE_UINT32) (*(this->ts_->global_jitter_array_ + id ))[i] * 1000 + 0.5));
+ // stats.sample ((ACE_UINT32) (low_array [i] * 1000 + 0.5));
stats.sample ((ACE_UINT32) (this->ts_->global_jitter_array_ [id][i] * 1000 + 0.5));
}
@@ -520,7 +558,7 @@ Client::init_orb (void)
int result = this->ts_->parse_args (argc,
argv);
- if (result < 0)
+ if (result != 0)
return -1;
ACE_DEBUG ((LM_DEBUG,
@@ -628,7 +666,7 @@ Client::get_cubit_from_naming (void)
}
int
- Client::get_cubit (void)
+Client::get_cubit (void)
{
int result;
CORBA::Object_var objref (0);
@@ -638,7 +676,7 @@ int
if (this->ts_->use_name_service_ != 0)
{
result = this->get_cubit_from_naming ();
- if (result < 0)
+ if (result != 0)
return result;
}
else
@@ -717,7 +755,7 @@ int
TAO_CATCHANY
{
TAO_TRY_ENV.print_exception ("Client::get_cubit");
- return 1;
+ return -1;
}
TAO_ENDTRY;
return 0;
@@ -729,13 +767,13 @@ Client::svc (void)
int result;
// initialize the ORB.
result = this->init_orb ();
- if (result < 0)
+ if (result != 0)
return result;
// find the frequency of CORBA requests based on thread id.
this->find_frequency ();
// get the cubit object either from naming service or from the ior file.
result = this->get_cubit ();
- if (result < 0)
+ if (result != 0)
return result;
ACE_DEBUG ((LM_DEBUG,
"(%t) Waiting for other threads to "
@@ -751,7 +789,7 @@ Client::svc (void)
// Perform the tests.
result = this->run_tests ();
- if (result < 0)
+ if (result != 0)
return result;
// release the semaphore
if (this->ts_->thread_per_rate_ == 1
@@ -981,7 +1019,7 @@ Client::make_request (void)
"(%P|%t); %s:%d; unexpected datatype: %d\n",
this->ts_->datatype_), -1);
}
- if (result < 0)
+ if (result != 0)
return result;
}
else
@@ -1095,7 +1133,7 @@ Client::do_test (void)
// make a request to the server object depending on the datatype.
result = this->make_request ();
- if (result < 0)
+ if (result != 0)
return 2;
// Stop the timer.
@@ -1150,16 +1188,15 @@ int
Client::run_tests (void)
{
int result;
- // %% Naga, This has to be replaced by ACE_Array .Thanx to Sergio for the idea.
if (id_ == 0
&& this->ts_->thread_count_ > 1)
ACE_NEW_RETURN (this->my_jitter_array_,
- ACE_timer_t [(this->ts_->loop_count_/this->ts_->granularity_)*30],
- -1);
- else
- ACE_NEW_RETURN (this->my_jitter_array_,
- ACE_timer_t [(this->ts_->loop_count_/this->ts_->granularity_)*15],
+ JITTER_ARRAY [(this->ts_->loop_count_/this->ts_->granularity_)*30],
-1);
+ else
+ ACE_NEW_RETURN (this->my_jitter_array_,
+ JITTER_ARRAY [(this->ts_->loop_count_/this->ts_->granularity_)*15],
+ -1);
// Time to wait for utilization tests to know when to stop.
ACE_Time_Value max_wait_time (this->ts_->util_time_, 0);
@@ -1186,7 +1223,7 @@ Client::run_tests (void)
}
this->print_stats ();
// Delete the dynamically allocated memory
- delete [] this->my_jitter_array_;
+ // delete [] this->my_jitter_array_;
return 0;
}
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
index a2a49352ada..91bea56c3e7 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
@@ -25,6 +25,7 @@
#include "ace/ARGV.h"
#include "ace/Sched_Params.h"
#include "ace/High_Res_Timer.h"
+#include "ace/Containers.h"
#include "orbsvcs/CosNamingC.h"
#include "orbsvcs/Naming/Naming_Utils.h"
@@ -85,6 +86,11 @@ enum Cubit_Datatypes
CB_LOW_PRIORITY_RATE = 10
};
+//typedef ACE_Array<ACE_timer_t> JITTER_ARRAY;
+//typedef ACE_Array_Iterator<ACE_timer_t> JITTER_ARRAY_ITERATOR;
+
+typedef ACE_timer_t JITTER_ARRAY;
+
class Task_State
{
// = TITLE
@@ -97,10 +103,6 @@ public:
int parse_args (int argc,char **argv);
// parses the arguments
- ACE_Barrier *barrier_;
- // Barrier for the multiple clients to synchronize after binding to
- // the servants.
-
Task_State (int argc, char **argv);
// Constructor. Takes the command line arguments, which are later
// passed into ORB_init.
@@ -108,6 +110,10 @@ public:
~Task_State (void);
// Destructor
+ ACE_Barrier *barrier_;
+ // Barrier for the multiple clients to synchronize after binding to
+ // the servants.
+
CORBA::String key_;
// All cubit objects will have this as prefix to its key.
@@ -137,10 +143,13 @@ public:
u_int thread_per_rate_;
// Flag for the thread_per_rate test.
- ACE_timer_t **global_jitter_array_;
+ JITTER_ARRAY **global_jitter_array_;
// This array stores the latency seen by each client for each
// request, to be used later to compute jitter.
+ // JITTER_ARRAY_ITERATOR **global_jitter_iterator_;
+ // Iterator for the jitter array.
+
u_int *count_;
// This array stores the call count of each thread. They will not
// always have the same call count.
@@ -297,7 +306,7 @@ private:
void print_stats (void);
// prints the latency stats.
- void put_latency (ACE_timer_t *jitter,
+ void put_latency (JITTER_ARRAY *jitter,
ACE_timer_t latency,
u_int thread_id,
u_int count);
@@ -337,9 +346,12 @@ private:
TAO_Naming_Client my_name_client_;
// Naming Client intermediary to naming service stuff.
- ACE_timer_t *my_jitter_array_;
+ JITTER_ARRAY *my_jitter_array_;
// Array holding the jitter values for the latencies.
+ // JITTER_ARRAY_ITERATOR my_jitter_iterator_;
+ //Iterator.
+
MT_Cubit_Timer *timer_;
// Timer using pccTimer for chorus and ACE_Timer for other platforms.
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
index 173b112ffbb..e12d8048abc 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -279,6 +279,7 @@ Client_i::output_latency (Task_State *ts)
: this->ts_->loop_count_) / this->ts_->granularity_;
i++)
{
+ JITTER_ARRAY jitter_array (*this->ts_->global_jitter_array_ [j]);
ACE_OS::sprintf (buffer + ACE_OS::strlen (buffer),
#if defined (CHORUS)
"\t%u\n",
@@ -286,6 +287,7 @@ Client_i::output_latency (Task_State *ts)
"\t%f\n",
#endif /* !CHORUS */
this->ts_->global_jitter_array_[j][i]);
+ // jitter_array [i]);
ACE_OS::fputs (buffer,
latency_file_handle);
buffer[0] = 0;
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/cubit.idl b/TAO/tests/Cubit/TAO/MT_Cubit/cubit.idl
index 113c7e24697..30285cd9d12 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/cubit.idl
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/cubit.idl
@@ -34,5 +34,6 @@ interface Cubit
oneway void shutdown ();
// shut down the application
+
};
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
index 530b51ee34e..147759a0388 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -116,10 +116,10 @@ Server::prelim_args_process (void)
&& i - 1 < this->argc_)
ACE_OS::strcpy (GLOBALS::instance ()->hostname,
this->argv_[i+1]);
- else if (ACE_OS::strcmp (this->argv_[i], "-t") == 0
- && i - 1 < this->argc_)
- GLOBALS::instance ()->num_of_objs =
- ACE_OS::atoi (this->argv_ [i + 1]);
+// else if (ACE_OS::strcmp (this->argv_[i], "-t") == 0
+// && i - 1 < this->argc_)
+// GLOBALS::instance ()->num_of_objs =
+// ACE_OS::atoi (this->argv_ [i + 1]);
}
}
@@ -148,11 +148,16 @@ Server::init_low_priority (void)
// Write the ior's to a file so the client can read them.
-void
+int
Server::write_iors (void)
{
u_int j;
+ // By this time the num of objs should be set properly.
+ ACE_NEW_RETURN (this->cubits_,
+ CORBA::String [GLOBALS::instance ()->num_of_objs],
+ -1);
+
this->cubits_[0] = ACE_OS::strdup (this->high_priority_task_->get_servant_ior (0));
for (j = 1;
@@ -183,6 +188,8 @@ Server::write_iors (void)
if (ior_f != 0)
ACE_OS::fclose (ior_f);
+
+ return 0;
}
int
@@ -329,9 +336,9 @@ Server::activate_low_servants (ACE_Thread_Manager *serv_thr_mgr)
int
Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
{
- ACE_NEW_RETURN (this->cubits_,
- CORBA::String [GLOBALS::instance ()->num_of_objs],
- -1);
+ int result;
+ // The problem is num of objs is not set here but only after high
+ // priority servant is activated.
// Do the preliminary argument processing for options -p and -h.
this->prelim_args_process ();
@@ -362,7 +369,9 @@ Server::start_servants (ACE_Thread_Manager *serv_thr_mgr)
-1);
// Wait in the barrier.
GLOBALS::instance ()->barrier_->wait ();
- this->write_iors ();
+ result = this->write_iors ();
+ if (result != 0)
+ return result;
return 0;
}
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/server.h b/TAO/tests/Cubit/TAO/MT_Cubit/server.h
index 5c18c1359b9..03f0e1218fe 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/server.h
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/server.h
@@ -77,7 +77,7 @@ private:
void init_low_priority (void);
// sets the priority to be used for the low priority servants.
- void write_iors (void);
+ int write_iors (void);
// Writes the iors of the servants to a file
int activate_high_servant (ACE_Thread_Manager *serv_thr_mgr);