summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-04 00:43:14 +0000
committersergio <sergio@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-04 00:43:14 +0000
commit31b22722dc812c0fee524286fb292a5f5ebfc5d8 (patch)
tree1eb678be9c70825c80657a82b8d118a443b97d56
parent7a1bbe554e1e2471b858e07761a220b7d07163ae (diff)
downloadATCD-31b22722dc812c0fee524286fb292a5f5ebfc5d8.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-98c8
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp47
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h7
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp54
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp2
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp47
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h7
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/client.cpp54
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/server.cpp2
9 files changed, 158 insertions, 70 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 5e63b7e0834..83593669bc6 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,11 @@
+Fri Apr 3 18:40:49 1998 Sergio Flores <sergio@polka.cs.wustl.edu>
+
+ * tests/Cubit/TAO/MT_Cubit/client.cpp:
+ * tests/Cubit/TAO/MT_Cubit/server.cpp:
+ * tests/Cubit/TAO/MT_Cubit/Task_Client.h:
+ * tests/Cubit/TAO/MT_Cubit/Task_Client.cpp: Minor changes for
+ Chorus. Cleanup code.
+
Fri Apr 3 18:39:21 1998 Steve Huston <shuston@riverace.com>
* tests/POA/On_Demand_Activation/Makefile: Changed LSRC to SRC to
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 9fd92b1b6ab..bb7ce38b643 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -16,14 +16,18 @@ Task_State::Task_State (int argc, char **argv)
shutdown_ (0),
oneway_ (0),
use_name_service_ (1),
- ior_file_ (0)
+ ior_file_ (0),
+ use_sysbench_ (0)
{
- ACE_Get_Opt opts (argc, argv, "sn:t:d:rk:xof:");
+ ACE_Get_Opt opts (argc, argv, "sn:t:d:rk:xof:y");
int c;
int datatype;
while ((c = opts ()) != -1)
switch (c) {
+ case 'y':
+ use_sysbench_ = 1;
+ break;
case 's':
use_name_service_ = 0;
break;
@@ -115,8 +119,6 @@ Task_State::Task_State (int argc, char **argv)
double [thread_count_]);
ACE_NEW (global_jitter_array_,
double *[thread_count_]);
- ACE_NEW (ave_latency_,
- int [thread_count_]);
}
Client::Client (Task_State *ts)
@@ -126,14 +128,6 @@ Client::Client (Task_State *ts)
}
void
-Client::put_ave_latency (int ave_latency, u_int thread_id)
-{
- ACE_MT (ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, ts_->lock_));
-
- ts_->ave_latency_[thread_id] = ave_latency;
-}
-
-void
Client::put_latency (double *jitter,
double latency,
u_int thread_id)
@@ -174,7 +168,7 @@ Client::get_low_priority_latency (void)
int
Client::get_latency (u_int thread_id)
{
- return ts_->ave_latency_[thread_id];
+ return ts_->latency_ [thread_id];
}
double
@@ -572,9 +566,13 @@ Client::run_tests (Cubit_ptr cb,
// Elapsed time will be in microseconds.
ACE_Time_Value delta_t;
- timer_.start ();
- // ACE_OS::ACE_HRTIMER_START; not using sysBench when CHORUS
- // defined.
+ // use sysBench when CHORUS defined and option specified on command line
+#if defined (CHORUS)
+ if (ts_->use_sysbench_ == 1)
+ timer_.start (ACE_OS::ACE_HRTIMER_START);
+ else
+#endif /* CHORUS */
+ timer_.start ();
if (ts_->oneway_ == 0)
{
@@ -765,8 +763,15 @@ Client::run_tests (Cubit_ptr cb,
}
}
- timer_.stop ();
- // ACE_OS::ACE_HRTIMER_STOP; not using sysBench when CHORUS defined
+ // use sysBench when CHORUS defined and option specified on command line
+#if defined (CHORUS)
+ if (ts_->use_sysbench_ == 1)
+ timer_.stop (ACE_OS::ACE_HRTIMER_STOP);
+ else
+#endif /* CHORUS */
+ // if CHORUS is not defined just use plain timer_.stop ().
+ timer_.stop ();
+
timer_.elapsed_time (delta_t);
double real_time = 0.0;
@@ -794,12 +799,10 @@ Client::run_tests (Cubit_ptr cb,
if (error_count == 0)
{
#if defined (ACE_LACKS_FLOATING_POINT)
- double tmp = latency / ACE_ONE_SECOND_IN_USECS;
- // printf("latency=%u, tmp=%u, call_count=%u, \n", latency, tmp, call_count);
- double calls_per_second = call_count / tmp;
+ double calls_per_second = (call_count * ACE_ONE_SECOND_IN_USECS) / latency;
#endif /* ACE_LACKS_FLOATING_POINT */
- latency /= call_count;
+ latency /= call_count; // calc average latency
if (latency > 0)
{
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 ae826e50d14..b7ef4352b82 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h
@@ -159,6 +159,10 @@ public:
char *ior_file_;
// Name of the filename that the server used to store the iors.
+
+ u_int use_sysbench_;
+ // flag that indicates that we are going to use the sysBench() call
+ // to time calls. This only applies to the CHORUS ClassiX OS.
};
class Client : public ACE_Task<ACE_SYNCH>
@@ -196,9 +200,6 @@ private:
u_int);
// Records the latencies in the <Task_State>.
- void put_ave_latency (int latency, u_int);
- // Records the latencies in the <Task_State>.
-
int parse_args (int, char **);
// Parses the arguments.
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
index b7d7648e964..1f44bed5f70 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -48,6 +48,7 @@ do_priority_inversion_test (Task_State &ts)
Util_Thread util_thread (&ts, &thr_mgr);
+ // The minimum priority thread is the utilization thread.
ACE_Sched_Priority priority =
ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
ACE_SCOPE_THREAD);
@@ -71,9 +72,12 @@ do_priority_inversion_test (Task_State &ts)
"activate failed",
priority));
- priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
- priority,
- ACE_SCOPE_THREAD);
+ // Drop the priority, so that the priority of clients will increase
+ // with increasing client number.
+ for (int i = 0; i < ts.thread_count_; i++)
+ priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
+ priority,
+ ACE_SCOPE_THREAD);
ACE_DEBUG ((LM_DEBUG,
"Creating %d clients with low priority of %d\n",
@@ -82,13 +86,8 @@ do_priority_inversion_test (Task_State &ts)
for (u_int i = 0; i < ts.thread_count_ - 1; i++)
{
- // The first thread starts at min + 1, since the minimum
- // priority thread is the utilization thread.
-
- // Get the next lower priority.
- priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
- priority,
- ACE_SCOPE_THREAD);
+ // The first thread starts at the lowest priority of all the low
+ // priority clients.
if (low_priority_client.activate (THR_BOUND,
1,
1,
@@ -97,6 +96,11 @@ do_priority_inversion_test (Task_State &ts)
"%p; priority is %d\n",
"activate failed",
priority));
+
+ // Get the next higher priority.
+ priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
+ priority,
+ ACE_SCOPE_THREAD);
}
// Wait for all the threads to exit (except the utilization thread).
@@ -113,6 +117,36 @@ do_priority_inversion_test (Task_State &ts)
"Low priority client latency : %u usec\n",
high_priority_client.get_high_priority_latency (),
low_priority_client.get_low_priority_latency ());
+
+ // 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];
+
+ sprintf (latency_file,
+ "cb%d%s%d.txt",
+ ACE_OS::getpid (),
+ ts.use_sysbench_ == 1? "SB": "__",
+ ts.thread_count_);
+ printf("--->Output file for latency data is \"%s\"\n",latency_file);
+
+ latency_file_handle = fopen (latency_file, "w");
+
+ for (u_int j = 0; j < ts.start_count_; j ++)
+ {
+ sprintf(buffer, "%s #%d", j==0? "High Priority": "Low Priority", j);
+ for (u_int i = 0; i < ts.loop_count_; i ++)
+ {
+ 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);
+
#else /* !defined (CHORUS) */
ACE_DEBUG ((LM_DEBUG, "Test done.\n"
"High priority client latency : %f msec, jitter: %f msec\n"
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
index 830f7344cc8..ad072424ee9 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -565,6 +565,7 @@ parse_args (int argc, char *argv[])
" [-p <port>]"
" [-h <my_hostname>]"
" [-t <num_objects>]"
+ " [-f <ior_file>]"
"\n", argv [0]),
1);
}
@@ -614,6 +615,7 @@ initialize (int argc, char **argv)
" [-p port]"
" [-h my_hostname]"
" [-t num_objects]"
+ " [-f <ior_file>]"
"\n", argv [0]),
1);
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
index 9fd92b1b6ab..bb7ce38b643 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -16,14 +16,18 @@ Task_State::Task_State (int argc, char **argv)
shutdown_ (0),
oneway_ (0),
use_name_service_ (1),
- ior_file_ (0)
+ ior_file_ (0),
+ use_sysbench_ (0)
{
- ACE_Get_Opt opts (argc, argv, "sn:t:d:rk:xof:");
+ ACE_Get_Opt opts (argc, argv, "sn:t:d:rk:xof:y");
int c;
int datatype;
while ((c = opts ()) != -1)
switch (c) {
+ case 'y':
+ use_sysbench_ = 1;
+ break;
case 's':
use_name_service_ = 0;
break;
@@ -115,8 +119,6 @@ Task_State::Task_State (int argc, char **argv)
double [thread_count_]);
ACE_NEW (global_jitter_array_,
double *[thread_count_]);
- ACE_NEW (ave_latency_,
- int [thread_count_]);
}
Client::Client (Task_State *ts)
@@ -126,14 +128,6 @@ Client::Client (Task_State *ts)
}
void
-Client::put_ave_latency (int ave_latency, u_int thread_id)
-{
- ACE_MT (ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, ts_->lock_));
-
- ts_->ave_latency_[thread_id] = ave_latency;
-}
-
-void
Client::put_latency (double *jitter,
double latency,
u_int thread_id)
@@ -174,7 +168,7 @@ Client::get_low_priority_latency (void)
int
Client::get_latency (u_int thread_id)
{
- return ts_->ave_latency_[thread_id];
+ return ts_->latency_ [thread_id];
}
double
@@ -572,9 +566,13 @@ Client::run_tests (Cubit_ptr cb,
// Elapsed time will be in microseconds.
ACE_Time_Value delta_t;
- timer_.start ();
- // ACE_OS::ACE_HRTIMER_START; not using sysBench when CHORUS
- // defined.
+ // use sysBench when CHORUS defined and option specified on command line
+#if defined (CHORUS)
+ if (ts_->use_sysbench_ == 1)
+ timer_.start (ACE_OS::ACE_HRTIMER_START);
+ else
+#endif /* CHORUS */
+ timer_.start ();
if (ts_->oneway_ == 0)
{
@@ -765,8 +763,15 @@ Client::run_tests (Cubit_ptr cb,
}
}
- timer_.stop ();
- // ACE_OS::ACE_HRTIMER_STOP; not using sysBench when CHORUS defined
+ // use sysBench when CHORUS defined and option specified on command line
+#if defined (CHORUS)
+ if (ts_->use_sysbench_ == 1)
+ timer_.stop (ACE_OS::ACE_HRTIMER_STOP);
+ else
+#endif /* CHORUS */
+ // if CHORUS is not defined just use plain timer_.stop ().
+ timer_.stop ();
+
timer_.elapsed_time (delta_t);
double real_time = 0.0;
@@ -794,12 +799,10 @@ Client::run_tests (Cubit_ptr cb,
if (error_count == 0)
{
#if defined (ACE_LACKS_FLOATING_POINT)
- double tmp = latency / ACE_ONE_SECOND_IN_USECS;
- // printf("latency=%u, tmp=%u, call_count=%u, \n", latency, tmp, call_count);
- double calls_per_second = call_count / tmp;
+ double calls_per_second = (call_count * ACE_ONE_SECOND_IN_USECS) / latency;
#endif /* ACE_LACKS_FLOATING_POINT */
- latency /= call_count;
+ latency /= call_count; // calc average latency
if (latency > 0)
{
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
index ae826e50d14..b7ef4352b82 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
@@ -159,6 +159,10 @@ public:
char *ior_file_;
// Name of the filename that the server used to store the iors.
+
+ u_int use_sysbench_;
+ // flag that indicates that we are going to use the sysBench() call
+ // to time calls. This only applies to the CHORUS ClassiX OS.
};
class Client : public ACE_Task<ACE_SYNCH>
@@ -196,9 +200,6 @@ private:
u_int);
// Records the latencies in the <Task_State>.
- void put_ave_latency (int latency, u_int);
- // Records the latencies in the <Task_State>.
-
int parse_args (int, char **);
// Parses the arguments.
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
index b7d7648e964..1f44bed5f70 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/client.cpp
@@ -48,6 +48,7 @@ do_priority_inversion_test (Task_State &ts)
Util_Thread util_thread (&ts, &thr_mgr);
+ // The minimum priority thread is the utilization thread.
ACE_Sched_Priority priority =
ACE_Sched_Params::priority_min (ACE_SCHED_FIFO,
ACE_SCOPE_THREAD);
@@ -71,9 +72,12 @@ do_priority_inversion_test (Task_State &ts)
"activate failed",
priority));
- priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
- priority,
- ACE_SCOPE_THREAD);
+ // Drop the priority, so that the priority of clients will increase
+ // with increasing client number.
+ for (int i = 0; i < ts.thread_count_; i++)
+ priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
+ priority,
+ ACE_SCOPE_THREAD);
ACE_DEBUG ((LM_DEBUG,
"Creating %d clients with low priority of %d\n",
@@ -82,13 +86,8 @@ do_priority_inversion_test (Task_State &ts)
for (u_int i = 0; i < ts.thread_count_ - 1; i++)
{
- // The first thread starts at min + 1, since the minimum
- // priority thread is the utilization thread.
-
- // Get the next lower priority.
- priority = ACE_Sched_Params::previous_priority (ACE_SCHED_FIFO,
- priority,
- ACE_SCOPE_THREAD);
+ // The first thread starts at the lowest priority of all the low
+ // priority clients.
if (low_priority_client.activate (THR_BOUND,
1,
1,
@@ -97,6 +96,11 @@ do_priority_inversion_test (Task_State &ts)
"%p; priority is %d\n",
"activate failed",
priority));
+
+ // Get the next higher priority.
+ priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO,
+ priority,
+ ACE_SCOPE_THREAD);
}
// Wait for all the threads to exit (except the utilization thread).
@@ -113,6 +117,36 @@ do_priority_inversion_test (Task_State &ts)
"Low priority client latency : %u usec\n",
high_priority_client.get_high_priority_latency (),
low_priority_client.get_low_priority_latency ());
+
+ // 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];
+
+ sprintf (latency_file,
+ "cb%d%s%d.txt",
+ ACE_OS::getpid (),
+ ts.use_sysbench_ == 1? "SB": "__",
+ ts.thread_count_);
+ printf("--->Output file for latency data is \"%s\"\n",latency_file);
+
+ latency_file_handle = fopen (latency_file, "w");
+
+ for (u_int j = 0; j < ts.start_count_; j ++)
+ {
+ sprintf(buffer, "%s #%d", j==0? "High Priority": "Low Priority", j);
+ for (u_int i = 0; i < ts.loop_count_; i ++)
+ {
+ 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);
+
#else /* !defined (CHORUS) */
ACE_DEBUG ((LM_DEBUG, "Test done.\n"
"High priority client latency : %f msec, jitter: %f msec\n"
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
index 830f7344cc8..ad072424ee9 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -565,6 +565,7 @@ parse_args (int argc, char *argv[])
" [-p <port>]"
" [-h <my_hostname>]"
" [-t <num_objects>]"
+ " [-f <ior_file>]"
"\n", argv [0]),
1);
}
@@ -614,6 +615,7 @@ initialize (int argc, char **argv)
" [-p port]"
" [-h my_hostname]"
" [-t num_objects]"
+ " [-f <ior_file>]"
"\n", argv [0]),
1);