summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-14 01:58:10 +0000
committernaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-14 01:58:10 +0000
commit33e656498392ece4ff62748f5f3d86a5eeb24ca3 (patch)
tree2835307e89d8214b614b023b7184d2d72ab6df06
parent5c08f2b80915257768075c4ec80022b4c5ac82c8 (diff)
downloadATCD-33e656498392ece4ff62748f5f3d86a5eeb24ca3.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-98c9
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp27
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h40
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Timer.cpp4
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp23
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp27
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h40
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Timer.cpp4
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/client.cpp23
9 files changed, 144 insertions, 53 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 3d9ca0affb2..0d9f7d2881e 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -6,7 +6,14 @@ Sun Sep 13 18:16:46 1998 Nagarajan Surendran <naga@cs.wustl.edu>
* tests/Cubit/TAO/MT_Cubit/Util_Thread.cpp: Replaced magic numbers
with symbolic constants.
-
+
+ * tests/Cubit/TAO/MT_Cubit/Timer.cpp: Fixed the elapsed time
+ calculation for vxworks. Thanks to sergio for finding this.
+
+ * tests/Cubit/TAO/MT_Cubit/Task_Client.cpp:
+ * tests/Cubit/TAO/MT_Cubit/client.cpp:
+ Fixed memory leaks.
+
Sun Sep 13 00:44:07 1998 Sergio Flores <sergio@tango.cs.wustl.edu>
* tests/Cubit/TAO/MT_Cubit/server.cpp:
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
index 63b1b76a9bd..0cba63f33ce 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -10,7 +10,7 @@
ACE_RCSID(MT_Cubit, Task_Client, "$Id$")
-Task_State::Task_State (int argc, char *argv[])
+Task_State::Task_State (void)
: barrier_ (0),
key_ ("Cubit"),
loop_count_ (1000),
@@ -18,8 +18,6 @@ Task_State::Task_State (int argc, char *argv[])
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),
@@ -133,7 +131,7 @@ Task_State::parse_args (int argc,char *argv[])
" [-o] // makes client use oneway calls instead"
" [-s] // makes client *NOT* use the name service"
" [-g granularity_of_timing]"
- "\n", this->argv_ [0]));
+ "\n", argv [0]));
return -1;
}
@@ -232,17 +230,21 @@ Task_State::~Task_State (void)
for (i = 0; i < this->iors_count_; i++)
ACE_OS::free (this->iors_ [i]);
+ delete this->iors_;
// Delete the barrier.
delete this->barrier_;
delete this->semaphore_;
delete [] this->latency_;
+ delete [] this->ave_latency_;
delete [] this->global_jitter_array_;
delete [] this->count_;
}
Client::Client (ACE_Thread_Manager *thread_manager,
Task_State *ts,
+ int argc,
+ char **argv,
u_int id)
: ACE_Task<ACE_MT_SYNCH> (thread_manager),
cubit_impl_ (0),
@@ -256,8 +258,17 @@ Client::Client (ACE_Thread_Manager *thread_manager,
frequency_ (0),
orb_ (0),
naming_success_ (0),
- latency_ (0)
+ latency_ (0),
+ argc_ (argc),
+ argv_ (argv)
+{
+}
+
+Client::~Client (void)
{
+ delete this->cubit_impl_;
+ delete this->my_jitter_array_;
+ delete this->timer_;
}
ACE_INLINE int
@@ -534,16 +545,16 @@ Client::init_orb (void)
ACE_DEBUG ((LM_DEBUG,
"I'm thread %t\n"));
- // Add "-ORBobjrefstyle url" argument to the argv vector for the orb
- // to / use a URL style to represent the ior.
// Convert the argv vector into a string.
- ACE_ARGV tmp_args (this->ts_->argv_);
+ ACE_ARGV tmp_args (this->argv_);
char tmp_buf[BUFSIZ];
ACE_OS::strcpy (tmp_buf,
tmp_args.buf ());
// Add the argument.
+ // Add "-ORBobjrefstyle url" argument to the argv vector for the orb
+ // to / use a URL style to represent the ior.
ACE_OS::strcat (tmp_buf,
" -ORBobjrefstyle url "
" -ORBrcvsock 32768 "
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h
index ddb10dfcfd5..799d9270147 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h
@@ -98,12 +98,11 @@ class Task_State
// This class maintains state which is common to the potentially
// multiple concurrent clients.
public:
- int parse_args (int argc,char **argv);
- // parses the arguments
+ Task_State (void);
+ // Constructor.
- Task_State (int argc, char **argv);
- // Constructor. Takes the command line arguments, which are later
- // passed into ORB_init.
+ int parse_args (int argc,char **argv);
+ // parses the arguments with the provided argc and argv.
~Task_State (void);
// Destructor
@@ -134,10 +133,6 @@ public:
ACE_SYNCH_MUTEX lock_;
// Lock to protect access to this object.
- // = Command line arguments.
- u_int argc_;
- char **argv_;
-
u_int thread_per_rate_;
// Flag for the thread_per_rate test.
@@ -245,20 +240,36 @@ class Client : public ACE_Task<ACE_SYNCH>
public:
Client (ACE_Thread_Manager *,
Task_State *ts,
+ int argc,
+ char **argv,
u_int id);
// Constructor, with a pointer to the common task state.
+ ~Client (void);
+ // destructor.
+
virtual int svc (void);
// The thread function.
ACE_timer_t get_high_priority_latency (void);
+ // Returns the latency of the high priority thread in usecs.
+
ACE_timer_t get_low_priority_latency (void);
+ // Returns the average latency found for the low
+ // priority threads in usecs.
+
ACE_timer_t get_high_priority_jitter (void);
+ // Returns the high priority jitter in usecs.
+
ACE_timer_t get_low_priority_jitter (void);
+ // Returns the jitter for all the low priority
+ // thread request in usecs.
+
ACE_timer_t get_latency (u_int thread_id);
- ACE_timer_t get_jitter (u_int id);
- // Accessors to get the various measured quantities.
+ // gets the average latency for that thread.
+ ACE_timer_t get_jitter (u_int id);
+ // gets the jitter for this thread.
static int func (u_int i);
// Arbitrary generator used by the client to create the numbers to be
@@ -346,7 +357,8 @@ private:
// Naming Client intermediary to naming service stuff.
JITTER_ARRAY *my_jitter_array_;
- // Array holding the jitter values for the latencies.
+ // ACE Unbounded set holding the latency values for all the
+ // requests of this thread.
MT_Cubit_Timer *timer_;
// Timer using pccTimer for chorus and ACE_Timer for other platforms.
@@ -362,6 +374,10 @@ private:
ACE_timer_t latency_;
// aggregate latency of the requests.
+
+ // command-line arguments.
+ int argc_;
+ char **argv_;
};
#endif /* !defined (TASK_CLIENT_H) */
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Timer.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Timer.cpp
index b0ed07ec8e9..d697541d1c9 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Timer.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Timer.cpp
@@ -48,7 +48,7 @@ MT_Cubit_Timer::get_elapsed (void)
#endif /* !CHORUS */
#else /* !ACE_LACKS_FLOATING_POINT */
- // Store the time in secs.
+ // Store the time in usecs.
#if defined (VXWORKS)
// @@ David, these comments are to temporarily fix what seems a bug
@@ -72,7 +72,7 @@ MT_Cubit_Timer::get_elapsed (void)
this->delta_.usec ()));
}
- real_time = tmp + tmp2 / (ACE_timer_t) ACE_ONE_SECOND_IN_USECS;
+ real_time = tmp * ACE_ONE_SECOND_IN_USECS + tmp2;
#else
real_time = ((ACE_timer_t) this->delta_.sec () * ACE_ONE_SECOND_IN_USECS) +
(ACE_timer_t) this->delta_.usec ();
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
index 8caa0e76218..7be4222244e 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -73,12 +73,16 @@ Client_i::Client_i (void)
Client_i::~Client_i (void)
{
+ delete this->high_priority_client_;
if (this->low_priority_client_ != 0)
// Delete the low priority task array.
for (u_int i = this->num_low_priority_;
i > 0;
i--)
delete this->low_priority_client_[i - 1];
+ delete this->low_priority_client_;
+ delete this->util_thread_;
+ delete this->ts_;
}
int
@@ -98,8 +102,7 @@ Client_i::init (int argc, char *argv[])
ACE::set_handle_limit ();
ACE_NEW_RETURN (this->ts_,
- Task_State (this->argc_,
- this->argv_),
+ Task_State,
-1);
// Preliminary argument processing.
@@ -292,6 +295,8 @@ Client_i::activate_high_client (void)
ACE_NEW_RETURN (this->high_priority_client_,
Client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
0),
-1);
@@ -355,6 +360,8 @@ Client_i::activate_low_client (void)
ACE_NEW_RETURN (this->low_priority_client_ [i - 1],
Client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
i),
-1);
#if defined (VXWORKS)
@@ -650,8 +657,8 @@ Client_i::do_priority_inversion_test (void)
GLOBALS::instance ()->num_of_objs = 1;
GLOBALS::instance ()->use_name_service = 0;
- for (u_int j = 0; j < this->ts_->argc_; j++)
- if (ACE_OS::strcmp (this->ts_->argv_[j], "-u") == 0)
+ for (u_int j = 0; j < this->argc_; j++)
+ if (ACE_OS::strcmp (this->argv_[j], "-u") == 0)
{
this->start_servant ();
break;
@@ -721,15 +728,23 @@ Client_i::do_thread_per_rate_test (void)
{
Client CB_20Hz_client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
CB_20HZ_CONSUMER);
Client CB_10Hz_client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
CB_10HZ_CONSUMER);
Client CB_5Hz_client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
CB_5HZ_CONSUMER);
Client CB_1Hz_client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
CB_1HZ_CONSUMER);
ACE_Sched_Priority priority;
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
index 63b1b76a9bd..0cba63f33ce 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -10,7 +10,7 @@
ACE_RCSID(MT_Cubit, Task_Client, "$Id$")
-Task_State::Task_State (int argc, char *argv[])
+Task_State::Task_State (void)
: barrier_ (0),
key_ ("Cubit"),
loop_count_ (1000),
@@ -18,8 +18,6 @@ Task_State::Task_State (int argc, char *argv[])
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),
@@ -133,7 +131,7 @@ Task_State::parse_args (int argc,char *argv[])
" [-o] // makes client use oneway calls instead"
" [-s] // makes client *NOT* use the name service"
" [-g granularity_of_timing]"
- "\n", this->argv_ [0]));
+ "\n", argv [0]));
return -1;
}
@@ -232,17 +230,21 @@ Task_State::~Task_State (void)
for (i = 0; i < this->iors_count_; i++)
ACE_OS::free (this->iors_ [i]);
+ delete this->iors_;
// Delete the barrier.
delete this->barrier_;
delete this->semaphore_;
delete [] this->latency_;
+ delete [] this->ave_latency_;
delete [] this->global_jitter_array_;
delete [] this->count_;
}
Client::Client (ACE_Thread_Manager *thread_manager,
Task_State *ts,
+ int argc,
+ char **argv,
u_int id)
: ACE_Task<ACE_MT_SYNCH> (thread_manager),
cubit_impl_ (0),
@@ -256,8 +258,17 @@ Client::Client (ACE_Thread_Manager *thread_manager,
frequency_ (0),
orb_ (0),
naming_success_ (0),
- latency_ (0)
+ latency_ (0),
+ argc_ (argc),
+ argv_ (argv)
+{
+}
+
+Client::~Client (void)
{
+ delete this->cubit_impl_;
+ delete this->my_jitter_array_;
+ delete this->timer_;
}
ACE_INLINE int
@@ -534,16 +545,16 @@ Client::init_orb (void)
ACE_DEBUG ((LM_DEBUG,
"I'm thread %t\n"));
- // Add "-ORBobjrefstyle url" argument to the argv vector for the orb
- // to / use a URL style to represent the ior.
// Convert the argv vector into a string.
- ACE_ARGV tmp_args (this->ts_->argv_);
+ ACE_ARGV tmp_args (this->argv_);
char tmp_buf[BUFSIZ];
ACE_OS::strcpy (tmp_buf,
tmp_args.buf ());
// Add the argument.
+ // Add "-ORBobjrefstyle url" argument to the argv vector for the orb
+ // to / use a URL style to represent the ior.
ACE_OS::strcat (tmp_buf,
" -ORBobjrefstyle url "
" -ORBrcvsock 32768 "
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
index ddb10dfcfd5..799d9270147 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
@@ -98,12 +98,11 @@ class Task_State
// This class maintains state which is common to the potentially
// multiple concurrent clients.
public:
- int parse_args (int argc,char **argv);
- // parses the arguments
+ Task_State (void);
+ // Constructor.
- Task_State (int argc, char **argv);
- // Constructor. Takes the command line arguments, which are later
- // passed into ORB_init.
+ int parse_args (int argc,char **argv);
+ // parses the arguments with the provided argc and argv.
~Task_State (void);
// Destructor
@@ -134,10 +133,6 @@ public:
ACE_SYNCH_MUTEX lock_;
// Lock to protect access to this object.
- // = Command line arguments.
- u_int argc_;
- char **argv_;
-
u_int thread_per_rate_;
// Flag for the thread_per_rate test.
@@ -245,20 +240,36 @@ class Client : public ACE_Task<ACE_SYNCH>
public:
Client (ACE_Thread_Manager *,
Task_State *ts,
+ int argc,
+ char **argv,
u_int id);
// Constructor, with a pointer to the common task state.
+ ~Client (void);
+ // destructor.
+
virtual int svc (void);
// The thread function.
ACE_timer_t get_high_priority_latency (void);
+ // Returns the latency of the high priority thread in usecs.
+
ACE_timer_t get_low_priority_latency (void);
+ // Returns the average latency found for the low
+ // priority threads in usecs.
+
ACE_timer_t get_high_priority_jitter (void);
+ // Returns the high priority jitter in usecs.
+
ACE_timer_t get_low_priority_jitter (void);
+ // Returns the jitter for all the low priority
+ // thread request in usecs.
+
ACE_timer_t get_latency (u_int thread_id);
- ACE_timer_t get_jitter (u_int id);
- // Accessors to get the various measured quantities.
+ // gets the average latency for that thread.
+ ACE_timer_t get_jitter (u_int id);
+ // gets the jitter for this thread.
static int func (u_int i);
// Arbitrary generator used by the client to create the numbers to be
@@ -346,7 +357,8 @@ private:
// Naming Client intermediary to naming service stuff.
JITTER_ARRAY *my_jitter_array_;
- // Array holding the jitter values for the latencies.
+ // ACE Unbounded set holding the latency values for all the
+ // requests of this thread.
MT_Cubit_Timer *timer_;
// Timer using pccTimer for chorus and ACE_Timer for other platforms.
@@ -362,6 +374,10 @@ private:
ACE_timer_t latency_;
// aggregate latency of the requests.
+
+ // command-line arguments.
+ int argc_;
+ char **argv_;
};
#endif /* !defined (TASK_CLIENT_H) */
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Timer.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Timer.cpp
index b0ed07ec8e9..d697541d1c9 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Timer.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Timer.cpp
@@ -48,7 +48,7 @@ MT_Cubit_Timer::get_elapsed (void)
#endif /* !CHORUS */
#else /* !ACE_LACKS_FLOATING_POINT */
- // Store the time in secs.
+ // Store the time in usecs.
#if defined (VXWORKS)
// @@ David, these comments are to temporarily fix what seems a bug
@@ -72,7 +72,7 @@ MT_Cubit_Timer::get_elapsed (void)
this->delta_.usec ()));
}
- real_time = tmp + tmp2 / (ACE_timer_t) ACE_ONE_SECOND_IN_USECS;
+ real_time = tmp * ACE_ONE_SECOND_IN_USECS + tmp2;
#else
real_time = ((ACE_timer_t) this->delta_.sec () * ACE_ONE_SECOND_IN_USECS) +
(ACE_timer_t) this->delta_.usec ();
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
index 8caa0e76218..7be4222244e 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -73,12 +73,16 @@ Client_i::Client_i (void)
Client_i::~Client_i (void)
{
+ delete this->high_priority_client_;
if (this->low_priority_client_ != 0)
// Delete the low priority task array.
for (u_int i = this->num_low_priority_;
i > 0;
i--)
delete this->low_priority_client_[i - 1];
+ delete this->low_priority_client_;
+ delete this->util_thread_;
+ delete this->ts_;
}
int
@@ -98,8 +102,7 @@ Client_i::init (int argc, char *argv[])
ACE::set_handle_limit ();
ACE_NEW_RETURN (this->ts_,
- Task_State (this->argc_,
- this->argv_),
+ Task_State,
-1);
// Preliminary argument processing.
@@ -292,6 +295,8 @@ Client_i::activate_high_client (void)
ACE_NEW_RETURN (this->high_priority_client_,
Client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
0),
-1);
@@ -355,6 +360,8 @@ Client_i::activate_low_client (void)
ACE_NEW_RETURN (this->low_priority_client_ [i - 1],
Client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
i),
-1);
#if defined (VXWORKS)
@@ -650,8 +657,8 @@ Client_i::do_priority_inversion_test (void)
GLOBALS::instance ()->num_of_objs = 1;
GLOBALS::instance ()->use_name_service = 0;
- for (u_int j = 0; j < this->ts_->argc_; j++)
- if (ACE_OS::strcmp (this->ts_->argv_[j], "-u") == 0)
+ for (u_int j = 0; j < this->argc_; j++)
+ if (ACE_OS::strcmp (this->argv_[j], "-u") == 0)
{
this->start_servant ();
break;
@@ -721,15 +728,23 @@ Client_i::do_thread_per_rate_test (void)
{
Client CB_20Hz_client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
CB_20HZ_CONSUMER);
Client CB_10Hz_client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
CB_10HZ_CONSUMER);
Client CB_5Hz_client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
CB_5HZ_CONSUMER);
Client CB_1Hz_client (&this->client_thread_manager_,
this->ts_,
+ this->argc_,
+ this->argv_,
CB_1HZ_CONSUMER);
ACE_Sched_Priority priority;