summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp')
-rw-r--r--TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp1043
1 files changed, 412 insertions, 631 deletions
diff --git a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp
index 659acf576bb..ccaf3b5d361 100644
--- a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp
@@ -126,26 +126,19 @@ Cubit_Client::read_ior (const char *filename)
this->f_handle_ = ACE_OS::open (filename,0);
if (this->f_handle_ == ACE_INVALID_HANDLE)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "Unable to open <%s> for reading: %p\n",
- filename),
- -1);
- }
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open <%s> for reading: %p\n",
+ filename),
+ -1);
ACE_Read_Buffer ior_buffer (this->f_handle_);
-
char *data = ior_buffer.read ();
if (data == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "Unable to allocate memory to read ior: %p\n"),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to allocate memory to read ior: %p\n"),
+ -1);
this->cubit_factory_key_ = ACE_OS::strdup (data);
-
ior_buffer.alloc ()->free (data);
return 0;
@@ -173,15 +166,8 @@ Cubit_Client::parse_args (void)
TAO_debug_level++;
break;
case 'n': // loop count
- result = ACE_OS::atoi (get_opts.optarg);
-
- if (result <= 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Invalid number of iterations entered: <%s>\n",
- get_opts.optarg),
- -1);
- else
- this->loop_count_ = (u_int) result;
+ this->loop_count_ =
+ (u_int) ACE_OS::atoi (get_opts.optarg);
break;
case 'f': // read the IOR from the file.
result = this->read_ior (get_opts.optarg);
@@ -189,7 +175,7 @@ Cubit_Client::parse_args (void)
ACE_ERROR_RETURN ((LM_ERROR,
"Unable to read ior from <%s> : %p\n",
get_opts.optarg,
- ""),
+ ""),
-1);
break;
case 'k': // read the cubit IOR from the command-line.
@@ -224,25 +210,28 @@ Cubit_Client::parse_args (void)
void
Cubit_Client::cube_union (CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- Cubit::oneof u;
+ CORBA::Environment env;
+ Cubit::oneof u;
- this->call_count_++;
+ this->call_count_++;
- u.l (3); // use the long union branch.
+ u.l (3); // use the long union branch.
- // Cube a "union" ...
- Cubit::oneof r;
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_UNION_START);
+ // Cube a "union" ...
+ Cubit::oneof r;
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_UNION_START);
- r = this->cubit_->cube_union (u,
- ACE_TRY_ENV);
- }
-
- ACE_TRY_CHECK;
+ r = this->cubit_->cube_union (u, ACE_TRY_ENV);
+ }
+ if (ACE_TRY_ENV.exception () != 0)
+ {
+ ACE_TRY_ENV.print_exception ("from cube_union");
+ this->error_count_++;
+ }
+ else
+ {
if (TAO_debug_level > 2)
ACE_DEBUG ((LM_DEBUG, "cube union ..."));
u.l (u.l () * u.l () * u.l ()) ;
@@ -253,24 +242,35 @@ Cubit_Client::cube_union (CORBA::Environment &ACE_TRY_ENV)
this->error_count_++;
}
- this->call_count_++;
+ }
- u._d (Cubit::e_3rd);
+ this->call_count_++;
- u.cm ().l = 7;
- u.cm ().s = 5;
- u.cm ().o = 3;
+ u._d (Cubit::e_3rd);
+#if 0
+ u.cm ().l = this->func (i);
+ u.cm ().s = this->func (i);
+ u.cm ().o = this->func (i);
+#endif
- // Cube another "union" which uses the default arm ... NOT tested yet
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_UNION_START);
+ u.cm ().l = 7;
+ u.cm ().s = 5;
+ u.cm ().o = 3;
- r = this->cubit_->cube_union (u,
- ACE_TRY_ENV);
- }
+ // Cube another "union" which uses the default arm ... NOT tested yet
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_UNION_START);
- ACE_TRY_CHECK;
+ r = this->cubit_->cube_union (u, ACE_TRY_ENV);
+ }
+ if (ACE_TRY_ENV.exception () != 0)
+ {
+ ACE_TRY_ENV.print_exception ("from cube_union");
+ this->error_count_++;
+ }
+ else
+ {
if (TAO_debug_level > 2)
ACE_DEBUG ((LM_DEBUG, "cube union ..."));
u.cm ().l = u.cm ().l * u.cm ().l * u.cm ().l;
@@ -285,14 +285,6 @@ Cubit_Client::cube_union (CORBA::Environment &ACE_TRY_ENV)
this->error_count_++;
}
}
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_union");
- this->error_count_++;
- }
- ACE_ENDTRY;
- ACE_CHECK;
}
// Cube a short.
@@ -301,30 +293,30 @@ void
Cubit_Client::cube_short (int i,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- CORBA::Short arg_short = this->func (i);
+ CORBA::Short arg_short = this->func (i);
- // Cube a short.
- CORBA::Short ret_short;
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_SHORT_START);
+ // Cube a short.
+ CORBA::Short ret_short;
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_SHORT_START);
- ret_short = cubit_->cube_short (arg_short,
- ACE_TRY_ENV);
- }
+ ret_short = cubit_->cube_short (arg_short, ACE_TRY_ENV);
+ }
- ACE_TRY_CHECK;
-
- this->call_count_++;
+ this->call_count_++;
+ if (ACE_TRY_ENV.exception () != 0)
+ {
+ ACE_TRY_ENV.print_exception ("from cube_short");
+ this->error_count_++;
+ }
+ else
+ {
if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- "cube short: %d --> %d\n",
- arg_short,
- ret_short));
- }
+ ACE_DEBUG ((LM_DEBUG,
+ "cube short: %d --> %d\n",
+ arg_short,
+ ret_short));
arg_short = arg_short * arg_short * arg_short;
if (arg_short != ret_short)
@@ -332,18 +324,9 @@ Cubit_Client::cube_short (int i,
ACE_ERROR ((LM_ERROR, "** cube_short (%d) ERROR (--> %d)\n",
(CORBA::Short) this->func (i),
ret_short));
-
this->error_count_++;
}
}
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_short");
- this->error_count_++;
- }
- ACE_ENDTRY;
- ACE_CHECK;
}
// Oneway test.
@@ -352,52 +335,38 @@ void
Cubit_Client::cube_oneway (int,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_ONEWAY_START);
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_ONEWAY_START);
- this->cubit_->cube_oneway (ACE_TRY_ENV);
- }
+ this->cubit_->cube_oneway (ACE_TRY_ENV);
+ }
- ACE_TRY_CHECK;
+ this->call_count_++;
- this->call_count_++;
- }
- ACE_CATCHANY
+ if (ACE_TRY_ENV.exception () != 0)
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_oneway");
+ ACE_TRY_ENV.print_exception ("from cube_oneway");
this->error_count_++;
}
- ACE_ENDTRY;
- ACE_CHECK;
}
void
Cubit_Client::cube_void (int,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_VOID_START);
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_VOID_START);
- this->cubit_->cube_void (ACE_TRY_ENV);
- }
+ this->cubit_->cube_void (ACE_TRY_ENV);
+ }
- ACE_TRY_CHECK;
+ this->call_count_++;
- this->call_count_++;
- }
- ACE_CATCHANY
+ if (ACE_TRY_ENV.exception () != 0)
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_void");
+ ACE_TRY_ENV.print_exception ("from cube_void");
this->error_count_++;
}
- ACE_ENDTRY;
- ACE_CHECK;
}
// Cube an octet
@@ -406,50 +375,38 @@ void
Cubit_Client::cube_octet (int i,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- CORBA::Octet arg_octet = this->func (i);
-
- // Cube an octet.
- CORBA::Octet ret_octet;
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_OCTET_START);
+ CORBA::Octet arg_octet = this->func (i);
- ret_octet = this->cubit_->cube_octet (arg_octet,
- ACE_TRY_ENV);
- }
+ // Cube an octet.
+ CORBA::Octet ret_octet;
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_OCTET_START);
- ACE_TRY_CHECK;
+ ret_octet = this->cubit_->cube_octet (arg_octet, ACE_TRY_ENV);
+ }
- this->call_count_++;
+ this->call_count_++;
- if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- "cube octet: %d --> %d\n",
- arg_octet, ret_octet));
- }
-
- arg_octet = arg_octet * arg_octet * arg_octet;
-
- if (arg_octet != ret_octet)
- {
- ACE_DEBUG ((LM_DEBUG,
- "** cube_octet (%d) ERROR (--> %d)\n",
- (CORBA::Octet) this->func (i),
- ret_octet));
-
- this->error_count_++;
- }
- }
- ACE_CATCHANY
+ if (ACE_TRY_ENV.exception () != 0)
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_octet");
+ ACE_TRY_ENV.print_exception ("from cube_octet");
this->error_count_++;
}
- ACE_ENDTRY;
- ACE_CHECK;
+ else
+ {
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ "cube octet: %d --> %d\n",
+ arg_octet, ret_octet));
+ arg_octet = arg_octet * arg_octet * arg_octet;
+ if (arg_octet != ret_octet) {
+ ACE_DEBUG ((LM_DEBUG,
+ "** cube_octet (%d) ERROR (--> %d)\n",
+ (CORBA::Octet) this->func (i),
+ ret_octet));
+ this->error_count_++;
+ }
+ }
}
// calculate the cube from a long
@@ -458,31 +415,30 @@ void
Cubit_Client::cube_long (int i,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- CORBA::Long arg_long = this->func (i);
-
- // Cube a long.
- CORBA::Long ret_long;
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_LONG_START);
+ CORBA::Long arg_long = this->func (i);
- ret_long = this->cubit_->cube_long (arg_long,
- ACE_TRY_ENV);
- }
+ // Cube a long.
+ CORBA::Long ret_long;
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_LONG_START);
- ACE_TRY_CHECK;
+ ret_long = this->cubit_->cube_long (arg_long, ACE_TRY_ENV);
+ }
- this->call_count_++;
+ this->call_count_++;
+ if (ACE_TRY_ENV.exception () != 0)
+ {
+ ACE_TRY_ENV.print_exception ("from cube_long");
+ this->error_count_++;
+ }
+ else
+ {
if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- "cube long: %d --> %d\n",
- arg_long,
- ret_long));
- }
-
+ ACE_DEBUG ((LM_DEBUG,
+ "cube long: %d --> %d\n",
+ arg_long,
+ ret_long));
arg_long = arg_long * arg_long * arg_long;
if (arg_long != ret_long)
@@ -491,18 +447,9 @@ Cubit_Client::cube_long (int i,
"** cube_long (%ld) ERROR (--> %ld)\n",
(CORBA::Long) this->func (i),
ret_long));
-
this->error_count_++;
}
}
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_long");
- this->error_count_++;
- }
- ACE_ENDTRY;
- ACE_CHECK;
}
// Cube the numbers in a struct
@@ -511,33 +458,32 @@ void
Cubit_Client::cube_struct (int i,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- Cubit::Many arg_struct;
- Cubit::Many ret_struct;
-
- this->call_count_++;
+ Cubit::Many arg_struct;
+ Cubit::Many ret_struct;
- arg_struct.l = this->func (i);
- arg_struct.s = this->func (i);
- arg_struct.o = this->func (i);
+ this->call_count_++;
- // Cube a "struct" ...
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_STRUCT_START);
+ arg_struct.l = this->func (i);
+ arg_struct.s = this->func (i);
+ arg_struct.o = this->func (i);
- ret_struct = this->cubit_->cube_struct (arg_struct,
- ACE_TRY_ENV);
- }
+ // Cube a "struct" ...
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_STRUCT_START);
- ACE_TRY_CHECK;
+ ret_struct = this->cubit_->cube_struct (arg_struct, ACE_TRY_ENV);
+ }
+ if (ACE_TRY_ENV.exception () != 0)
+ {
+ ACE_TRY_ENV.print_exception ("from cube_struct");
+ this->error_count_++;
+ }
+ else
+ {
if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- "cube struct ..."));
- }
-
+ ACE_DEBUG ((LM_DEBUG,
+ "cube struct ..."));
arg_struct.l = arg_struct.l * arg_struct.l * arg_struct.l;
arg_struct.s = arg_struct.s * arg_struct.s * arg_struct.s;
arg_struct.o = arg_struct.o * arg_struct.o * arg_struct.o;
@@ -547,231 +493,239 @@ Cubit_Client::cube_struct (int i,
|| arg_struct.o != ret_struct.o)
{
ACE_ERROR ((LM_ERROR, "** cube_struct ERROR\n"));
-
this->error_count_++;
}
}
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_struct");
- this->error_count_++;
- }
- ACE_ENDTRY;
- ACE_CHECK;
}
// Cube the numbers in a sequence
void
-Cubit_Client::cube_long_sequence (int,
- int l,
+Cubit_Client::cube_long_sequence (int, int l,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- this->call_count_++;
+ this->call_count_++;
- Cubit::long_seq input (l);
- input.length (l);
+ Cubit::long_seq input (l);
+ input.length (l);
- // Just set the first item, otherwise it is hard to compare the
- // results for longer sequences, i.e. more than just marshalling
- // gets in the way.
- input[0] = 4;
+#if 0
+ // Fill in the input sequence...
+ for (int j = 0; j < l; ++j)
+ input[j] = j;
+#else
+ // Just set the first item, otherwise it is hard to compare the
+ // results for longer sequences, i.e. more than just marshalling
+ // gets in the way.
+ input[0] = 4;
+#endif
- Cubit::long_seq_var output;
- Cubit::long_seq_out vout (output);
+ Cubit::long_seq_var output;
+ Cubit::long_seq_out vout (output);
- // Cube the sequence
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_LONG_SEQUENCE_START);
+ // Cube the sequence
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_LONG_SEQUENCE_START);
- this->cubit_->cube_long_sequence (input,
- vout,
- ACE_TRY_ENV);
- }
+ this->cubit_->cube_long_sequence (input, vout, ACE_TRY_ENV);
+ }
- ACE_TRY_CHECK;
+ // Cubit::long_seq& output = *vout.ptr ();
+ // output = vout;
+ if (ACE_TRY_ENV.exception () != 0)
+ {
+ ACE_TRY_ENV.print_exception ("from cube_struct");
+ this->error_count_++;
+ }
+ else
+ {
if (output->length () != input.length ())
{
- ACE_ERROR ((LM_ERROR,
- "** cube sequence, wrong length\n"));
-
+ ACE_ERROR ((LM_ERROR, "** cube sequence, wrong length\n"));
this->error_count_++;
-
return;
}
u_int rl = output->length ();
-
if (input.length () < rl)
+ rl = input.length ();
+#if 0
+ for (u_int j = 0; j < rl; ++j)
{
- rl = input.length ();
+ CORBA::Long x = input[j];
+ if (x*x*x != output[j])
+ {
+ ACE_ERROR ((LM_ERROR, "** cube_long_sequence ERROR\n"));
+ this->error_count_++;
+ }
}
-
+#else
CORBA::Long x = input[0];
-
if (x * x *x != output[0])
{
- ACE_ERROR ((LM_ERROR,
- "** cube_long_sequence ERROR\n"));
-
+ ACE_ERROR ((LM_ERROR, "** cube_long_sequence ERROR\n"));
this->error_count_++;
}
+#endif
}
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_long_sequence");
- this->error_count_++;
- }
- ACE_ENDTRY;
- ACE_CHECK;
}
void
-Cubit_Client::cube_octet_sequence (int,
- int l,
+Cubit_Client::cube_octet_sequence (int, int l,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- this->call_count_++;
+ this->call_count_++;
- Cubit::octet_seq input (l);
- input.length (l);
+ Cubit::octet_seq input (l);
+ input.length (l);
- // Just set the first item, otherwise it is hard to compare the
- // results for longer sequences, i.e. more than just marshalling
- // gets in the way.
- input[0] = 4;
+#if 0
+ // Fill in the input sequence...
+ for (int j = 0; j < l; ++j)
+ input[j] = j;
+#else
+ // Just set the first item, otherwise it is hard to compare the
+ // results for longer sequences, i.e. more than just marshalling
+ // gets in the way.
+ input[0] = 4;
+#endif
- Cubit::octet_seq_var output;
- Cubit::octet_seq_out vout (output);
+ Cubit::octet_seq_var output;
+ Cubit::octet_seq_out vout (output);
- // Cube the sequence
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_OCTET_SEQUENCE_START);
+ // Cube the sequence
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_OCTET_SEQUENCE_START);
- this->cubit_->cube_octet_sequence (input,
- vout,
- ACE_TRY_ENV);
- }
+ this->cubit_->cube_octet_sequence (input, vout, ACE_TRY_ENV);
+ }
- ACE_TRY_CHECK;
+ // Cubit::long_seq& output = *vout.ptr ();
+ // output = vout;
+ if (ACE_TRY_ENV.exception () != 0)
+ {
+ ACE_TRY_ENV.print_exception ("from cube_struct");
+ this->error_count_++;
+ }
+ else
+ {
if (output->length () != input.length ())
{
- ACE_ERROR ((LM_ERROR,
- "** cube octet, wrong length\n"));
-
+ ACE_ERROR ((LM_ERROR, "** cube octet, wrong length\n"));
this->error_count_++;
-
return;
}
u_int rl = output->length ();
-
if (input.length () < rl)
+ rl = input.length ();
+#if 0
+ for (u_int j = 0; j < rl; ++j)
{
- rl = input.length ();
+ CORBA::Octet x = input[j];
+ if (x*x*x != output[j])
+ {
+ ACE_ERROR ((LM_ERROR, "** cube_octet ERROR\n"));
+ this->error_count_++;
+ }
}
+#else
CORBA::Octet x = input[0];
-
if (x * x *x != output[0])
{
- ACE_ERROR ((LM_ERROR,
- "** cube_octet ERROR\n"));
-
+ ACE_ERROR ((LM_ERROR, "** cube_octet ERROR\n"));
this->error_count_++;
}
+#endif
}
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_octet_sequence");
- this->error_count_++;
- }
- ACE_ENDTRY;
- ACE_CHECK;
}
// Cube the many in a sequence
void
-Cubit_Client::cube_many_sequence (int,
- int l,
+Cubit_Client::cube_many_sequence (int, int l,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- this->call_count_++;
-
- Cubit::many_seq input (l);
- input.length (l);
-
- // Just set the first item, otherwise it is hard to compare the
- // results for longer sequences, i.e. more than just marshalling
- // gets in the way.
- Cubit::Many &in = input[0];
- in.l = 4;
- in.s = 5;
- in.o = 6;
-
- Cubit::many_seq_var output;
- Cubit::many_seq_out vout (output);
-
- // Cube the sequence
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_MANY_SEQUENCE_START);
-
- this->cubit_->cube_many_sequence (input,
- vout,
- ACE_TRY_ENV);
- }
+ this->call_count_++;
- ACE_TRY_CHECK;
+ Cubit::many_seq input (l);
+ input.length (l);
+#if 0
+ // Fill in the input sequence...
+ for (int j = 0; j < l; ++j)
+ {
+ Cubit::Many &in = input[j];
+ in.l = j;
+ in.s = j;
+ in.o = j;
+ }
+#else
+ // Just set the first item, otherwise it is hard to compare the
+ // results for longer sequences, i.e. more than just marshalling
+ // gets in the way.
+ Cubit::Many &in = input[0];
+ in.l = 4;
+ in.s = 5;
+ in.o = 6;
+#endif
+
+ Cubit::many_seq_var output;
+ Cubit::many_seq_out vout (output);
+
+ // Cube the sequence
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_MANY_SEQUENCE_START);
+
+ this->cubit_->cube_many_sequence (input, vout, ACE_TRY_ENV);
+ }
+
+ if (ACE_TRY_ENV.exception () != 0)
+ {
+ ACE_TRY_ENV.print_exception ("from cube_many_sequence");
+ this->error_count_++;
+ }
+ else
+ {
if (output->length () != input.length ())
{
- ACE_ERROR ((LM_ERROR,
- "** cube sequence, wrong length\n"));
-
+ ACE_ERROR ((LM_ERROR, "** cube sequence, wrong length\n"));
this->error_count_++;
-
return;
}
u_int rl = output->length ();
-
if (input.length () < rl)
+ rl = input.length ();
+#if 0
+ for (u_int j = 0; j < rl; ++j)
{
- rl = input.length ();
- }
+ Cubit::Many &in = input[j];
+ Cubit::Many &out = output[j];
- Cubit::Many &ret_in = input[0];
+ if (in.l * in.l * in.l != out.l ||
+ in.s * in.s * in.s != out.s ||
+ in.o * in.o * in.o != out.o)
+ {
+ ACE_ERROR ((LM_ERROR, "** cube_long_sequence ERROR\n"));
+ this->error_count_++;
+ }
+ }
+#else
+ Cubit::Many &in = input[0];
Cubit::Many &out = output[0];
- if (ret_in.l * ret_in.l * ret_in.l != out.l ||
- ret_in.s * ret_in.s * ret_in.s != out.s ||
- ret_in.o * ret_in.o * ret_in.o != out.o)
+ if (in.l * in.l * in.l != out.l ||
+ in.s * in.s * in.s != out.s ||
+ in.o * in.o * in.o != out.o)
{
- ACE_ERROR ((LM_ERROR,
- "** cube_long_sequence ERROR\n"));
-
+ ACE_ERROR ((LM_ERROR, "** cube_long_sequence ERROR\n"));
this->error_count_++;
}
+#endif
}
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_many_sequence");
- this->error_count_++;
- }
- ACE_ENDTRY;
- ACE_CHECK;
}
void
@@ -780,88 +734,66 @@ Cubit_Client::cube_rti_data (int,
int numAttrs,
CORBA::Environment &ACE_TRY_ENV)
{
- ACE_TRY
- {
- this->call_count_++;
+ this->call_count_++;
- Cubit::RtiPacket input;
- input.packetHeader.packetLength = 1; // this is probably redundant
- input.packetHeader.federationHandle = 2;
- input.packetHeader.channelHandle = 3;
- input.packetHeader.packetColor = 4;
+ Cubit::RtiPacket input;
+ input.packetHeader.packetLength = 1; // this is probably redundant
+ input.packetHeader.federationHandle = 2;
+ input.packetHeader.channelHandle = 3;
+ input.packetHeader.packetColor = 4;
- input.msgs.length (numUpdates);
+ input.msgs.length (numUpdates);
- for (int j = 0; j < numUpdates; ++j)
- {
- input.msgs[j].oumh (Cubit::RtiObjectUpdateMessageHeader ());
- Cubit::RtiObjectUpdateMessageHeader & oumh = input.msgs[j].oumh ();
- oumh.updateLength = 2001; // redundant
- oumh.updateTag = 2002;
- oumh.objectHandle = 2003;
- oumh.timestamp = 3.14159;
- oumh.eventRetractionHandle = 2004;
- oumh.classHandle = 2005;
- oumh.sendingFederateHandle = 2006;
- oumh.userTag = CORBA::string_dup ("beefcake!");
- oumh.regionData.length(0);
- oumh.transportationHandle = 1;
- oumh.orderingHandle = 1;
- oumh.messagePayload.length (numAttrs);
-
- for (int k = 0; k < numAttrs; ++k)
- {
- oumh.messagePayload[k] = Cubit::HandleValuePair ();
- Cubit::HandleValuePair &hvp = oumh.messagePayload[k];
- hvp.handle = k * k;
- const char *d1 = "somedata";
- hvp.data.length (ACE_OS::strlen (d1)+1);
- ACE_OS::strcpy ((char *) hvp.data.get_buffer (), d1);
- }
- }
-
- Cubit::RtiPacket_var output;
- Cubit::RtiPacket_out vout (output);
-
- // Cube the sequence
- if (TAO_debug_level > 0)
+ for (int j = 0; j < numUpdates; ++j)
+ {
+ input.msgs[j].oumh (Cubit::RtiObjectUpdateMessageHeader ());
+ Cubit::RtiObjectUpdateMessageHeader & oumh = input.msgs[j].oumh ();
+ oumh.updateLength = 2001; // redundant
+ oumh.updateTag = 2002;
+ oumh.objectHandle = 2003;
+ oumh.timestamp = 3.14159;
+ oumh.eventRetractionHandle = 2004;
+ oumh.classHandle = 2005;
+ oumh.sendingFederateHandle = 2006;
+ oumh.userTag = CORBA::string_dup ("beefcake!");
+ oumh.regionData.length(0);
+ oumh.transportationHandle = 1;
+ oumh.orderingHandle = 1;
+ oumh.messagePayload.length (numAttrs);
+
+ for (int k = 0; k < numAttrs; ++k)
{
- ACE_DEBUG ((LM_DEBUG,
- "Input: \n"));
-
- print_RtiPacket (input);
+ oumh.messagePayload[k] = Cubit::HandleValuePair ();
+ Cubit::HandleValuePair &hvp = oumh.messagePayload[k];
+ hvp.handle = k * k;
+ const char *d1 = "somedata";
+ hvp.data.length (ACE_OS::strlen (d1)+1);
+ ACE_OS::strcpy ((char *) hvp.data.get_buffer (), d1);
}
+ }
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_RTI_DATA_START);
-
- this->cubit_->cube_rti_data (input,
- vout,
- ACE_TRY_ENV);
- }
-
- ACE_TRY_CHECK;
+ Cubit::RtiPacket_var output;
+ Cubit::RtiPacket_out vout (output);
- if (TAO_debug_level > 0)
+ // Cube the sequence
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Input: \n"));
+ print_RtiPacket (input);
+ }
- {
- ACE_DEBUG ((LM_DEBUG,
- "Output: \n"));
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_RTI_DATA_START);
- print_RtiPacket (*vout.ptr ());
+ this->cubit_->cube_rti_data (input, vout, ACE_TRY_ENV);
+ }
+ if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "need to check whether cubing happened\n"));
- }
- }
- ACE_CATCHANY
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "from cube_rtti_data");
- this->error_count_++;
+ ACE_DEBUG ((LM_DEBUG, "Output: \n"));
+ print_RtiPacket (*vout.ptr ());
+ ACE_DEBUG ((LM_DEBUG,"need to check whether cubing happened\n"));
}
- ACE_ENDTRY;
- ACE_CHECK;
}
void
@@ -917,7 +849,8 @@ Cubit_Client::print_stats (const char *call_name,
int
Cubit_Client::run ()
{
- ACE_DECLARE_NEW_CORBA_ENV;
+ // @@
+ CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ();
if (this->only_void_)
return this->run_void (ACE_TRY_ENV);
@@ -937,265 +870,155 @@ Cubit_Client::run ()
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_void (i,
- ACE_TRY_ENV);
- }
-
+ this->cube_void (i, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_void",
- elapsed_time);
+ this->print_stats ("cube_void", elapsed_time);
// SHORT
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_short (i,
- ACE_TRY_ENV);
- }
-
+ this->cube_short (i, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_short",
- elapsed_time);
+ this->print_stats ("cube_short", elapsed_time);
// OCTET
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_octet (i,
- ACE_TRY_ENV);
- }
-
+ this->cube_octet (i, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_octet",
- elapsed_time);
+ this->print_stats ("cube_octet", elapsed_time);
// LONG
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_long (i,
- ACE_TRY_ENV);
- }
-
+ this->cube_long (i, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
- this->print_stats ("cube_long",
- elapsed_time);
+ this->print_stats ("cube_long", elapsed_time);
// STRUCT
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_struct (i,
- ACE_TRY_ENV);
- }
-
+ this->cube_struct (i, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_struct",
- elapsed_time);
+ this->print_stats ("cube_struct", elapsed_time);
// UNION
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_union (ACE_TRY_ENV);
- }
-
+ this->cube_union (ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_union_stub call",
- elapsed_time);
+ this->print_stats ("cube_union_stub call", elapsed_time);
// SMALL LONG SEQUENCES
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_long_sequence (this->loop_count_,
- 4,
- ACE_TRY_ENV);
- }
-
+ this->cube_long_sequence (this->loop_count_, 4, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_small_sequence<long>",
- elapsed_time);
+ this->print_stats ("cube_small_sequence<long>", elapsed_time);
// LARGE LONG SEQUENCES
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_long_sequence (this->loop_count_,
- 1024,
- ACE_TRY_ENV);
- }
-
+ this->cube_long_sequence (this->loop_count_, 1024, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_large_sequence<long>",
- elapsed_time);
+ this->print_stats ("cube_large_sequence<long>", elapsed_time);
// SMALL OCTET SEQUENCES
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_octet_sequence (this->loop_count_,
- 16,
- ACE_TRY_ENV);
- }
-
+ this->cube_octet_sequence (this->loop_count_, 16, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_small_sequence<octet>",
- elapsed_time);
+ this->print_stats ("cube_small_sequence<octet>", elapsed_time);
// LARGE OCTET SEQUENCES
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_octet_sequence (this->loop_count_,
- 4096,
- ACE_TRY_ENV);
- }
-
+ this->cube_octet_sequence (this->loop_count_, 4096, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_large_sequence<octet>",
- elapsed_time);
+ this->print_stats ("cube_large_sequence<octet>", elapsed_time);
// SMALL MANY SEQUENCES
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_many_sequence (this->loop_count_,
- 4,
- ACE_TRY_ENV);
- }
-
+ this->cube_many_sequence (this->loop_count_, 4, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_small_sequence<many>",
- elapsed_time);
+ this->print_stats ("cube_small_sequence<many>", elapsed_time);
// LARGE many SEQUENCES
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_many_sequence (this->loop_count_,
- 1024,
- ACE_TRY_ENV);
- }
-
+ this->cube_many_sequence (this->loop_count_, 1024, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_large_sequence<many>",
- elapsed_time);
+ this->print_stats ("cube_large_sequence<many>", elapsed_time);
// MIXIN
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
{
- this->cube_short (i,
- ACE_TRY_ENV);
- this->cube_octet (i,
- ACE_TRY_ENV);
- this->cube_long (i,
- ACE_TRY_ENV);
+ this->cube_short (i, ACE_TRY_ENV);
+ this->cube_octet (i, ACE_TRY_ENV);
+ this->cube_long (i, ACE_TRY_ENV);
}
-
timer.stop ();
timer.elapsed_time (elapsed_time);
- this->print_stats ("cube mixin (short/octet/long)",
- elapsed_time);
+ this->print_stats ("cube mixin (short/octet/long)", elapsed_time);
// RTI
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_rti_data (this->loop_count_,
- 2,
- 5,
- ACE_TRY_ENV);
- }
-
+ this->cube_rti_data (this->loop_count_, 2, 5, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_rti_data",
- elapsed_time);
+ this->print_stats ("cube_rti_data", elapsed_time);
// ONEWAY
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_oneway (i,
- ACE_TRY_ENV);
- }
-
+ this->cube_oneway (i, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_oneway",
- elapsed_time);
+ this->print_stats ("cube_oneway", elapsed_time);
this->shutdown_server (this->shutdown_,
ACE_TRY_ENV);
@@ -1216,12 +1039,10 @@ Cubit_Client::shutdown_server (int do_shutdown,
ACE_TRY
{
if (this->cubit_factory_key_ == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "%s: no cubit factory key specified\n",
- this->argv_[0]),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s: no cubit factory key specified\n",
+ this->argv_[0]),
+ -1);
CORBA::Object_var factory_object =
this->orb_->string_to_object (this->cubit_factory_key_,
@@ -1234,12 +1055,10 @@ Cubit_Client::shutdown_server (int do_shutdown,
ACE_TRY_CHECK;
if (CORBA::is_nil (this->factory_.in ()))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "invalid factory key <%s>\n",
- this->cubit_factory_key_),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "invalid factory key <%s>\n",
+ this->cubit_factory_key_),
+ -1);
this->cubit_ =
this->factory_->make_cubit (ACE_TRY_ENV);
@@ -1248,8 +1067,7 @@ Cubit_Client::shutdown_server (int do_shutdown,
this->cubit_->shutdown (ACE_TRY_ENV);
ACE_TRY_CHECK;
- ACE_DEBUG ((LM_DEBUG,
- "shutdown on shutdown object\n"));
+ ACE_DEBUG ((LM_DEBUG, "shutdown on shutdown object\n"));
}
ACE_CATCHANY
{
@@ -1262,9 +1080,7 @@ Cubit_Client::shutdown_server (int do_shutdown,
}
else if (do_shutdown)
{
- ACE_DEBUG ((LM_DEBUG,
- "shutdown on cubit object\n"));
-
+ ACE_DEBUG ((LM_DEBUG, "shutdown on cubit object\n"));
ACE_TRY_EX(NOT_COLLOCATED)
{
this->cubit_->shutdown (ACE_TRY_ENV);
@@ -1295,25 +1111,17 @@ Cubit_Client::run_oneway (CORBA::Environment &ACE_TRY_ENV)
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_oneway (i,
- ACE_TRY_ENV);
- }
-
+ this->cube_oneway (i, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_oneway",
- elapsed_time);
+ this->print_stats ("cube_oneway", elapsed_time);
if (this->shutdown_)
{
- ACE_DEBUG ((LM_DEBUG,
- "shutdown on cubit object\n"));
-
+ ACE_DEBUG ((LM_DEBUG, "shutdown on cubit object\n"));
this->cubit_->shutdown (ACE_TRY_ENV);
+ ACE_TRY_ENV.print_exception ("server, please ACE_OS::exit");
}
return this->error_count_ == 0 ? 0 : 1;
@@ -1332,25 +1140,17 @@ Cubit_Client::run_void (CORBA::Environment &ACE_TRY_ENV)
this->call_count_ = 0;
this->error_count_ = 0;
timer.start ();
-
for (i = 0; i < this->loop_count_; i++)
- {
- this->cube_void (i,
- ACE_TRY_ENV);
- }
-
+ this->cube_void (i, ACE_TRY_ENV);
timer.stop ();
timer.elapsed_time (elapsed_time);
-
- this->print_stats ("cube_void",
- elapsed_time);
+ this->print_stats ("cube_void", elapsed_time);
if (this->shutdown_)
{
- ACE_DEBUG ((LM_DEBUG,
- "shutdown on cubit object\n"));
-
+ ACE_DEBUG ((LM_DEBUG, "shutdown on cubit object\n"));
this->cubit_->shutdown (ACE_TRY_ENV);
+ ACE_TRY_ENV.print_exception ("server, please ACE_OS::exit");
}
return this->error_count_ == 0 ? 0 : 1;
@@ -1360,19 +1160,13 @@ Cubit_Client::~Cubit_Client (void)
{
// Free resources and close the IOR files.
if (this->cubit_factory_ior_file_)
- {
- ACE_OS::fclose (this->cubit_factory_ior_file_);
- }
+ ACE_OS::fclose (this->cubit_factory_ior_file_);
if (this->f_handle_ != ACE_INVALID_HANDLE)
- {
- ACE_OS::close (this->f_handle_);
- }
+ ACE_OS::close (this->f_handle_);
if (this->cubit_factory_key_ != 0)
- {
- ACE_OS::free (this->cubit_factory_key_);
- }
+ ACE_OS::free (this->cubit_factory_key_);
// Release the objects, to have a clean shutdown.
this->factory_ = Cubit_Factory::_nil ();
@@ -1397,31 +1191,22 @@ Cubit_Client::init (int argc, char **argv, const char *collocation_test_ior)
"internet",
ACE_TRY_ENV);
ACE_TRY_CHECK;
-
if (this->testing_collocation_ == 0)
- {
- // turn off collocation if directed to do so.
- this->orb_->_optimize_collocation_objects (0);
- }
+ // turn off collocation if directed to do so.
+ this->orb_->_optimize_collocation_objects (0);
// Parse command line and verify parameters.
if (this->parse_args () == -1)
- {
- return -1;
- }
+ return -1;
if (collocation_test_ior != 0)
- {
- this->read_ior (collocation_test_ior);
- }
+ this->read_ior (collocation_test_ior);
if (this->cubit_factory_key_ == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "%s: no cubit factory key specified\n",
- this->argv_[0]),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s: no cubit factory key specified\n",
+ this->argv_[0]),
+ -1);
CORBA::Object_var factory_object =
this->orb_->string_to_object (this->cubit_factory_key_,
@@ -1434,12 +1219,10 @@ Cubit_Client::init (int argc, char **argv, const char *collocation_test_ior)
ACE_TRY_CHECK;
if (CORBA::is_nil (this->factory_.in ()))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "invalid factory key <%s>\n",
- this->cubit_factory_key_),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "invalid factory key <%s>\n",
+ this->cubit_factory_key_),
+ -1);
ACE_DEBUG ((LM_DEBUG,
"Factory received OK\n"));
@@ -1450,11 +1233,9 @@ Cubit_Client::init (int argc, char **argv, const char *collocation_test_ior)
ACE_TRY_CHECK;
if (CORBA::is_nil (this->cubit_.in ()))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "null cubit objref returned by factory\n"),
- -1);
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "null cubit objref returned by factory\n"),
+ -1);
}
ACE_CATCHANY
{