summaryrefslogtreecommitdiff
path: root/TAO/tests/Cubit/TAO
diff options
context:
space:
mode:
authorsergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-08 07:41:58 +0000
committersergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-08 07:41:58 +0000
commite49857037f7f63debb04f3d0ac314bb233dcab75 (patch)
treee9a087fa1d17f413058240dcac1dd4262b5cd93b /TAO/tests/Cubit/TAO
parente611632adddf1d29cc68a4aab2f690512b2df7a7 (diff)
downloadATCD-e49857037f7f63debb04f3d0ac314bb233dcab75.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/tests/Cubit/TAO')
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Makefile7
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp115
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/client.cpp138
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/server.cpp15
4 files changed, 161 insertions, 114 deletions
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Makefile b/TAO/tests/Cubit/TAO/MT_Cubit/Makefile
index 7813d170e78..ddf3689d621 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Makefile
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Makefile
@@ -73,6 +73,11 @@ else
LDLIBS += -lOrb-mt
endif
+#
+ifdef quantify
+ CPPFLAGS += -I/pkg/purify/quantify-3.0-solaris2
+endif
+
.PRECIOUS: cubitC.h cubitC.i cubitC.cpp cubitS.h cubitS.i cubitS.cpp
server: $(addprefix $(VDIR),$(CUBIT_SVR_OBJS))
@@ -85,7 +90,7 @@ clean:
-/bin/rm -rf *.o $(BIN) obj.* core Templates.DB .make.state
realclean: clean
- -/bin/rm -rf cubitC.* cubitS.*
+ -/bin/rm -rf cubitC.* cubitS.* cubitS_T.*
# DO NOT DELETE THIS LINE -- g++dep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
index cc94b203d66..706280166f2 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -3,6 +3,10 @@
#include "Task_Client.h"
#include "ace/Stats.h"
+#if defined (ACE_QUANTIFY)
+#include "quantify.h"
+#endif /* ACE_QUANTIFY */
+
Task_State::Task_State (int argc, char **argv)
: key_ ("Cubit"),
start_count_ (0),
@@ -101,6 +105,9 @@ Task_State::Task_State (int argc, char **argv)
"\n", argv [0]));
}
+ if (thread_per_rate_ == 1)
+ thread_count_ = 5;
+
// allocate the array of character pointers.
ACE_NEW (iors_,
char *[thread_count_]);
@@ -524,7 +531,10 @@ Client::svc (void)
ts_->datatype_,
frequency);
- ts_->semaphore_->release ();
+ if (ts_->thread_per_rate_ == 1 && this->id_ == (ts_->thread_count_ - 1) )
+ ts_->semaphore_->release (ts_->thread_count_ - 1);
+ else
+ ts_->semaphore_->release ();
if (result == -1)
return -1;
@@ -561,15 +571,15 @@ Client::run_tests (Cubit_ptr cb,
if (id_ == 0)
ACE_NEW_RETURN (my_jitter_array,
- double [(loop_count/ts_->granularity_)*3], // magic number, for now.
+ double [(loop_count/ts_->granularity_)*10], // magic number, for now.
-1);
else
ACE_NEW_RETURN (my_jitter_array,
- double [loop_count/ts_->granularity_], // magic number, for now.
+ double [loop_count/ts_->granularity_],
-1);
double latency = 0;
- double sleep_time = (1 / frequency) * (1000 * 1000) * ts_->granularity_; // usec
+ double sleep_time = (1 / frequency) * ACE_ONE_SECOND_IN_USECS * ts_->granularity_; // usec
double delta = 0;
#if defined (CHORUS)
@@ -578,18 +588,20 @@ Client::run_tests (Cubit_ptr cb,
#endif /* CHORUS */
double real_time = 0.0;
-#if defined (USE_QUANTIFY)
- quantify_stop_recording_data();
- quantify_clear_data ();
-#endif /* USE_QUANTIFY */
-
ACE_High_Res_Timer timer_;
// Make the calls in a loop.
- // if i'm the high priority client, loop forever, until all low
- // priority clients are done. This is implemented with a semaphore.
- for (i = 0; i < loop_count || (id_ == 0 && ts_->thread_count_ > 1); i++)
+ for (i = 0;
+ // keep running for loop count, OR
+ i < loop_count ||
+ // keep running if we are the highest priority thread and at
+ // least another lower client thread is running, OR
+ (id_ == 0 && ts_->thread_count_ > 1) ||
+ // keep running if test is thread_per_rate and we're not the
+ // lowest frequency thread.
+ (ts_->thread_per_rate_ == 1 && id_ < (ts_->thread_count_ - 1));
+ i++)
{
// Elapsed time will be in microseconds.
ACE_Time_Value delta_t;
@@ -621,15 +633,15 @@ Client::run_tests (Cubit_ptr cb,
// Cube an octet.
CORBA::Octet arg_octet = func (i), ret_octet = 0;
-#if defined (USE_QUANTIFY)
+#if defined (ACE_QUANTIFY)
/* start recording quantify data from here */
quantify_start_recording_data ();
-#endif /* USE_QUANTIFY */
+#endif /* ACE_QUANTIFY */
ret_octet = cb->cube_octet (arg_octet, env);
-#if defined (USE_QUANTIFY)
+#if defined (ACE_QUANTIFY)
quantify_stop_recording_data();
-#endif /* USE_QUANTIFY */
+#endif /* ACE_QUANTIFY */
if (env.exception () != 0)
{
@@ -660,16 +672,16 @@ Client::run_tests (Cubit_ptr cb,
CORBA::Short arg_short = func (i), ret_short;
-#if defined (USE_QUANTIFY)
+#if defined (ACE_QUANTIFY)
// start recording quantify data from here.
quantify_start_recording_data ();
-#endif /* USE_QUANTIFY */
+#endif /* ACE_QUANTIFY */
ret_short = cb->cube_short (arg_short, env);
-#if defined (USE_QUANTIFY)
+#if defined (ACE_QUANTIFY)
quantify_stop_recording_data();
-#endif /* USE_QUANTIFY */
+#endif /* ACE_QUANTIFY */
if (env.exception () != 0)
{
@@ -701,16 +713,16 @@ Client::run_tests (Cubit_ptr cb,
CORBA::Long arg_long = func (i);
CORBA::Long ret_long;
-#if defined (USE_QUANTIFY)
+#if defined (ACE_QUANTIFY)
/* start recording quantify data from here */
quantify_start_recording_data ();
-#endif /* USE_QUANTIFY */
+#endif /* ACE_QUANTIFY */
ret_long = cb->cube_long (arg_long, env);
-#if defined (USE_QUANTIFY)
+#if defined (ACE_QUANTIFY)
quantify_stop_recording_data();
-#endif /* USE_QUANTIFY */
+#endif /* ACE_QUANTIFY */
if (env.exception () != 0)
{
@@ -745,16 +757,16 @@ Client::run_tests (Cubit_ptr cb,
arg_struct.s = func (i);
arg_struct.o = func (i);
-#if defined (USE_QUANTIFY)
+#if defined (ACE_QUANTIFY)
// start recording quantify data from here.
quantify_start_recording_data ();
-#endif /* USE_QUANTIFY */
+#endif /* ACE_QUANTIFY */
ret_struct = cb->cube_struct (arg_struct, env);
-#if defined (USE_QUANTIFY)
+#if defined (ACE_QUANTIFY)
quantify_stop_recording_data();
-#endif /* USE_QUANTIFY */
+#endif /* ACE_QUANTIFY */
if (env.exception () != 0)
{
@@ -785,14 +797,14 @@ Client::run_tests (Cubit_ptr cb,
else
{
call_count++;
-#if defined (USE_QUANTIFY)
+#if defined (ACE_QUANTIFY)
// start recording quantify data from here.
quantify_start_recording_data ();
-#endif /* USE_QUANTIFY */
+#endif /* ACE_QUANTIFY */
cb->noop (env);
-#if defined (USE_QUANTIFY)
+#if defined (ACE_QUANTIFY)
quantify_stop_recording_data();
-#endif /* USE_QUANTIFY */
+#endif /* ACE_QUANTIFY */
if (env.exception () != 0)
{
env.print_exception ("oneway call noop()\n");
@@ -841,25 +853,32 @@ Client::run_tests (Cubit_ptr cb,
real_time /= ts_->granularity_;
- delta = ((0.4 * fabs (real_time * (1000 * 1000))) + (0.6 * delta)); // pow(10,6)
+ delta = ((0.4 * fabs (real_time * ACE_ONE_SECOND_IN_USECS)) + (0.6 * delta)); // pow(10,6)
latency += (real_time * ts_->granularity_);
- my_jitter_array [i/ts_->granularity_] = real_time * 1000;
+ if (ts_->thread_per_rate_ == 0)
+ my_jitter_array [i/ts_->granularity_] = real_time * ACE_ONE_SECOND_IN_MSECS;
#endif /* !ACE_LACKS_FLOATING_POINT */
}
- // if We are the high priority client.
- // if tryacquire() succeeded then a client must have done a
- // release () on it, thus we decrement the client counter.
- if (id_ == 0 && ts_->thread_count_ > 1)
- {
- if (ts_->semaphore_->tryacquire () != -1)
- {
- low_priority_client_count --;
- // if all clients are done then break out of loop.
- if (low_priority_client_count <= 0)
- break;
- }
- }
+ if ( ts_->thread_per_rate_ == 1 && id_ < (ts_->thread_count_ - 1) )
+ {
+ if (ts_->semaphore_->tryacquire () != -1)
+ break;
+ }
+ else
+ // if We are the high priority client.
+ // if tryacquire() succeeded then a client must have done a
+ // release () on it, thus we decrement the client counter.
+ if (id_ == 0 && ts_->thread_count_ > 1)
+ {
+ if (ts_->semaphore_->tryacquire () != -1)
+ {
+ low_priority_client_count --;
+ // if all clients are done then break out of loop.
+ if (low_priority_client_count <= 0)
+ break;
+ }
+ }
}
if (id_ == 0)
@@ -895,7 +914,7 @@ Client::run_tests (Cubit_ptr cb,
1 / latency));
this->put_latency (my_jitter_array,
- latency * 1000,
+ latency * ACE_ONE_SECOND_IN_MSECS,
thread_id);
#endif /* ! ACE_LACKS_FLOATING_POINT */
}
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
index 68f8227e1e4..9ab1282cd55 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -16,6 +16,10 @@
#include "client.h"
#include "ace/Sched_Params.h"
+#if defined (ACE_QUANTIFY)
+#include "quantify.h"
+#endif /* ACE_QUANTIFY */
+
double csw = 0.0;
#if defined (VXWORKS)
@@ -53,6 +57,48 @@ initialize (void)
return 0;
}
+void
+output_latency (Task_State &ts)
+{
+ FILE *latency_file_handle = 0;
+ char latency_file[BUFSIZ];
+ char buffer[BUFSIZ];
+
+ ACE_OS::sprintf (latency_file,
+ "cb__%d.txt",
+ ts.thread_count_);
+
+ ACE_OS::fprintf(stderr,
+ "--->Output file for latency data is \"%s\"\n",
+ latency_file);
+
+ latency_file_handle = ACE_OS::fopen (latency_file, "w");
+
+ // 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 ++)
+ {
+ ACE_OS::sprintf(buffer+strlen(buffer),
+#if defined (CHORUS)
+ "\t%u\n",
+#else
+ "\t%f\n",
+#endif /* !CHORUS */
+ ts.global_jitter_array_[j][i]);
+ fputs (buffer, latency_file_handle);
+ buffer[0]=0;
+ }
+ }
+
+ ACE_OS::fclose (latency_file_handle);
+}
+
int
do_priority_inversion_test (ACE_Thread_Manager &thread_manager,
Task_State &ts)
@@ -252,6 +298,11 @@ do_priority_inversion_test (ACE_Thread_Manager &thread_manager,
// any further.
ts.barrier_->wait ();
+#if defined (ACE_QUANTIFY)
+ quantify_stop_recording_data();
+ quantify_clear_data ();
+#endif /* ACE_QUANTIFY */
+
#if (defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)) && !defined (ACE_WIN32)
ACE_Profile_Timer timer_for_context_switch;
ACE_Profile_Timer::Rusage usage;
@@ -279,6 +330,10 @@ do_priority_inversion_test (ACE_Thread_Manager &thread_manager,
// Wait for all the client threads to exit (except the utilization thread).
thread_manager.wait ();
+#if defined (ACE_QUANTIFY)
+ quantify_stop_recording_data();
+#endif /* ACE_QUANTIFY */
+
ACE_DEBUG ((LM_DEBUG, "(%P|%t) >>>>>>> ending test on %D\n"));
if (ts.use_utilization_test_ == 1)
@@ -334,39 +389,8 @@ do_priority_inversion_test (ACE_Thread_Manager &thread_manager,
// output the latency values to a file, tab separated, to import it
// to Excel to calculate jitter, in the mean time we come up with
// the sqrt() function.
- FILE *latency_file_handle = 0;
- char latency_file[BUFSIZ];
- char buffer[BUFSIZ];
-
- ACE_OS::sprintf (latency_file,
- "cb__%d.txt",
- ts.thread_count_);
-
- ACE_OS::fprintf(stderr,
- "--->Output file for latency data is \"%s\"\n",
- latency_file);
-
- latency_file_handle = ACE_OS::fopen (latency_file, "w");
+ output_latency (ts);
- // 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 ++)
- {
- ACE_OS::sprintf(buffer+strlen(buffer),
- "\t%f\n",
- ts.global_jitter_array_[j][i]);
- fputs (buffer, latency_file_handle);
- buffer[0]=0;
- }
- }
-
- ACE_OS::fclose (latency_file_handle);
#elif defined (CHORUS)
ACE_DEBUG ((LM_DEBUG,
"Test done.\n"
@@ -378,39 +402,7 @@ do_priority_inversion_test (ACE_Thread_Manager &thread_manager,
// output the latency values to a file, tab separated, to import it
// to Excel to calculate jitter, in the mean time we come up with
// the sqrt() function.
- FILE *latency_file_handle = 0;
- char latency_file[BUFSIZ];
- char buffer[BUFSIZ];
-
- ACE_OS::sprintf (latency_file,
- "cb__%d.txt",
- ts.thread_count_);
-
- ACE_OS::fprintf(stderr,
- "--->Output file for latency data is \"%s\"\n",
- latency_file);
-
- latency_file_handle = ACE_OS::fopen (latency_file, "w");
-
- // 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 < ts.loop_count_/ts.granularity_; i ++)
- {
- ACE_OS::sprintf(buffer+strlen(buffer),
- "\t%u\n",
- ts.global_jitter_array_[j][i]);
- fputs (buffer, latency_file_handle);
- buffer[0]=0;
- }
- }
-
- ACE_OS::fclose (latency_file_handle);
+ output_latency (ts);
#else /* !CHORUS */
ACE_DEBUG ((LM_DEBUG, "Test done.\n"
"High priority client latency : %f msec, jitter: %f msec\n"
@@ -424,6 +416,7 @@ do_priority_inversion_test (ACE_Thread_Manager &thread_manager,
context_switch,
csw/1000,
csw * context_switch/1000 ));
+ output_latency (ts);
#endif /* !VXWORKS && !CHORUS */
// This loop visits each client. thread_count_ is the number of clients.
@@ -549,6 +542,7 @@ do_thread_per_rate_test (ACE_Thread_Manager &thread_manager,
// Wait for all the threads to exit.
thread_manager.wait ();
+#if defined (ACE_LACKS_FLOATING_POINT)
ACE_DEBUG ((LM_DEBUG,
"Test done.\n"
"40Hz client latency : %u usec\n"
@@ -561,6 +555,20 @@ do_thread_per_rate_test (ACE_Thread_Manager &thread_manager,
CB_10Hz_client.get_latency (2),
CB_5Hz_client.get_latency (3),
CB_1Hz_client.get_latency (4)));
+#else
+ ACE_DEBUG ((LM_DEBUG,
+ "Test done.\n"
+ "40Hz client latency : %f msec\n"
+ "20Hz client latency : %f msec\n"
+ "10Hz client latency : %f msec\n"
+ "5Hz client latency : %f msec\n"
+ "1Hz client latency : %f msec\n",
+ CB_40Hz_client.get_latency (0),
+ CB_20Hz_client.get_latency (1),
+ CB_10Hz_client.get_latency (2),
+ CB_5Hz_client.get_latency (3),
+ CB_1Hz_client.get_latency (4)));
+#endif /* ! ACE_LACKS_FLOATING_POINT */
return 0;
}
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
index 76e4bf9914a..0e7b12bb461 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -16,6 +16,10 @@
#include "server.h"
#include "ace/Sched_Params.h"
+#if defined (ACE_QUANTIFY)
+#include "quantify.h"
+#endif /* ACE_QUANTIFY */
+
// Global options used to configure various parameters.
static char hostname[BUFSIZ];
static char *ior_file = 0;
@@ -666,8 +670,19 @@ main (int argc, char *argv[])
ACE_DEBUG ((LM_DEBUG,
"Wait for all the threads to exit\n"));
+#if defined (ACE_QUANTIFY)
+ quantify_stop_recording_data();
+ quantify_clear_data ();
+ quantify_start_recording_data();
+#endif /* ACE_QUANTIFY */
+
// Wait for all the threads to exit.
ACE_Thread_Manager::instance ()->wait ();
+
+#if defined (ACE_QUANTIFY)
+ quantify_stop_recording_data();
+#endif /* ACE_QUANTIFY */
+
#else
ACE_DEBUG ((LM_DEBUG,
"Test not run. This platform doesn't seem to have threads.\n"));