diff options
Diffstat (limited to 'TAO/performance-tests/Cubit/Hardpack/IDL_Cubit')
13 files changed, 1749 insertions, 0 deletions
diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/Imakefile b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/Imakefile new file mode 100644 index 00000000000..633ac06056a --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/Imakefile @@ -0,0 +1,34 @@ +COMMENT @(#) (C) Copyright Lockheed Martin 1996, 1997, 1998 (Unpublished). All rights reserved. Imakefile 1.3 changed 5/22/98 13:34:14 + +BUILD=/project/doc/pkg/Hardpack/dsi_5.1/SunOS_5.5.1 +PREPRO = $(BUILD)/bin/idlpp_cc + +CCFLAGS += -mt -xildoff + +#if defined(T_SunOS) +INC=-I$(BUILD)/include -I$(ACE_ROOT) -I/usr/include -I/usr/include/sys +LIBS=$(BUILD)/Templates.DB/$()*.o -L$(BUILD)/lib -lORB++ -lORB -lES -L$(ACE_ROOT)/ace -lACE +#else +INC=-I$(BUILD)/include -I$(ACE_ROOT) -I/usr/include -I/usr/include/sys +LIBS=-L$(BUILD)/lib -lORB++ -lORB -lES -lIR++ -lACE -L$(ACE_ROOT)/ace +#endif + + +all: cubit.hh client server + +client: client.cpp client_i.cpp cubit_c.cc cubit.hh + $(CCC) $(CCFLAGS) $(INC) -o client \ + cubit_c.cc client_i.cpp client.cpp \ + $(LIBS) $(OSLIBS) + +server: server.cpp server_i.cpp cubit_impl.cc cubit_s.cc cubit_c.cc cubit.hh + $(CCC) $(CCFLAGS) $(INC) -o server \ + server.cpp server_i.cpp cubit_s.cc cubit_c.cc cubit_impl.cc \ + $(LIBS) $(OSLIBS) + +cubit.hh: cubit.idl + $(PREPRO) cubit.idl + +clean: + rm -f client server cubit.hh *_s.cc *_c.cc *.o; + rm -rf Templates.DB; rm -f *~ diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/Makefile b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/Makefile new file mode 100644 index 00000000000..a9713cf8083 --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/Makefile @@ -0,0 +1,55 @@ +/* $Id$ */ +# Makefile generated by imake - do not edit! +# $XConsortium: imake.c,v 1.72 92/09/14 11:44:22 rws Exp $ +# +# The cpp used on this machine replaces all newlines and multiple tabs and +# spaces in a macro expansion with a single space. Imake tries to compensate +# for this, but is not always successful. +# + +CCC=CC +CC=cc + +CFLAGS=-g -D_DEBUG=3 -DDSI_DEBUG=3 $(INC) -xs -DBSD_COMP +CCFLAGS=-g -D_DEBUG=3 -DDSI_DEBUG=3 -D_IR_hh $(INC) -xs -DBSD_COMP -i +OSLIBS=-lthread -lposix4 -lsocket -lnsl -lm + +# @(#) (C) Copyright Lockheed Martin 1996, 1997, 1998 (Unpublished). All rights reserved. Imakefile 1.3 changed 5/22/98 13:34:14 + +BUILD=/project/doc/pkg/Hardpack/dsi_5.1/SunOS_5.5.1 +PREPRO = $(BUILD)/bin/idlpp_cc + +CCFLAGS += -mt -xildoff + +INC=-I$(BUILD)/include -I$(ACE_ROOT) -I/usr/include -I/usr/include/sys +LIBS=$(BUILD)/Templates.DB/$()*.o -L$(BUILD)/lib -lORB++ -lORB -lES -L$(ACE_ROOT)/ace -lACE + +all: cubit.hh client server + +client: client.cpp client_i.cpp cubit_c.cc cubit.hh + $(CCC) $(CCFLAGS) $(INC) -o client \ + cubit_c.cc client_i.cpp client.cpp \ + $(LIBS) $(OSLIBS) + +server: server.cpp server_i.cpp cubit_impl.cc cubit_s.cc cubit_c.cc cubit.hh + $(CCC) $(CCFLAGS) $(INC) -o server \ + server.cpp server_i.cpp cubit_s.cc cubit_c.cc cubit_impl.cc \ + $(LIBS) $(OSLIBS) + +cubit.hh: cubit.idl + $(PREPRO) cubit.idl + +clean: + rm -f client server cubit.hh *_s.cc *_c.cc *.o; + rm -rf Templates.DB; rm -f *~ + +.SUFFIXES: .cc + +.cc.a: + $(CCC) -c $(CCFLAGS) $< + $(AR) $(ARFLAGS) $@ $*.o + rm -f $*.o + +.cc: + $(CCC) $(CCFLAGS) $(LDFLAGS) $< -o $@ + diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/README b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/README new file mode 100644 index 00000000000..4a722a5c5d6 --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/README @@ -0,0 +1,41 @@ +The IDL_Cubit test for Hardpack ORB +------------------------------------ + +Compiling +--------- + +setup the HARDPACK ROOT environment variables before compiling. + +The following is an example configuration for SunOS_5.5.1: + +setenv HARDPACK_ROOT /project/doc/pkg/Hardpack/dsi_5.1 +setenv PATH ${HARDPACK_ROOT}/bin:${HARDPACK_ROOT}/SunOS_5.5.1/bin:${PATH} +setenv LD_LIBRARY_PATH ${HARDPACK_ROOT}/SunOS_5.5.1/lib:${LD_LIBRARY_PATH} + +1. Hardpack provides a build tool to build the Makefile from the Imakefile. + +2.To build and compile + + $build SUN + + $build clean + will clean the object files and executables and also the Makefile. + +To Run: +------ + +1. Edit the initref.cfg file in this directory by putting the hostname +on which you want the name server to run. + +2. Run the Hardpack nameserver + + $nameserver + +3. Run the server + + $server + +4. Run the client + + $client + diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/client.cpp b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/client.cpp new file mode 100644 index 00000000000..e43c60643f0 --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/client.cpp @@ -0,0 +1,22 @@ +// $Id$ + +#include "client_i.h" + +ACE_RCSID(IDL_Cubit, client, "$Id$") + +// This function runs the test. + +int +main (int argc, char **argv) +{ + Cubit_Client cubit_client; + + ACE_DEBUG ((LM_DEBUG, + "\n \t IDL_Cubit: client \n\n")); + + if (cubit_client.init (argc, argv) == -1) + return 1; + else + return cubit_client.run (); +} + diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/client_i.cpp b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/client_i.cpp new file mode 100644 index 00000000000..073dbaca8a0 --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/client_i.cpp @@ -0,0 +1,824 @@ +// $Id$ + +#include "ace/Env_Value_T.h" +#include "ace/Read_Buffer.h" +#include "client_i.h" + +ACE_RCSID(IDL_Cubit, client_i, "$Id$") + +#if defined (ACE_ENABLE_TIMEPROBES) + +static const char *Cubit_Client_Timeprobe_Description[] = +{ + "Cubit_Client::cube_octet - start", + "Cubit_Client::cube_octet - end", + + "Cubit_Client::cube_short - start", + "Cubit_Client::cube_short - end", + + "Cubit_Client::cube_long - start", + "Cubit_Client::cube_long - end", + + "Cubit_Client::cube_struct - start", + "Cubit_Client::cube_struct - end", + + "Cubit_Client::cube_union - start", + "Cubit_Client::cube_union - end", + + "Cubit_Client::cube_long_sequence - start", + "Cubit_Client::cube_long_sequence - end", + + "Cubit_Client::cube_octet_sequence - start", + "Cubit_Client::cube_octet_sequence - end" +}; + +enum +{ + // Timeprobe description table start key + CUBIT_CLIENT_CUBE_OCTET_START = 10000, + CUBIT_CLIENT_CUBE_OCTET_END, + + CUBIT_CLIENT_CUBE_SHORT_START, + CUBIT_CLIENT_CUBE_SHORT_END, + + CUBIT_CLIENT_CUBE_LONG_START, + CUBIT_CLIENT_CUBE_LONG_END, + + CUBIT_CLIENT_CUBE_STRUCT_START, + CUBIT_CLIENT_CUBE_STRUCT_END, + + CUBIT_CLIENT_CUBE_UNION_START, + CUBIT_CLIENT_CUBE_UNION_END, + + CUBIT_CLIENT_CUBE_LONG_SEQUENCE_START, + CUBIT_CLIENT_CUBE_LONG_SEQUENCE_END, + + CUBIT_CLIENT_CUBE_OCTET_SEQUENCE_START, + CUBIT_CLIENT_CUBE_OCTET_SEQUENCE_END +}; + +// Setup Timeprobes +ACE_TIMEPROBE_EVENT_DESCRIPTIONS (Cubit_Client_Timeprobe_Description, + CUBIT_CLIENT_CUBE_OCTET_START); + +#endif /* ACE_ENABLE_TIMEPROBES */ + +// Constructor. +Cubit_Client::Cubit_Client (void) + : cubit_factory_key_ (0), + cubit_key_ (ACE_OS::strdup ("key0")), + loop_count_ (250), + shutdown_ (0), + cubit_ (Cubit::_nil ()), + call_count_ (0), + error_count_ (0), + cubit_factory_ior_file_ (0), + f_handle_ (ACE_INVALID_HANDLE), + use_naming_service_ (1) +{ +} + +// Simple function that returns the substraction of 117 from the +// parameter. + +int +Cubit_Client::func (u_int i) +{ + return i - 117; +} + +// Reads the Cubit factory ior from a file + +int +Cubit_Client::read_ior (char *filename) +{ + // Open the file for reading. + 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 writing: %p\n", + filename), + -1); + ACE_Read_Buffer ior_buffer (this->f_handle_); + this->cubit_factory_key_ = ior_buffer.read (); + + if (this->cubit_factory_key_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to allocate memory to read ior: %p\n"), + -1); + return 0; +} + +// Parses the command line arguments and returns an error status. + +int +Cubit_Client::parse_args (void) +{ + ACE_Get_Opt get_opts (argc_, argv_, "n:f:k:xs"); + int c; + int result; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'n': // loop count + 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); + if (result < 0) + 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. + this->cubit_factory_key_ = + ACE_OS::strdup (get_opts.optarg); + break; + case 'x': + this->shutdown_ = 1; + break; + case 's': // Don't use the TAO Naming Service. + this->use_naming_service_ = 0; + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " [-n loopcount]" + " [-f cubit_factory-obj-ref-key-file]" + " [-k cubit-obj-ref-key]" + " [-x]" + " [-s]" + "\n", + this->argv_ [0]), + -1); + } + + // Indicates successful parsing of command line. + return 0; +} + +// Exercise the union. Cube a union. + +// void +// Cubit_Client::cube_union (void) +// { +// Cubit::oneof u; + +// this->call_count_++; + +// u.l (3); // use the long union branch. + +// // Cube a "union" ... +// Cubit::oneof r; +// { +// ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_UNION_START); + +// try +// { +// r = this->cubit_->cube_union (u); +// } +// catch (...) +// { +// cout << "An unknown exception in cube_long\n"; +// this->error_count_++; +// return; +// } +// } +// u.l (u.l () * u.l () * u.l ()) ; + +// if (u.l () != r.l ()) +// { +// ACE_DEBUG ((LM_DEBUG, "** cube_union ERROR\n")); +// this->error_count_++; +// } + +// this->call_count_++; + +// u._d (Cubit::e_3rd); + +// 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); +// try +// { +// r = this->cubit_->cube_union (u); +// } +// catch (...) +// { +// cout << "An unknown exception in cube_long\n"; +// this->error_count_++; +// return; +// } +// } +// u.cm ().l = u.cm ().l * u.cm ().l * u.cm ().l; +// u.cm ().s = u.cm ().s * u.cm ().s * u.cm ().s; +// u.cm ().o = u.cm ().o * u.cm ().o * u.cm ().o; + +// if (u.cm ().l != r.cm ().l +// || u.cm ().s != r.cm ().s +// || u.cm ().o != r.cm ().o) +// { +// ACE_DEBUG ((LM_DEBUG, "** cube_union ERROR\n")); +// this->error_count_++; +// } +// } + +// Cube a short. + +void +Cubit_Client::cube_short (int i) +{ + CORBA::Short arg_short = this->func (i); + + this->call_count_++; + // Cube a short. + CORBA::Short ret_short; + { + ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_SHORT_START); + try + { + ret_short = this->cubit_->cube_short (arg_short); + } + catch (...) + { + cout << "An unknown exception in cube_short\n"; + this->error_count_++; + return; + } + arg_short = arg_short * arg_short * arg_short; + if (arg_short != ret_short) + { + ACE_ERROR ((LM_ERROR, "** cube_short (%d) ERROR (--> %d)\n", + (CORBA::Short) i-117, + ret_short)); + this->error_count_++; + } + } +} + +void +Cubit_Client::cube_oneway (int i) +{ + try + { + this->cubit_->cube_oneway (); + } + catch (...) + { + cout << "An unknown exception in cube_short\n"; + this->error_count_++; + return; + } + + this->call_count_++; + return; +} + +void +Cubit_Client::cube_void (int i) +{ + try + { + this->cubit_->cube_void (); + } + catch (...) + { + cout << "An unknown exception in cube_short\n"; + this->error_count_++; + return; + } + this->call_count_++; +} + + +// Cube an octet + +void +Cubit_Client::cube_octet (int i) +{ + CORBA::Octet arg_octet = this->func (i); + + this->call_count_++; + // Cube an octet. + CORBA::Octet ret_octet; + { + ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_OCTET_START); + try + { + ret_octet = this->cubit_->cube_octet (arg_octet); + } + catch (...) + { + cout << "An unknown exception in cube_long\n"; + this->error_count_++; + return; + } + 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 + +void +Cubit_Client::cube_long (int i) +{ + CORBA::Long arg_long = this->func (i); + + // Cube a long. + CORBA::Long ret_long; + { + ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_LONG_START); + try + { + ret_long = this->cubit_->cube_long (arg_long); + this->call_count_++; + } + catch (...) + { + cout << "An unknown exception in cube_long\n"; + this->error_count_++; + this->call_count_++; + return; + } + arg_long = arg_long * arg_long * arg_long; + if (arg_long != ret_long) + { + ACE_ERROR ((LM_ERROR, + "** cube_long (%ld) ERROR (--> %ld)\n", + (CORBA::Long) this->func (i), + ret_long)); + this->error_count_++; + } + } +} + +// // Cube the numbers in a struct + +void +Cubit_Client::cube_struct (int i) +{ + Cubit::Many arg_struct; + Cubit::Many ret_struct; + + this->call_count_++; + + 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); + try + { + ret_struct = this->cubit_->cube_struct (arg_struct); + } + catch (...) + { + cout << "An unknown exception in cube_struct\n"; + this->error_count_++; + return; + } + } + + 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; + + if (arg_struct.l != ret_struct.l + || arg_struct.s != ret_struct.s + || arg_struct.o != ret_struct.o) + { + ACE_ERROR ((LM_ERROR, "** cube_struct ERROR\n")); + this->error_count_++; + } +} + + +// Cube the numbers in a sequence + +// void +// Cubit_Client::cube_long_sequence (int i, int l) +// { +// this->call_count_++; + +// 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; + +// Cubit::long_seq_var output ; + +// // Cube the sequence +// { +// ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_LONG_SEQUENCE_START); +// try +// { +// this->cubit_->cube_long_sequence (input,output); +// } +// catch (...) +// { +// cout << "An unknown exception in cube_long_sequence\n"; +// this->error_count_++; +// return; +// } +// } +// if (output->length () != input.length ()) +// { +// ACE_ERROR ((LM_ERROR, "** cube sequence, wrong length\n")); +// this->error_count_++; +// } + +// u_int rl = output->length (); +// if (input.length () < rl) +// rl = input.length (); +// CORBA::Long x = input[0]; +// if (x * x *x != output[0]) +// { +// ACE_ERROR ((LM_ERROR, "** cube_long_sequence ERROR\n")); +// this->error_count_++; +// } +// } + +// void +// Cubit_Client::cube_octet_sequence (int i, int l) +// { +// this->call_count_++; + +// 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; + +// Cubit::octet_seq* output; + +// // Cube the sequence +// { +// ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_OCTET_SEQUENCE_START); + +// try +// { +// this->cubit_->cube_octet_sequence (input, output); +// } +// catch (...) +// { +// cout << "An unknown exception in cube_octec_sequence\n"; +// this->error_count_++; +// return; +// } +// } +// u_int rl = output->length (); +// if (rl != input.length ()) +// { +// ACE_ERROR ((LM_ERROR, "** cube octet, wrong length\n")); +// this->error_count_++; +// } + +// if (input.length () < rl) +// rl = input.length (); +// CORBA::Octet x = input[0]; +// if (x * x *x != output[0]) +// { +// ACE_ERROR ((LM_ERROR, "** cube_octet ERROR\n")); +// this->error_count_++; +// } +// } + +void +Cubit_Client::print_stats (const char *call_name, + ACE_Profile_Timer::ACE_Elapsed_Time &elapsed_time) +{ + ACE_DEBUG ((LM_DEBUG, + "%s:\n", + call_name)); + + if (this->call_count_ > 0 && this->error_count_ == 0) + { +#if defined (ACE_LACKS_FLOATING_POINT) + // elapsed_time.real_time is in units of microseconds. + const u_int calls_per_sec = + this->call_count_ * 1000000u / elapsed_time.real_time; + + ACE_DEBUG ((LM_DEBUG, + "\treal_time\t= %u ms,\n" + "\t%u calls/second\n", + elapsed_time.real_time / 1000u, + calls_per_sec)); +#else /* ! ACE_LACKS_FLOATING_POINT */ + // elapsed_time.real_time is in units of seconds. + double calls_per_sec = this->call_count_ / elapsed_time.real_time; + + ACE_DEBUG ((LM_DEBUG, + "\treal_time\t= %0.06f ms, \n\t" + "user_time\t= %0.06f ms, \n\t" + "system_time\t= %0.06f ms\n" + "\t%0.00f calls/second\n", + elapsed_time.real_time < 0.0 ? 0.0 + : elapsed_time.real_time * ACE_ONE_SECOND_IN_MSECS, + elapsed_time.user_time < 0.0 ? 0.0 + : elapsed_time.user_time * ACE_ONE_SECOND_IN_MSECS, + elapsed_time.system_time < 0.0 ? 0.0 + : elapsed_time.system_time * ACE_ONE_SECOND_IN_MSECS, + calls_per_sec < 0.0 ? 0.0 : calls_per_sec)); +#endif /* ! ACE_LACKS_FLOATING_POINT */ + } + else + ACE_ERROR ((LM_ERROR, + "\tNo time stats printed. Call count zero or error ocurred.\n")); + + ACE_DEBUG ((LM_DEBUG, + "\t%d calls, %d errors\n", + this->call_count_, + this->error_count_)); +} + +// Execute client example code. + +int +Cubit_Client::run (int testing_collocation) +{ + u_int i; + + ACE_Profile_Timer timer; + ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time; + // ACE_Time_Value before; + + + // + // Show the results one type at a time. + // + + // ONEWAY + this->call_count_ = 0; + this->error_count_ = 0; + timer.start (); + for (i = 0; i < this->loop_count_; i++) + this->cube_oneway (i); + timer.stop (); + timer.elapsed_time (elapsed_time); + this->print_stats ("cube_oneway", elapsed_time); + + // VOID + this->call_count_ = 0; + this->error_count_ = 0; + timer.start (); + for (i = 0; i < this->loop_count_; i++) + this->cube_void (i); + timer.stop (); + timer.elapsed_time (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); + timer.stop (); + timer.elapsed_time (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); + timer.stop (); + timer.elapsed_time (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); + timer.stop (); + timer.elapsed_time (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); + timer.stop (); + timer.elapsed_time (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 (); +// timer.stop (); +// timer.elapsed_time (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); +// timer.stop (); +// timer.elapsed_time (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); +// timer.stop (); +// timer.elapsed_time (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); +// timer.stop (); +// timer.elapsed_time (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); +// timer.stop (); +// timer.elapsed_time (elapsed_time); +// this->print_stats ("cube_large_sequence<octet>", 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); + this->cube_octet (i); + this->cube_long (i); + } + timer.stop (); + timer.elapsed_time (elapsed_time); + this->print_stats ("cube mixin (short/octet/long)", elapsed_time); + + + return this->error_count_ == 0 ? 0 : 1; +} + +Cubit_Client::~Cubit_Client (void) +{ + // Free resources + // Close the ior files + if (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_); + + CORBA::release (this->cubit_); + + if (this->cubit_factory_key_ != 0) + ACE_OS::free (this->cubit_factory_key_); + if (this->cubit_key_ != 0) + ACE_OS::free (this->cubit_key_); +} + +int +Cubit_Client::init_naming_service (void) +{ + CORBA::Object_ptr dummy_object; + CosNaming::NamingContext_var nameserver; + CosNaming::Name name; + + try { + // Resolve initial reference to the nameserver + dummy_object = this->orb_-> resolve_initial_references("NameService"); + // Narrow the initial reference to the nameserver + nameserver = CosNaming::NamingContext::_narrow(dummy_object); + } catch (CORBA::BAD_PARAM) { + cout << "Bad parameter exception caught - narrow on the NameService" << endl; + exit(-1); + } catch (CORBA::SystemException) { + cout << "A general system exception was caught - resolve_initial_references" << endl; + exit(-1); + } catch (...) { + cout << "An exception of unknown type was caught - initializing the NameService" << endl; + exit(-1); + } + + // Resolve the server interface object which was bound under the name "cubit" + name.length(2); + + name[0].id = "cubit_S"; + name[0].kind = "ASE"; + name[1].id = "cubit"; + name[1].kind = "interface"; + + try { + dummy_object = nameserver -> resolve(name); + this->cubit_ = Cubit::_narrow(dummy_object); + } catch (CORBA::BAD_PARAM) { + cout << "Bad parameter exception caught - resolve or narrow on the cubit server object" << endl; + exit(-1); + } catch (...) { + cout << "An exception of unknown type was caught - resolve or narrow on the cubit server object" << endl; + exit(-1); + } + + cout << "cubit object resolved successfully\n"; + + return 0; +} + +int +Cubit_Client::init (int argc, char **argv) +{ + int argct; + char *argvt[1]; + int naming_result; + this->argc_ = argc; + this->argv_ = argv; + cout << "Starting the cubit client." << endl; + + try { + // Obtain an object reference to the ORB + argvt[0] = "-ORBase cubit_client"; + argct = 1; + this->orb_ = CORBA::ORB_init(argct, argvt, ORBIDENT); + } catch (CORBA::BAD_PARAM) { + cout << "Bad parameter exception caught - ORB_init" << endl; + exit(-1); + } catch (CORBA::INITIALIZE) { + cout << "Initialize exception caught - ORB_init" << endl; + exit(-1); + } catch (CORBA::INTERNAL) { + cout << "Internal exception caught - ORB_init" << endl; + exit(-1); + } catch (CORBA::UNKNOWN) { + cout << "Unknown exception caught - ORB_init" << endl; + exit(-1); + } catch(...) { + cout << "An exception of unknown type was caught - ORB_init" << endl; + exit(-1); + } + + try { + // Obtain an object reference to the BOA + argct = 0; + this->boa_ = this->orb_-> BOA_init(argct, argvt, BOAIDENT); + } catch (CORBA::UNKNOWN) { + cout << "Unknown exception caught - ORB_init" << endl; + exit(-1); + } catch (CORBA::SystemException) { + cout << "General system exception caught - BOA_init" << endl; + exit(-1); + } catch (...) { + cout << "An exception of unknown type was caught - BOA_init" << endl; + exit(-1); + } + naming_result = this->init_naming_service (); + if (naming_result < 0) + return naming_result; + + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Env_Value<unsigned long>; +template class ACE_Env_Value<unsigned short>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Env_Value<unsigned long> +#pragma instantiate ACE_Env_Value<unsigned short> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/client_i.h b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/client_i.h new file mode 100644 index 00000000000..6dbe4bb6362 --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/client_i.h @@ -0,0 +1,140 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/IDL_Cubit +// +// = FILENAME +// client.h +// +// = DESCRIPTION +// This class implements a simple "cube" CORBA client for the Cubit +// example using stubs generated by the TAO ORB IDL compiler. +// +// = AUTHORS +// Aniruddha Gokhale, Sumedh Mungee, and Sergio Flores-Gaitan +// +// ============================================================================ + +#include "ace/Get_Opt.h" +#include "ace/Profile_Timer.h" +#include "ace/Timeprobe.h" +#include "gpp_header.hh" +#include "naming.hh" +#include "cubit.hh" +#include "es.h" + +class Cubit_Client +{ + // = TITLE + // Defines a class that encapsulates behaviour of the Cubit client + // example. Provides a better understanding of the logic in an + // object oriented way. + // + // = DESCRIPTION + // This class declares an interface to run the example client for + // Cubit CORBA server. All the complexity for initializing the + // server is hidden in the class. Just the run() interface is needed. +public: + // = Constructor and destructor. + Cubit_Client (void); + ~Cubit_Client (void); + + int run (int testing_collocation = 0); + // Execute client example code. + + int init (int argc, char **argv); + // Initialize the client communication endpoint with server. + +private: + int init_naming_service (void); + // Function to initialize the naming service. + + int func (u_int i); + // Simple function that returns the substraction of 117 from the + // parameter. + + int read_ior (char *filename); + // Function to read the cubit factory ior from a file. + + int parse_args (void); + // Parses the arguments passed on the command line. + + void print_stats (const char *call_name, + ACE_Profile_Timer::ACE_Elapsed_Time &elapsed_time); + // Prints the time stats. + void cube_oneway (int i); + // Oneway operation test. + + void cube_void (int i); + // Twoway operation test. + + void cube_union (void); + // Exercise the union. Cube a union. + + void cube_struct (int i); +// // calculate the cube from a struct. + + void cube_long (int i); + // calculate the cube from a long. + + void cube_octet (int i); + // Cube an octet. + + void cube_short (int i); + // Cube a short. + + void cube_long_sequence (int i, int l); + // Cube a sequence <l> is the length of the sequence. + + void cube_octet_sequence (int i, int l); + // Cube a sequence of octets, <l> is the length of the sequence. + + int argc_; + // # of arguments on the command line. + + char **argv_; + // arguments from command line. + + char *cubit_factory_key_; + // Key of factory obj ref. + + char *cubit_key_; + // Key of the obj ref to be retrieved via the factory. + + u_int loop_count_; + // Number of times to do the cube operations. + + int shutdown_; + // Flag to tell server to shutdown. + + //Cubit_Factory_var factory_; + // factory pointer for cubit. + + Cubit_ptr cubit_; + // Cubit obj ref. + + CORBA::ORB_ptr orb_; + // Remember our orb. + + CORBA::BOA_ptr boa_; + // Basic object adapter + + u_int call_count_; + // # of calls made to functions. + + u_int error_count_; + // # of errors incurred in the lifetime of the application. + + FILE *cubit_factory_ior_file_; + // File from which to obtain the IOR. + + ACE_HANDLE f_handle_; + // File handle to read the IOR. + + int use_naming_service_; + // Flag to tell client not to use Namingservice to find the cubit + // Factory. +}; diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/cubit.idl b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/cubit.idl new file mode 100644 index 00000000000..cc14781d7da --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/cubit.idl @@ -0,0 +1,96 @@ +/* -*- C++ -*- */ +// $Id$ + +interface Cubit + // = TITLE + // Defines an interface that encapsulates operations that cube + // numbers. + // + // = DESCRIPTION + // This interface encapsulates operations that cube + // octets, shorts, longs, structs and unions. +{ + oneway void cube_oneway (); + // test the basic latency of a nil oneway operation + + void cube_void (); + // Test the bassic latency of a nil operation + octet cube_octet (in octet o); + // cube an octet + + short cube_short (in short s); + // cube a short + + long cube_long (in long l); + // cube a long + + struct Many + { + octet o; // + 3 bytes padding (normally) ... + long l; + short s; // + 2 bytes padding (normally) ... + }; + + Many cube_struct (in Many values); + // Cube a struct + +// enum discrim +// { +// e_0th, +// e_1st, +// e_2nd, +// e_3rd +// }; +// // Enumeration of the different elements in a union. + +// union oneof switch (discrim) +// { +// // this is an easy union to interpret; no padding +// // is needed between discriminant and value. +// case e_0th: +// octet o; +// case e_1st: +// short s; +// case e_2nd: +// long l; +// case e_3rd: +// Many cm; + +// // default: +// // Many cm; +// }; +// // Union of different types. + +// oneof cube_union (in oneof values); +// // cube a union. + + typedef sequence<long> long_seq; + + void cube_long_sequence (in long_seq input, + out long_seq output); + // Cube several longs. + + + typedef sequence<octet> octet_seq; + void cube_octet_sequence (in octet_seq input, out octet_seq output); + // Cube an octet sequence. + + oneway void shutdown (); + // shutdown the application. +}; + +// interface Cubit_Shutdown +// { +// // = TITLE +// // We need this class to shutdown the server +// // when testing collocation. +// oneway void shutdown (); +// // shutdown the program. +// }; + +// interface Cubit_Factory +// // = TITLE +// // Creates Cubit objects. +// { +// Cubit make_cubit (); +// }; diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/cubit_impl.cc b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/cubit_impl.cc new file mode 100644 index 00000000000..24e38720f87 --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/cubit_impl.cc @@ -0,0 +1,163 @@ +// $Id$ +#include "cubit_impl.hh" + +// This file is a skeleton of the implementation of the _impl class. + + +//============== Cubit implementation ============== +Cubit_impl::Cubit_impl() : _sk_Cubit(0) { +// Do not change the signature for this constructor + +} + +Cubit_impl::~Cubit_impl() { + +} + +void Cubit_impl::cube_oneway( + ) { +} + + +void Cubit_impl::cube_void( + ) { +} + +CORBA::Octet Cubit_impl::cube_octet( + CORBA::Octet o + ) { + return o * o * o; +} + + +CORBA::Short Cubit_impl::cube_short( + CORBA::Short s + ) { + return s * s * s; +} + + +CORBA::Long Cubit_impl::cube_long( + CORBA::Long l + ) { + return l * l * l; +} + + +Cubit::Many Cubit_impl::cube_struct( + const Cubit::Many& values + ) { + Cubit::Many temp; + + temp.o = values.o * values.o * values.o; + temp.s = values.s * values.s * values.s; + temp.l = values.l * values.l * values.l; + + return temp; + +} + +// Cubit::oneof Cubit_impl::cube_union( +// const Cubit::oneof& values +// ) { +// Cubit::oneof temp; + +// ACE_UNUSED_ARG (env); +// switch (values._d ()) +// { +// case Cubit::e_0th: +// temp.o (values.o () * values.o () * values.o ()); +// break; +// case Cubit::e_1st: +// temp.s (values.s () * values.s () * values.s ()); +// break; +// case Cubit::e_2nd: +// temp.l (values.l () * values.l () * values.l ()); +// break; +// case Cubit::e_3rd: +// default: +// temp._d (values._d ()); // set the discriminant +// // use the read/write accessor +// temp.cm ().o = values.cm ().o * values.cm ().o * values.cm ().o; +// temp.cm ().s = values.cm ().s * values.cm ().s * values.cm ().s; +// temp.cm ().l = values.cm ().l * values.cm ().l * values.cm ().l; + +// } +// return temp; +// } + +void Cubit_impl::cube_long_sequence( + const Cubit::long_seq& input, + Cubit::long_seq*& output + ) { + + if (output == 0) + output = new Cubit::long_seq (input.length ()); + + output->length (input.length ()); + CORBA::ULong i = 0; + CORBA::Long x = input[0]; + output[i] = x * x * x; + +} + + +void Cubit_impl::cube_octet_sequence( + const Cubit::octet_seq& input, + Cubit::octet_seq*& output + ) { + if (output == 0) + { + output = new Cubit::octet_seq (input.length ()); + } + // We don't want to cube all the elements on the sequence because + // that will take too long and will affect the performance. Further, + // we want to show that octet sequences have constant marshalling + // time, but making a copy of each element will hide that. + CORBA::ULong i = 0; + CORBA::Octet x = input[0]; + output[i] = x * x * x; + +} + + +void Cubit_impl::shutdown( + ) { + +} + + + +// //============== Cubit_Shutdown implementation ============== +// Cubit_Shutdown_impl::Cubit_Shutdown_impl() : _sk_Cubit_Shutdown(0) { +// // Do not change the signature for this constructor + +// } + +// Cubit_Shutdown_impl::~Cubit_Shutdown_impl() { + +// } + +// void Cubit_Shutdown_impl::shutdown( +// ) { + +// } + + + +// //============== Cubit_Factory implementation ============== +// Cubit_Factory_impl::Cubit_Factory_impl() : _sk_Cubit_Factory(0) { +// // Do not change the signature for this constructor + +// } + +// Cubit_Factory_impl::~Cubit_Factory_impl() { + +// } + +// Cubit_ptr Cubit_Factory_impl::make_cubit( +// ) { +// return this->my_cubit_; +// } + + diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/cubit_impl.hh b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/cubit_impl.hh new file mode 100644 index 00000000000..8cb5312cc1f --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/cubit_impl.hh @@ -0,0 +1,48 @@ +#ifndef __cubit__impl_hh_def +#define __cubit__impl_hh_def + +#include "cubit.hh" + +// This file is a skeleton for the _impl class. + + +//============== Cubit_impl ============== +class Cubit_impl; +typedef Cubit_impl * Cubit_impl_ptr; + +class Cubit_impl : public virtual _sk_Cubit { +public: + +Cubit_impl(); +~Cubit_impl(); + +void cube_oneway( + ); +void cube_void( + ); +CORBA::Octet cube_octet( + CORBA::Octet o + ); +CORBA::Short cube_short( + CORBA::Short s + ); +CORBA::Long cube_long( + CORBA::Long l + ); +Cubit::Many cube_struct( + const Cubit::Many& values + ); +void cube_long_sequence( + const Cubit::long_seq& input, + Cubit::long_seq*& output + ); +void cube_octet_sequence( + const Cubit::octet_seq& input, + Cubit::octet_seq*& output + ); +void shutdown( + ); +private: +}; // End of class Cubit_impl + +#endif diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/initref.cfg b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/initref.cfg new file mode 100644 index 00000000000..d08f36322c2 --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/initref.cfg @@ -0,0 +1,18 @@ + #***************************************************************/ + #* initref.cfg */ + #***************************************************************/ + # This file contains information for resolving initial references. + # An entry for the Naming Service is required; others are optional. + # + # The ORB will use this file to locate the NameService which is a server + # which supports the CosNaming_NamingContext interface. The current working + # directory will be checked for the existence of this file. If it is not + # found it will be looked for in your $HOME directory. This will allow + # concurrent users to execute a unique NameService, thereby allowing for + # concurrent development on the same system. + # + #***************************************************************/ + # + # Identifier Host Name ASE Name Port Number Interface Name + + NameService polka NAMING_S 10000 CosNaming_NamingContext diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/server.cpp b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/server.cpp new file mode 100644 index 00000000000..e82e1d84cc9 --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/server.cpp @@ -0,0 +1,21 @@ +// $Id$ + +#include "server_i.h" + +ACE_RCSID(IDL_Cubit, server, "$Id$") + +int +main (int argc, char *argv[]) +{ + Cubit_Server cubit_server; + + ACE_DEBUG ((LM_DEBUG, + "\n\tIDL_Cubit:SERVER\n\n")); + if (cubit_server.init (argc, argv) == -1) + return 1; + else + { + cubit_server.run (); + } + return 0; +} diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/server_i.cpp b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/server_i.cpp new file mode 100644 index 00000000000..13208fa19c8 --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/server_i.cpp @@ -0,0 +1,180 @@ +// $Id$ + +#include "server_i.h" + +ACE_RCSID(IDL_Cubit, server_i, "$Id$") + +Cubit_Server::Cubit_Server (void) + : num_of_objs_ (1), + use_naming_service_ (1), + ior_output_file_ (0) +{ +} + +int +Cubit_Server::parse_args (void) +{ + ACE_Get_Opt get_opts (argc_, argv_, "n:o:s"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'n': // number of cubit objects we export + this->num_of_objs_ = ACE_OS::atoi (get_opts.optarg); + break; + case 'o': // output the IOR to a file. + this->ior_output_file_ = ACE_OS::fopen (get_opts.optarg, "w"); + if (this->ior_output_file_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to open %s for writing: %p\n", + get_opts.optarg), -1); + break; + case 's': // Don't use the TAO Naming Service. + this->use_naming_service_=0; + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " [-n num of cubit objects]" + " [-o ior_output_file]" + " [-s]" + "\n", + argv_ [0]), + 1); + } + + // Indicates successful parsing of command line. + return 0; +} + +int +Cubit_Server::init (int argc, + char** argv) +{ + int argct; + char *argvt[1]; + + this->argc_ = argc; + this->argv_ = argv; + + if (this->parse_args () == -1) + return -1; + + try { + // Obtain an object reference to the ORB + argvt[0] = "-ORBase cubit_S"; + argct = 1; + this->orb_ = CORBA::ORB_init(argct, argvt, ORBIDENT); + } catch (CORBA::BAD_PARAM) { + cout << "Bad parameter exception caught - ORB_init" << endl; + return -1; + } catch (CORBA::INITIALIZE) { + cout << "Initialize exception caught - ORB_init" << endl; + return -1; + } catch (CORBA::INTERNAL) { + cout << "Internal exception caught - ORB_init" << endl; + return -1; + } catch (CORBA::UNKNOWN) { + cout << "Unknown exception caught - ORB_init" << endl; + return -1; + } catch(...) { + cout << "An exception of unknown type was caught - ORB_init" << endl; + return -1; + } + + + try { + // Obtain an object reference to the BOA + argct = 0; + this->boa_ = this->orb_->BOA_init(argct, argvt, BOAIDENT); + } catch (CORBA::UNKNOWN) { + cout << "Unknown exception caught - ORB_init" << endl; + return -1; + } catch (CORBA::SystemException) { + cout << "General system exception caught - BOA_init" << endl; + return -1; + } catch (...) { + cout << "An exception of unknown type was caught - BOA_init" << endl; + return -1; + } + + ACE_NEW_RETURN (this->cubit_, + Cubit_impl, + -1); + + if (this->use_naming_service_) + return this->init_naming_service (); + + return 0; +} + +// Initialisation of Naming Service and register IDL_Cubit Context and +// cubit_factory object. + +int +Cubit_Server::init_naming_service (void) +{ + CosNaming::Name name; + CosNaming::NamingContext_ptr cubit_S_context; + CORBA::Object_ptr dummy_object; + try { + // Resolve initial references to the nameserver + dummy_object = this->orb_->resolve_initial_references("NameService"); + this->nameserver_ = CosNaming::NamingContext::_narrow(dummy_object); + } catch (CORBA::BAD_PARAM) { + cout << "Bad parameter exception caught - narrow on the NameService" << endl; + return -1; + } catch (CORBA::SystemException) { + cout << "A general system exception was caught - resolve_initial_references" << endl; + return -1; + } catch (...) { + cout << "An exception of unknown type was caught - initializing the NameService" << endl; + return -1; + } + + try { + // Bind the new context of the server name to the nameserver + name.length(1); + name[0].id = "cubit_S"; + name[0].kind = "ASE"; + cubit_S_context = this->nameserver_ -> bind_new_context(name); + } catch(...) { + cout << "Naming service exception caught - bind of cubit_S context" << endl; + return -1; + } + + try { + // Bind the server interface object to the nameserver, so the client + // can resolve this server interface object + name[0].id = "cubit"; + name[0].kind = "interface"; + cubit_S_context -> bind(name, this->cubit_); + } catch (...) { + cout << "Naming service exception caught - bind of name to cubit object" << endl; + return -1; + } + + + return 0; +} + +int +Cubit_Server::run (void) +{ + + try { + // Process client requests forever + while (1) + select_wait(-1.0); + } catch (...) { + cout << "Exception of unknown type caught when servicing requests" << endl; + return -1; + } + return 0; +} + +Cubit_Server::~Cubit_Server (void) +{ +} diff --git a/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/server_i.h b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/server_i.h new file mode 100644 index 00000000000..310338e8432 --- /dev/null +++ b/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/server_i.h @@ -0,0 +1,107 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/IDL_Cubit +// +// = FILENAME +// server_i.h +// +// = DESCRIPTION +// This class implements a simple "cube" CORBA server for the Cubit +// example using skeletons generated by the TAO ORB IDL compiler. +// +// = AUTHORS +// Nagarajan Surendran (naga@cs.wustl.edu) +// +// ============================================================================ + +#if !defined (_C_SERVER_H) +#define _C_SERVER_H + +#include "ace/Get_Opt.h" +#include "ace/Log_Msg.h" +#include "gpp_header.hh" +#include "naming.hh" +#include "cubit_impl.hh" + +class Cubit_Server +{ + // = TITLE + // Defines a Cubit Server class that implements the functionality + // of a server process as an object. + // + // = DESCRIPTION + // The interface is quite simple. A server program has to call + // init to initialize the cubit_server's state and then call run + // to run the orb. +public: + // = Initialization and termination methods. + Cubit_Server (void); + // Default constructor + + ~Cubit_Server (void); + // Destructor + + int init (int argc, + char **argv); + // Initialize the Cubit_Server state - parsing arguments and ... + + int run (void); + // Run the orb + +private: + int parse_args (void); + // Parses the commandline arguments. + + int init_naming_service (void); + // Initialises the name server and registers cubit factory with the + // name server. + + int num_of_objs_; + // Number of cubit objects we export. + + int use_naming_service_; + //Flag to tell server not to use the TAO Naming Service to register + //the cubit factory. + + FILE* ior_output_file_; + // File to output the cubit factory IOR. + + // Cubit_Factory_i factory_impl_; + // Implementation object of the cubit factory. + + //Cubit_Factory_var factory; + // Factory_var to register with NamingService. + + // Cubit_Shutdown_i shutdown_impl_; + // Implementation object of shutdown object. + + // Cubit_Shutdown_var shutdown_; + + CosNaming::NamingContext_var cubit_context_; + // Naming context for the cubit_factory. + + CosNaming::NamingContext_var nameserver_; + // Naming context for the Naming Service. + + Cubit_impl_ptr cubit_; + // pointer to the cubit object + + int argc_; + // Number of commandline arguments. + + char **argv_; + // commandline arguments. + + CORBA::ORB_ptr orb_; + // pointer to the ORB + + CORBA::BOA_ptr boa_; + // pointer to the BOA + +}; + +#endif /* _C_SERVER_H */ |