diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-07 21:21:58 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-07 21:21:58 +0000 |
commit | bf944d8c0ca4135a8a919668e89cffbd710ae3c0 (patch) | |
tree | 70f3e603dfc6fad9a07ee4736ef390cfe718df1c /TAO | |
parent | 242a692cf449bc164cb7a69c2efcbf5f6f9e027f (diff) | |
download | ATCD-bf944d8c0ca4135a8a919668e89cffbd710ae3c0.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/performance-tests/Pluggable/Makefile | 75 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/PP_Test.idl | 31 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/PP_Test_Client.cpp | 364 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/PP_Test_Client.h | 126 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/PP_Test_Server.cpp | 107 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/PP_Test_Server.h | 79 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/PP_Test_i.cpp | 121 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/PP_Test_i.h | 72 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/Pluggable.dsw | 41 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/README | 46 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/client.cpp | 29 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/client.dsp | 150 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/server.cpp | 47 | ||||
-rw-r--r-- | TAO/performance-tests/Pluggable/server.dsp | 125 |
14 files changed, 1413 insertions, 0 deletions
diff --git a/TAO/performance-tests/Pluggable/Makefile b/TAO/performance-tests/Pluggable/Makefile new file mode 100644 index 00000000000..2c5298d4d72 --- /dev/null +++ b/TAO/performance-tests/Pluggable/Makefile @@ -0,0 +1,75 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +LDLIBS = -lTAO + +IDL_SRC = PP_TestC.cpp PP_TestS.cpp +PROG_SRCS = PP_Test_Server.cpp \ + server.cpp \ + PP_Test_Client.cpp \ + client.cpp \ + PP_Test_i.cpp + +LSRC = $(IDL_SRC) $(PROG_SRCS) + +PP_TEST_SVR_OBJS = PP_TestC.o \ + PP_TestS.o \ + PP_Test_Server.o \ + PP_Test_i.o \ + server.o \ +PP_TEST_CLT_OBJS = PP_TestC.o \ + PP_TestS.o \ + PP_Test_Client.o \ + client.o \ + +BIN = server \ + client \ +BUILD = $(BIN) +VLDLIBS = $(LDLIBS:%=%$(VAR)) +VBIN = $(BIN:%=%$(VAR)) + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(TAO_ROOT)/rules.tao.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +LDFLAGS += -L$(TAO_ROOT)/tao + +.PRECIOUS: PP_TestC.cpp PP_TestS.cpp PP_TestC.h PP_TestS.h +#$(IDL_SRC): PP_Test.idl +# $(TAO_ROOT)/TAO_IDL/tao_idl PP_Test.idl + +server: $(addprefix $(VDIR),$(PP_TEST_SVR_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) + +client: $(addprefix $(VDIR),$(PP_TEST_CLT_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + -/bin/rm -rf PP_TestC.* PP_TestS.* PP_TestS_T.* + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + diff --git a/TAO/performance-tests/Pluggable/PP_Test.idl b/TAO/performance-tests/Pluggable/PP_Test.idl new file mode 100644 index 00000000000..ed5301c4781 --- /dev/null +++ b/TAO/performance-tests/Pluggable/PP_Test.idl @@ -0,0 +1,31 @@ +/* -*- C++ -*- */ +// $Id$ + +interface Pluggable_Test +{ + // = TITLE + // Defines an interface that encapsulates operations designed to + // test the TAO Pluggable Protocols implementation. + // + // = DESCRIPTION + // This interface encapsulates operations that send + // octets, voids, and octet sequences. + + oneway void send_oneway (); + // Test the basic latency of a nil oneway operation. + + void send_void (); + // Test the basic latency of a nil operation. + + oneway void shutdown (); + // shutdown the application. + +}; + +interface Pluggable_Test_Factory +{ + // = TITLE + // Creates Pluggable_Test objects. + + Pluggable_Test make_pluggable_test (); +}; diff --git a/TAO/performance-tests/Pluggable/PP_Test_Client.cpp b/TAO/performance-tests/Pluggable/PP_Test_Client.cpp new file mode 100644 index 00000000000..fc4dffc4c8d --- /dev/null +++ b/TAO/performance-tests/Pluggable/PP_Test_Client.cpp @@ -0,0 +1,364 @@ +// $Id$ + +#include "ace/Read_Buffer.h" +#include "PP_Test_Client.h" + +#include "tao/Timeprobe.h" +#include "tao/TAO_Internal.h" + +ACE_RCSID(IDL_Cubit, Cubit_Client, "$Id$") + +#if defined (ACE_ENABLE_TIMEPROBES) + + static const char *PP_Test_Client_Timeprobe_Description[] = +{ + "PP_Test_Client::send_oneway - start", + "PP_Test_Client::send_oneway - end", + + "PP_Test_Client::send_void - start", + "PP_Test_Client::send_void - end", + + "PP_Test_Client::make_pluggable - start", + "PP_Test_Client::make_pluggable - end", + + "PP_Test_Client::server_shutdown - start", + "PP_Test_Client::server_shutdown - end" +}; + +enum +{ + // Timeprobe description table start key + PP_TEST_CLIENT_SEND_ONEWAY_START = 10000, + PP_TEST_CLIENT_SEND_ONEWAY_END, + + PP_TEST_CLIENT_SEND_VOID_START, + PP_TEST_CLIENT_SEND_VOID_END, + + PP_TEST_CLIENT_MAKE_PLUGGABLE_START, + PP_TEST_CLIENT_MAKE_PLUGGABLE_END, + + PP_TEST_CLIENT_SERVER_SHUTDOWN_START, + PP_TEST_CLIENT_SERVER_SHUTDOWN_END +}; + +// Setup Timeprobes +ACE_TIMEPROBE_EVENT_DESCRIPTIONS (PP_Test_Client_Timeprobe_Description, + PP_TEST_CLIENT_SEND_ONEWAY_START); + +#endif /* ACE_ENABLE_TIMEPROBES */ + +// Constructor. +PP_Test_Client::PP_Test_Client (int shutdown) + : factory_key_ (0), + loop_count_ (1), + shutdown_ (shutdown), + objref_ (Pluggable_Test::_nil ()), + call_count_ (0), + error_count_ (0), + factory_ior_file_ (0), + f_handle_ (ACE_INVALID_HANDLE), + only_void_ (0), + only_oneway_ (0) +{ +} + +// Reads the Cubit factory ior from a file + +int +PP_Test_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_); + char *data = ior_buffer.read (); + + if (data == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to allocate memory to read ior: %p\n"), + -1); + + this->factory_key_ = ACE_OS::strdup (data); + ior_buffer.alloc ()->free (data); + + return 0; +} + +// Parses the command line arguments and returns an error status. + +int +PP_Test_Client::parse_args (void) +{ + ACE_Get_Opt get_opts (argc_, argv_, "ovdn:f:k:x"); + int c; + int result; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'v': + this->only_void_ = 1; + break; + case 'o': + this->only_oneway_ = 1; + break; + case 'd': // debug flag + TAO_debug_level++; + break; + 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->factory_key_ = + ACE_OS::strdup (get_opts.optarg); + break; + case 'x': + ACE_DEBUG ((LM_DEBUG, "We will shutdown the server\n")); + this->shutdown_ = 1; + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " [-v]" + " [-o]" + " [-d]" + " [-n loopcount]" + " [-f factory-obj-ref-key-file]" + " [-k obj-ref-key]" + " [-x]" + "\n", + this->argv_ [0]), + -1); + } + + // Indicates successful parsing of command line. + return 0; +} + +// Oneway test. + +void +PP_Test_Client::send_oneway (void) +{ + { + ACE_FUNCTION_TIMEPROBE (PP_TEST_CLIENT_SEND_ONEWAY_START); + + this->objref_->send_oneway (this->env_); + } + + this->call_count_++; + + if (this->env_.exception () != 0) + { + this->env_.print_exception ("from send_oneway"); + this->error_count_++; + } +} + +// Twoway test. + +void +PP_Test_Client::send_void (void) +{ + { + ACE_FUNCTION_TIMEPROBE (PP_TEST_CLIENT_SEND_VOID_START); + + this->objref_->send_void (this->env_); + } + + this->call_count_++; + + if (this->env_.exception () != 0) + { + this->env_.print_exception ("from send_void"); + this->error_count_++; + } +} + +// Send an octet + +// Execute client example code. + +int +PP_Test_Client::run () +{ + if (this->only_void_) + return this->run_void (); + + if (this->only_oneway_) + return this->run_oneway (); + + u_int i; + + // Show the results one type at a time. + + // VOID + this->call_count_ = 0; + this->error_count_ = 0; + for (i = 0; i < this->loop_count_; i++) + this->send_void (); + + // ONEWAY + this->call_count_ = 0; + this->error_count_ = 0; + for (i = 0; i < this->loop_count_; i++) + this->send_oneway (); + + // This causes a memPartFree on VxWorks. + ACE_FUNCTION_TIMEPROBE (PP_TEST_CLIENT_SERVER_SHUTDOWN_START); + this->shutdown_server (this->shutdown_); + + return this->error_count_ == 0 ? 0 : 1; +} + +int +PP_Test_Client::shutdown_server (int do_shutdown) +{ + if (do_shutdown) + { + ACE_DEBUG ((LM_DEBUG, "shutdown on Pluggable_Test object\n")); + this->objref_->shutdown (this->env_); + this->env_.print_exception ("server, please ACE_OS::exit"); + } + + return 0; +} + +int +PP_Test_Client::run_oneway (void) +{ + u_int i; + + // ONEWAY + this->call_count_ = 0; + this->error_count_ = 0; + for (i = 0; i < this->loop_count_; i++) + this->send_oneway (); + if (this->shutdown_) + { + ACE_DEBUG ((LM_DEBUG, "shutdown on Pluggable_Test object\n")); + ACE_FUNCTION_TIMEPROBE (PP_TEST_CLIENT_SERVER_SHUTDOWN_START); + this->objref_->shutdown (this->env_); + this->env_.print_exception ("server, please ACE_OS::exit"); + } + + return this->error_count_ == 0 ? 0 : 1; +} + +int +PP_Test_Client::run_void (void) +{ + u_int i; + + // VOID + this->call_count_ = 0; + this->error_count_ = 0; + for (i = 0; i < this->loop_count_; i++) + this->send_void (); + + if (this->shutdown_) + { + ACE_DEBUG ((LM_DEBUG, "shutdown on Pluggable_Test object\n")); + ACE_FUNCTION_TIMEPROBE (PP_TEST_CLIENT_SERVER_SHUTDOWN_START); + this->objref_->shutdown (this->env_); + this->env_.print_exception ("server, please ACE_OS::exit"); + } + + return this->error_count_ == 0 ? 0 : 1; +} + +PP_Test_Client::~PP_Test_Client (void) +{ + // Free resources and close the IOR files. + if (this->factory_ior_file_) + ACE_OS::fclose (this->factory_ior_file_); + + if (this->f_handle_ != ACE_INVALID_HANDLE) + ACE_OS::close (this->f_handle_); + + if (this->factory_key_ != 0) + ACE_OS::free (this->factory_key_); +} + +int +PP_Test_Client::init (int argc, char **argv) +{ + this->argc_ = argc; + this->argv_ = argv; + + TAO_TRY + { + // Retrieve the ORB. + this->orb_ = CORBA::ORB_init (this->argc_, + this->argv_, + "internet", + TAO_TRY_ENV); + TAO_CHECK_ENV; + // Parse command line and verify parameters. + if (this->parse_args () == -1) + return -1; + + if (this->factory_key_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "%s: no factory key specified\n", + this->argv_[0]), + -1); + + CORBA::Object_var factory_object = + this->orb_->string_to_object (this->factory_key_, + TAO_TRY_ENV); + TAO_CHECK_ENV; + + this->factory_ = + Pluggable_Test_Factory::_narrow (factory_object.in(), + TAO_TRY_ENV); + TAO_CHECK_ENV; + + if (CORBA::is_nil (this->factory_.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + "invalid factory key <%s>\n", + this->factory_key_), + -1); + + ACE_DEBUG ((LM_DEBUG, + "Factory received OK\n")); + + // Now retrieve the Pluggable_Test obj ref corresponding to the key. + { + ACE_FUNCTION_TIMEPROBE (PP_TEST_CLIENT_MAKE_PLUGGABLE_START); + + this->objref_ = + this->factory_->make_pluggable_test (TAO_TRY_ENV); + } + TAO_CHECK_ENV; + + if (CORBA::is_nil (this->objref_.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + "null objref returned by factory\n"), + -1); + } + TAO_CATCHANY + { + TAO_TRY_ENV.print_exception ("Pluggable_Test::init"); + return -1; + } + TAO_ENDTRY; + + return 0; +} + diff --git a/TAO/performance-tests/Pluggable/PP_Test_Client.h b/TAO/performance-tests/Pluggable/PP_Test_Client.h new file mode 100644 index 00000000000..e7761c348c1 --- /dev/null +++ b/TAO/performance-tests/Pluggable/PP_Test_Client.h @@ -0,0 +1,126 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/performance-tests/Pluggable +// +// = FILENAME +// PP_Test_Client.h +// +// = DESCRIPTION +// This class implements some basic no-op twoway and oneway requests +// to time the latency of the pluggable protocol implementation. +// +// = AUTHOR +// Jeff Parsons <parsons@cs.wustl.edu> +// +// ============================================================================ + +#ifndef _PP_TEST_CLIENT_H +#define _PP_TEST_CLIENT_H + +#include "ace/Get_Opt.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/corba.h" +#include "PP_TestC.h" + +class PP_Test_Client +{ + // = TITLE + // Defines a class that encapsulates behaviour of the PP_Test 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 + // PP_Teset CORBA server. All the complexity for initializing the + // server is hidden in the class. Just the run() interface is needed. +public: + // = Constructor and destructor. + PP_Test_Client (int shutdown = 0); + // Use <testing_collocation> to control some client's behaviors. + + ~PP_Test_Client (void); + + int run (void); + // Execute client example code. + + int init (int argc, char **argv); + // Initialize the client communication endpoint with server. + // <collocation_test_ior> is used to pass in the ior file name. + +private: + 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 send_oneway (void); + // Oneway operation test. + + void send_void (void); + // Twoway operation test. + + int run_void (void); + // This method runs only the send_void() test. + + int run_oneway (void); + // This method runs only the send_oneway() test. + + int shutdown_server (int do_shutdown); + // Invoke the method with <do_shutdown> != 0 to shutdown the server. + + int argc_; + // # of arguments on the command line. + + char **argv_; + // arguments from command line. + + char *factory_key_; + // Key of factory obj ref. + + u_int loop_count_; + // Number of times to do the send operations. + + int shutdown_; + // Flag to tell server to shutdown. + + Pluggable_Test_Factory_var factory_; + // factory pointer for cubit. + + CORBA::Environment env_; + // Environment variable. + + Pluggable_Test_var objref_; + // Pluggable_Test obj ref. + + CORBA::ORB_var orb_; + // Remember our orb. + + u_int call_count_; + // # of calls made to functions. + + u_int error_count_; + // # of errors incurred in the lifetime of the application. + + FILE *factory_ior_file_; + // File from which to obtain the IOR. + + ACE_HANDLE f_handle_; + // File handle to read the IOR. + + int only_void_; + // Run only the cube_void() test. + + int only_oneway_; + // Run only the cube_oneway() test. +}; + +#endif /* _PP_TEST_CLIENT_H */ diff --git a/TAO/performance-tests/Pluggable/PP_Test_Server.cpp b/TAO/performance-tests/Pluggable/PP_Test_Server.cpp new file mode 100644 index 00000000000..13d61f5e2d0 --- /dev/null +++ b/TAO/performance-tests/Pluggable/PP_Test_Server.cpp @@ -0,0 +1,107 @@ +// $Id$ + +#include "PP_Test_Server.h" +#include "tao/TAO_Internal.h" + +ACE_RCSID(IDL_Cubit, Cubit_Server, "$Id$") + +PP_Test_Server::PP_Test_Server (void) + : ior_output_file_ (0) +{ +} + +int +PP_Test_Server::parse_args (void) +{ + ACE_Get_Opt get_opts (argc_, argv_, "do:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'd': // debug flag. + TAO_debug_level++; + 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 '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " [-d]" + " [-o] <ior_output_file>" + "\n", + argv_ [0]), + 1); + } + + // Indicates successful parsing of command line. + return 0; +} + +int +PP_Test_Server::init (int argc, + char** argv, + CORBA::Environment& env) +{ + // Call the init of <TAO_ORB_Manager> to initialize the ORB and + // create a child POA under the root POA. + if (this->orb_manager_.init_child_poa (argc, + argv, + "child_poa", + env) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "init_child_poa"), + -1); + TAO_CHECK_ENV_RETURN (env,-1); + this->argc_ = argc; + this->argv_ = argv; + + this->parse_args (); + // @@ Check for the return value here. + + // Get the orb + CORBA::ORB_var orb = this->orb_manager_.orb (); + + // Now create the implementations + this->factory_impl_ = new Pluggable_Test_Factory_i (orb.in ()); + + CORBA::String_var str = + this->orb_manager_.activate_under_child_poa ("factory", + this->factory_impl_, + env); + ACE_DEBUG ((LM_DEBUG, + "The IOR is: <%s>\n", + str.in ())); + + if (this->ior_output_file_) + { + ACE_OS::fprintf (this->ior_output_file_, + "%s", + str.in ()); + ACE_OS::fclose (this->ior_output_file_); + } + + return 0; +} + +int +PP_Test_Server::run (CORBA::Environment& env) +{ + if (this->orb_manager_.run (env) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "PP_Test_Server::run"), + -1); + return 0; +} + +PP_Test_Server::~PP_Test_Server (void) +{ + delete this->factory_impl_; +} diff --git a/TAO/performance-tests/Pluggable/PP_Test_Server.h b/TAO/performance-tests/Pluggable/PP_Test_Server.h new file mode 100644 index 00000000000..3dd33c53616 --- /dev/null +++ b/TAO/performance-tests/Pluggable/PP_Test_Server.h @@ -0,0 +1,79 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/performance-tests/Pluggable +// +// = FILENAME +// PP_Test_Server.h +// +// = DESCRIPTION +// This class implements simple oneway and twoway no-op requests +// to time latency and overhead of the pluggable protocol functionality. +// +// = AUTHOR +// Jeff Parsons <parsons@cs.wustl.edu> +// +// ============================================================================ + +#ifndef _PP_TEST_SERVER_H +#define _PP_TEST_SERVER_H + +#include "ace/Get_Opt.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/TAO.h" +#include "PP_Test_i.h" + +class PP_Test_Server +{ + // = TITLE + // Defines a 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 server's state and then call run + // to run the orb. +public: + // = Initialization and termination methods. + PP_Test_Server (void); + // Default constructor + + ~PP_Test_Server (void); + // Destructor + + int init (int argc, + char **argv, + CORBA::Environment& env); + // Initialize the server state - parsing arguments, etc. + + int run (CORBA::Environment& env); + // Run the orb + +private: + int parse_args (void); + // Parses the commandline arguments. + + FILE* ior_output_file_; + // File to output the cubit factory IOR. + + TAO_ORB_Manager orb_manager_; + // The ORB manager. + + Pluggable_Test_Factory_i *factory_impl_; + // Implementation object of the Pluggable Test factory. + + int argc_; + // Number of commandline arguments. + + char **argv_; + // commandline arguments. +}; + +#endif /* _PP_TEST_SERVER_H */ diff --git a/TAO/performance-tests/Pluggable/PP_Test_i.cpp b/TAO/performance-tests/Pluggable/PP_Test_i.cpp new file mode 100644 index 00000000000..e53c0b48dfd --- /dev/null +++ b/TAO/performance-tests/Pluggable/PP_Test_i.cpp @@ -0,0 +1,121 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/performance-tests/Pluggable +// +// = FILENAME +// PP_Test_i.cpp +// +// = AUTHOR +// Jeff Parsons <parsons@cs.wustl.edu> +// +// ============================================================================ + +#include "tao/corba.h" +#include "tao/Timeprobe.h" +#include "PP_Test_i.h" + +ACE_RCSID(IDL_Cubit, Cubit_Client, "$Id$") + +#if defined (ACE_ENABLE_TIMEPROBES) + +static const char *PP_Test_i_Timeprobe_Description[] = +{ + "PP_Test_i::send_oneway - start", + "PP_Test_i::send_oneway - end", + + "PP_Test_i::send_void - start", + "PP_Test_i::send_void - end", + + "PP_Test_i::make_pluggable - start", + "PP_Test_i::make_pluggable - end", + + "PP_Test_i::server_shutdown - start", + "PP_Test_i::server_shutdown - end" +}; + +enum +{ + // Timeprobe description table start key + PP_TEST_I_SEND_ONEWAY_START = 10100, + PP_TEST_I_SEND_ONEWAY_END, + + PP_TEST_I_SEND_VOID_START, + PP_TEST_I_SEND_VOID_END, + + PP_TEST_I_MAKE_PLUGGABLE_START, + PP_TEST_I_MAKE_PLUGGABLE_END, + + PP_TEST_I_SERVER_SHUTDOWN_START, + PP_TEST_I_SERVER_SHUTDOWN_END +}; + +// Setup Timeprobes +ACE_TIMEPROBE_EVENT_DESCRIPTIONS (PP_Test_i_Timeprobe_Description, + PP_TEST_I_SEND_ONEWAY_START); + +#endif /* ACE_ENABLE_TIMEPROBES */ + +// Factory Constructor + +Pluggable_Test_Factory_i::Pluggable_Test_Factory_i (CORBA::ORB_ptr orb) + : my_pluggable_test_ (orb) +{ +} + +// Factory Destructor + +Pluggable_Test_Factory_i::~Pluggable_Test_Factory_i (void) +{ +} + +Pluggable_Test_ptr +Pluggable_Test_Factory_i::make_pluggable_test (CORBA::Environment &env) +{ + ACE_FUNCTION_TIMEPROBE (PP_TEST_I_MAKE_PLUGGABLE_START); + return my_pluggable_test_._this (env); +} + +// Constructor + +PP_Test_i::PP_Test_i (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +// Destructor + +PP_Test_i::~PP_Test_i (void) +{ +} + +// Oneway send + +void +PP_Test_i::send_oneway (CORBA::Environment &) +{ + ACE_FUNCTION_TIMEPROBE (PP_TEST_I_SEND_ONEWAY_START); +} + +// Twoway send + +void +PP_Test_i::send_void (CORBA::Environment &) +{ + ACE_FUNCTION_TIMEPROBE (PP_TEST_I_SEND_VOID_START); +} + +// Shutdown. + +void PP_Test_i::shutdown (CORBA::Environment &) +{ + ACE_DEBUG ((LM_DEBUG, + "%s\n", + "PP_Test_i is shutting down")); + + ACE_FUNCTION_TIMEPROBE (PP_TEST_I_SERVER_SHUTDOWN_START); + + this->orb_->shutdown (); +} diff --git a/TAO/performance-tests/Pluggable/PP_Test_i.h b/TAO/performance-tests/Pluggable/PP_Test_i.h new file mode 100644 index 00000000000..02687f34a64 --- /dev/null +++ b/TAO/performance-tests/Pluggable/PP_Test_i.h @@ -0,0 +1,72 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/performance-tests/Pluggable +// +// = FILENAME +// PP_Test_i.h +// +// = AUTHOR +// Jeff Parsons <parsons@cs.wustl.edu> +// +// ============================================================================ + +#ifndef _PP_TEST_I_H +#define _PP_TEST_I_H + +#include "PP_TestS.h" + +class PP_Test_i : public POA_Pluggable_Test +{ + // = TITLE + // Illustrates how to integrate a servant with the generated + // skeleton. + // + // = DESCRIPTION + // Implementation of the example at the servant side. + // Sends a no-op oneway and twoway request. +public: + PP_Test_i (CORBA::ORB_ptr orb); + // Constructor + + ~PP_Test_i (void); + // Destructor + + virtual void send_oneway (CORBA::Environment &env); + // Test a oneway call. + + virtual void send_void (CORBA::Environment &env); + // Test a twoway call. + + virtual void shutdown (CORBA::Environment &env); + // Shutdown routine. + +protected: + CORBA::ORB_var orb_; + // Keep a pointer to the ORB so we can shut it down. +}; + +class Pluggable_Test_Factory_i: public POA_Pluggable_Test_Factory +{ + // = TITLE + // Pluggable_Test_Factory_i + // + // = DESCRIPTION + // Factory object returning the Pluggable_Test objrefs +public: + Pluggable_Test_Factory_i (CORBA::ORB_ptr orb); + // Constructor. + + ~Pluggable_Test_Factory_i (void); + // Destructor. + + virtual Pluggable_Test_ptr make_pluggable_test (CORBA::Environment &env); + // Make a Pluggable Test object. + +private: + PP_Test_i my_pluggable_test_; +}; + +#endif /* _PP_TEST_I_H */ diff --git a/TAO/performance-tests/Pluggable/Pluggable.dsw b/TAO/performance-tests/Pluggable/Pluggable.dsw new file mode 100644 index 00000000000..c44ab14c480 --- /dev/null +++ b/TAO/performance-tests/Pluggable/Pluggable.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "client"=".\client\client.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "server"=".\server\server.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/performance-tests/Pluggable/README b/TAO/performance-tests/Pluggable/README new file mode 100644 index 00000000000..302fa470914 --- /dev/null +++ b/TAO/performance-tests/Pluggable/README @@ -0,0 +1,46 @@ +$Id$ + +The tests in this directory time the latency contributed by +various parts of the ORB, but mostly the emphasis is on the +contribution due to the pluggable protocols code. So far, the +output is only to the screen, and is created using the ACE +Timeprobe class. At various points in the ORB code and in this +test code, an ACE Timeprobe is inserted. When this point is +passed in the execution, a timestamp is taken and added to a +table. When the test finishes, the relative times are output, +START being the first, or zero, entry, and the following +values are the offset in microseconds. Each value has a label +associated with it when the timeprobes are inserted. + +There are currently two tests. Either or both can be executed +in a single run by using the appropriate command line options +listed below. Since we are not interested in the time spent +in the actual operation, but only in the framework overhead, +we have code for a oneway and a twoway request that neither +pass nor return any values. + +Usage: +The client command line options are: + [-v] run only the 2-way void test + [-o] run only the 1-way void test + [-d] increment the TAO debug level + [-n loopcount] # of executions (defaults to 1) + [-f <filename>] read IOR from <filename> + [-k <string>] read IOR from command line + [-x] shut down server when finished + +NOTE: Unless the server is shut down, it will not +display its timeprobe information. If the client runs +twice, for example, and then the server is shut down, +it will then display the results from both runs. + +The server command line options are: + [-d] increment the TAO debug level + [-o] <filename> write the IOR to <filename> + + +NOTE: To display the timeprobe info, ACE must be built with +the macro ACE_COMPILE_TIMEPROBES defined somewhere, usually +in config.h. Otherwise the individual timeprobe macros are +ignored. + diff --git a/TAO/performance-tests/Pluggable/client.cpp b/TAO/performance-tests/Pluggable/client.cpp new file mode 100644 index 00000000000..ab956453d46 --- /dev/null +++ b/TAO/performance-tests/Pluggable/client.cpp @@ -0,0 +1,29 @@ +// $Id$ + +#include "PP_Test_Client.h" +#include "tao/Timeprobe.h" + +ACE_RCSID(IDL_Cubit, client, "$Id$") + +// This function runs the client test. + +int +main (int argc, char **argv) +{ + PP_Test_Client pp_test_client; + + ACE_DEBUG ((LM_DEBUG, + "\n\tPluggable_Test: client\n\n")); + + if (pp_test_client.init (argc, argv) == -1) + return 1; + + int retval = pp_test_client.run (); + + ACE_TIMEPROBE_PRINT; + + int status; + ACE_OS::thr_exit (&status); + + return retval; +} diff --git a/TAO/performance-tests/Pluggable/client.dsp b/TAO/performance-tests/Pluggable/client.dsp new file mode 100644 index 00000000000..491eb9bed18 --- /dev/null +++ b/TAO/performance-tests/Pluggable/client.dsp @@ -0,0 +1,150 @@ +# Microsoft Developer Studio Project File - Name="client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak" CFG="client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ".\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib TAOd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "client - Win32 Release"
+# Name "client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\PP_Test_Client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\PP_TestC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\PP_TestS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\PP_Test_Client.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\PP_TestC.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\PP_TestC.i
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\PP_Test.idl
+
+!IF "$(CFG)" == "client - Win32 Release"
+
+!ELSEIF "$(CFG)" == "client - Win32 Debug"
+
+USERDEP__PP_TE="..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO IDL Compiler
+InputPath=.\PP_Test.idl
+InputName=PP_Test
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ tao_idl $(InputName).idl
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/performance-tests/Pluggable/server.cpp b/TAO/performance-tests/Pluggable/server.cpp new file mode 100644 index 00000000000..118abc786c8 --- /dev/null +++ b/TAO/performance-tests/Pluggable/server.cpp @@ -0,0 +1,47 @@ +// $Id$ + +#include "PP_Test_Server.h" +#include "tao/Timeprobe.h" + +ACE_RCSID(IDL_Cubit, server, "$Id$") + +// This runs the server test. + +int +main (int argc, char *argv[]) +{ + PP_Test_Server pp_test_server; + + ACE_DEBUG ((LM_DEBUG, + "\n\tPluggable_Test: server\n\n")); + TAO_TRY + { + int status = pp_test_server.init (argc, argv, TAO_TRY_ENV); + + if (status == -1) + { + TAO_TRY_ENV.print_exception ("Initialization Exception"); + return -1; + } + else + { + pp_test_server.run (TAO_TRY_ENV); + TAO_CHECK_ENV; + } + } + TAO_CATCH (CORBA::SystemException, sysex) + { + ACE_UNUSED_ARG (sysex); + TAO_TRY_ENV.print_exception ("System Exception"); + return -1; + } + TAO_CATCH (CORBA::UserException, userex) + { + ACE_UNUSED_ARG (userex); + TAO_TRY_ENV.print_exception ("User Exception"); + return -1; + } + TAO_ENDTRY; + ACE_TIMEPROBE_PRINT; + return 0; +} diff --git a/TAO/performance-tests/Pluggable/server.dsp b/TAO/performance-tests/Pluggable/server.dsp new file mode 100644 index 00000000000..458261e6481 --- /dev/null +++ b/TAO/performance-tests/Pluggable/server.dsp @@ -0,0 +1,125 @@ +# Microsoft Developer Studio Project File - Name="server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak" CFG="server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ".\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib TAOd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "server - Win32 Release"
+# Name "server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\PP_Test_i.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\PP_Test_Server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\PP_TestC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\PP_TestS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\server.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\PP_Test_i.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\PP_Test_Server.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\PP_TestS.h
+# End Source File
+# End Group
+# End Target
+# End Project
|