summaryrefslogtreecommitdiff
path: root/TAO/performance-tests
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-25 17:22:37 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-25 17:22:37 +0000
commit9a5b57e157b33bd9d8c5715d549e8e7367af05d3 (patch)
treef414dde3b0be37a95224f0290b24fdf3bb9a37c3 /TAO/performance-tests
parentd09963ff1230f5220c4a0cf99cd9baa0c959f285 (diff)
downloadATCD-9a5b57e157b33bd9d8c5715d549e8e7367af05d3.tar.gz
Fixed ACE_TRY stuff and cosmetic changes.
Diffstat (limited to 'TAO/performance-tests')
-rw-r--r--TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp1028
1 files changed, 621 insertions, 407 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 5f4392bad71..34c9c553d2d 100644
--- a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/Cubit_Client.cpp
@@ -126,19 +126,26 @@ 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;
@@ -210,28 +217,25 @@ Cubit_Client::parse_args (void)
void
Cubit_Client::cube_union (CORBA::Environment &ACE_TRY_ENV)
{
- CORBA::Environment env;
- Cubit::oneof u;
+ ACE_TRY
+ {
+ 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);
- }
+ r = this->cubit_->cube_union (u,
+ ACE_TRY_ENV);
+ }
+
+ ACE_TRY_CHECK;
- 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 ()) ;
@@ -242,35 +246,24 @@ Cubit_Client::cube_union (CORBA::Environment &ACE_TRY_ENV)
this->error_count_++;
}
- }
+ this->call_count_++;
- this->call_count_++;
+ u._d (Cubit::e_3rd);
- 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
+ u.cm ().l = 7;
+ u.cm ().s = 5;
+ u.cm ().o = 3;
- u.cm ().l = 7;
- u.cm ().s = 5;
- u.cm ().o = 3;
+ // Cube another "union" which uses the default arm ... NOT tested yet
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_UNION_START);
- // Cube another "union" which uses the default arm ... NOT tested yet
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_UNION_START);
+ r = this->cubit_->cube_union (u,
+ ACE_TRY_ENV);
+ }
- r = this->cubit_->cube_union (u, ACE_TRY_ENV);
- }
+ ACE_TRY_CHECK;
- 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,6 +278,14 @@ 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.
@@ -293,30 +294,30 @@ void
Cubit_Client::cube_short (int i,
CORBA::Environment &ACE_TRY_ENV)
{
- CORBA::Short arg_short = this->func (i);
+ ACE_TRY
+ {
+ 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);
+ }
- this->call_count_++;
+ ACE_TRY_CHECK;
+
+ 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)
@@ -324,9 +325,18 @@ 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.
@@ -335,38 +345,52 @@ void
Cubit_Client::cube_oneway (int,
CORBA::Environment &ACE_TRY_ENV)
{
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_ONEWAY_START);
+ ACE_TRY
+ {
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_ONEWAY_START);
- this->cubit_->cube_oneway (ACE_TRY_ENV);
- }
+ this->cubit_->cube_oneway (ACE_TRY_ENV);
+ }
- this->call_count_++;
+ ACE_TRY_CHECK;
- if (ACE_TRY_ENV.exception () != 0)
+ this->call_count_++;
+ }
+ ACE_CATCHANY
{
- ACE_TRY_ENV.print_exception ("from cube_oneway");
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "from cube_oneway");
this->error_count_++;
}
+ ACE_ENDTRY;
+ ACE_CHECK;
}
void
Cubit_Client::cube_void (int,
CORBA::Environment &ACE_TRY_ENV)
{
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_VOID_START);
+ ACE_TRY
+ {
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_VOID_START);
- this->cubit_->cube_void (ACE_TRY_ENV);
- }
+ this->cubit_->cube_void (ACE_TRY_ENV);
+ }
- this->call_count_++;
+ ACE_TRY_CHECK;
- if (ACE_TRY_ENV.exception () != 0)
+ this->call_count_++;
+ }
+ ACE_CATCHANY
{
- ACE_TRY_ENV.print_exception ("from cube_void");
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "from cube_void");
this->error_count_++;
}
+ ACE_ENDTRY;
+ ACE_CHECK;
}
// Cube an octet
@@ -375,38 +399,50 @@ void
Cubit_Client::cube_octet (int i,
CORBA::Environment &ACE_TRY_ENV)
{
- CORBA::Octet arg_octet = this->func (i);
+ ACE_TRY
+ {
+ CORBA::Octet arg_octet = this->func (i);
- // Cube an octet.
- CORBA::Octet ret_octet;
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_OCTET_START);
+ // Cube an octet.
+ CORBA::Octet ret_octet;
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_OCTET_START);
- ret_octet = this->cubit_->cube_octet (arg_octet, ACE_TRY_ENV);
- }
+ ret_octet = this->cubit_->cube_octet (arg_octet,
+ ACE_TRY_ENV);
+ }
- this->call_count_++;
+ ACE_TRY_CHECK;
+
+ this->call_count_++;
- if (ACE_TRY_ENV.exception () != 0)
- {
- ACE_TRY_ENV.print_exception ("from cube_octet");
- this->error_count_++;
- }
- else
- {
if (TAO_debug_level > 2)
- ACE_DEBUG ((LM_DEBUG,
- "cube octet: %d --> %d\n",
- arg_octet, ret_octet));
+ {
+ 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_++;
- }
+
+ 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
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "from cube_octet");
+ this->error_count_++;
}
+ ACE_ENDTRY;
+ ACE_CHECK;
}
// calculate the cube from a long
@@ -415,30 +451,31 @@ void
Cubit_Client::cube_long (int i,
CORBA::Environment &ACE_TRY_ENV)
{
- CORBA::Long arg_long = this->func (i);
+ ACE_TRY
+ {
+ CORBA::Long arg_long = this->func (i);
- // Cube a long.
- CORBA::Long ret_long;
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_LONG_START);
+ // Cube a long.
+ CORBA::Long ret_long;
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_LONG_START);
- ret_long = this->cubit_->cube_long (arg_long, ACE_TRY_ENV);
- }
+ ret_long = this->cubit_->cube_long (arg_long,
+ ACE_TRY_ENV);
+ }
- this->call_count_++;
+ ACE_TRY_CHECK;
+
+ 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)
@@ -447,9 +484,18 @@ 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
@@ -458,32 +504,33 @@ void
Cubit_Client::cube_struct (int i,
CORBA::Environment &ACE_TRY_ENV)
{
- Cubit::Many arg_struct;
- Cubit::Many ret_struct;
+ ACE_TRY
+ {
+ Cubit::Many arg_struct;
+ Cubit::Many ret_struct;
- this->call_count_++;
+ this->call_count_++;
- arg_struct.l = this->func (i);
- arg_struct.s = this->func (i);
- arg_struct.o = this->func (i);
+ arg_struct.l = this->func (i);
+ arg_struct.s = this->func (i);
+ arg_struct.o = this->func (i);
- // Cube a "struct" ...
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_STRUCT_START);
+ // Cube a "struct" ...
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_STRUCT_START);
- ret_struct = this->cubit_->cube_struct (arg_struct, ACE_TRY_ENV);
- }
+ ret_struct = this->cubit_->cube_struct (arg_struct,
+ ACE_TRY_ENV);
+ }
+
+ ACE_TRY_CHECK;
- 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;
@@ -493,239 +540,231 @@ 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)
{
- this->call_count_++;
+ ACE_TRY
+ {
+ this->call_count_++;
- Cubit::long_seq input (l);
- input.length (l);
+ Cubit::long_seq input (l);
+ input.length (l);
-#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
+ // 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;
- 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);
+ }
- // Cubit::long_seq& output = *vout.ptr ();
- // output = vout;
+ ACE_TRY_CHECK;
- 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)
{
- CORBA::Long x = input[j];
- if (x*x*x != output[j])
- {
- ACE_ERROR ((LM_ERROR, "** cube_long_sequence ERROR\n"));
- this->error_count_++;
- }
+ rl = input.length ();
}
-#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)
{
- this->call_count_++;
+ ACE_TRY
+ {
+ this->call_count_++;
- Cubit::octet_seq input (l);
- input.length (l);
+ Cubit::octet_seq input (l);
+ input.length (l);
-#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
+ // 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;
- 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);
+ }
- // Cubit::long_seq& output = *vout.ptr ();
- // output = vout;
+ ACE_TRY_CHECK;
- 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)
{
- CORBA::Octet x = input[j];
- if (x*x*x != output[j])
- {
- ACE_ERROR ((LM_ERROR, "** cube_octet ERROR\n"));
- this->error_count_++;
- }
+ rl = input.length ();
}
-#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)
{
- this->call_count_++;
+ ACE_TRY
+ {
+ this->call_count_++;
- Cubit::many_seq input (l);
- input.length (l);
+ 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);
+ }
+
+ ACE_TRY_CHECK;
-#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)
{
- Cubit::Many &in = input[j];
- Cubit::Many &out = output[j];
-
- 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_++;
- }
+ rl = input.length ();
}
-#else
- Cubit::Many &in = input[0];
+
+ Cubit::Many &ret_in = input[0];
Cubit::Many &out = output[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)
+ 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)
{
- 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
@@ -734,66 +773,88 @@ Cubit_Client::cube_rti_data (int,
int numAttrs,
CORBA::Environment &ACE_TRY_ENV)
{
- this->call_count_++;
+ ACE_TRY
+ {
+ 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)
+ for (int j = 0; j < numUpdates; ++j)
{
- 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);
+ 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);
+ Cubit::RtiPacket_var output;
+ Cubit::RtiPacket_out vout (output);
- // Cube the sequence
- if (TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_DEBUG, "Input: \n"));
- print_RtiPacket (input);
- }
+ // Cube the sequence
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Input: \n"));
+
+ print_RtiPacket (input);
+ }
- {
- ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_RTI_DATA_START);
+ {
+ ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_RTI_DATA_START);
+
+ this->cubit_->cube_rti_data (input,
+ vout,
+ ACE_TRY_ENV);
+ }
+
+ ACE_TRY_CHECK;
- this->cubit_->cube_rti_data (input, vout, ACE_TRY_ENV);
- }
- if (TAO_debug_level > 0)
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Output: \n"));
+
+ print_RtiPacket (*vout.ptr ());
+
+ ACE_DEBUG ((LM_DEBUG,
+ "need to check whether cubing happened\n"));
+ }
+ }
+ ACE_CATCHANY
{
- ACE_DEBUG ((LM_DEBUG, "Output: \n"));
- print_RtiPacket (*vout.ptr ());
- ACE_DEBUG ((LM_DEBUG,"need to check whether cubing happened\n"));
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "from cube_rtti_data");
+ this->error_count_++;
}
+ ACE_ENDTRY;
+ ACE_CHECK;
}
void
@@ -849,8 +910,7 @@ Cubit_Client::print_stats (const char *call_name,
int
Cubit_Client::run ()
{
- // @@
- CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ();
+ ACE_DECLARE_NEW_CORBA_ENV;
if (this->only_void_)
return this->run_void (ACE_TRY_ENV);
@@ -870,155 +930,265 @@ 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);
@@ -1039,10 +1209,12 @@ 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_,
@@ -1055,10 +1227,12 @@ 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);
@@ -1067,7 +1241,8 @@ 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
{
@@ -1080,7 +1255,9 @@ 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);
@@ -1111,15 +1288,24 @@ 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);
}
@@ -1139,15 +1325,24 @@ 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);
}
@@ -1158,13 +1353,19 @@ 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 ();
@@ -1189,22 +1390,31 @@ 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_,
@@ -1217,10 +1427,12 @@ 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"));
@@ -1231,9 +1443,11 @@ 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
{