From cd1d46fbcac272bc0430a6a56638c8d6fb5bb370 Mon Sep 17 00:00:00 2001 From: naga Date: Sun, 17 May 1998 17:58:39 +0000 Subject: *** empty log message *** --- TAO/orbsvcs/tests/AVStreams/benchmark/Makefile | 221 ++++++++++++++++++++++- TAO/orbsvcs/tests/AVStreams/benchmark/child.cpp | 63 +++++++ TAO/orbsvcs/tests/AVStreams/benchmark/child.h | 45 +++++ TAO/orbsvcs/tests/AVStreams/benchmark/client.cpp | 44 +++-- TAO/orbsvcs/tests/AVStreams/benchmark/client.h | 6 +- TAO/orbsvcs/tests/AVStreams/benchmark/server.cpp | 129 +++++++++++++ TAO/orbsvcs/tests/AVStreams/benchmark/server.h | 48 +++++ 7 files changed, 536 insertions(+), 20 deletions(-) create mode 100644 TAO/orbsvcs/tests/AVStreams/benchmark/child.cpp create mode 100644 TAO/orbsvcs/tests/AVStreams/benchmark/child.h create mode 100644 TAO/orbsvcs/tests/AVStreams/benchmark/server.cpp create mode 100644 TAO/orbsvcs/tests/AVStreams/benchmark/server.h diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/Makefile b/TAO/orbsvcs/tests/AVStreams/benchmark/Makefile index fc2b77cbf65..a49a3be098e 100644 --- a/TAO/orbsvcs/tests/AVStreams/benchmark/Makefile +++ b/TAO/orbsvcs/tests/AVStreams/benchmark/Makefile @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------- # $Id$ # -# Top-level Makefile for the AVStreams demo of the TAO ORB +# Top-level Makefile for Benchmarking of AVStreams of TAO. # #---------------------------------------------------------------------------- @@ -13,17 +13,24 @@ LDLIBS = -lorbsvcs -lTAO SERVER_OBJS = server.o CLIENT_OBJS = client.o +CHILD_OBJS = child.o -BIN = server client +BIN = server client child BUILD = $(BIN) VLDLIBS = $(LDLIBS:%=%$(VAR)) +FILES = client server child +DEFS = $(addsuffix .h,$(FILES)) +LSRC = $(addsuffix .cpp,$(FILES)) + + #---------------------------------------------------------------------------- # 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.bin.GNU @@ -44,6 +51,9 @@ server:$(addprefix $(VDIR),$(SERVER_OBJS)) client:$(addprefix $(VDIR),$(CLIENT_OBJS)) $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) +child:$(addprefix $(VDIR),$(CHILD_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) + realclean: clean -/bin/rm -rf @@ -51,6 +61,211 @@ realclean: clean # DO NOT DELETE THIS LINE -- g++dep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - +.obj/client.o .obj/client.so .shobj/client.o .shobj/client.so: client.cpp client.h \ + $(ACE_ROOT)/ace/Reactor.h \ + $(ACE_ROOT)/ace/Handle_Set.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/inc_user_config.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/Handle_Set.i \ + $(ACE_ROOT)/ace/Timer_Queue.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Timer_Queue_T.h \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Timer_Queue_T.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Reactor.i \ + $(ACE_ROOT)/ace/Reactor_Impl.h \ + $(ACE_ROOT)/ace/ARGV.h \ + $(ACE_ROOT)/ace/ARGV.i \ + $(TAO_ROOT)/tao/TAO.h \ + $(TAO_ROOT)/tao/corba.h \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i \ + $(ACE_ROOT)/ace/SOCK_Stream.h \ + $(ACE_ROOT)/ace/SOCK_IO.h \ + $(ACE_ROOT)/ace/SOCK.h \ + $(ACE_ROOT)/ace/Addr.h \ + $(ACE_ROOT)/ace/Addr.i \ + $(ACE_ROOT)/ace/IPC_SAP.h \ + $(ACE_ROOT)/ace/IPC_SAP.i \ + $(ACE_ROOT)/ace/SOCK.i \ + $(ACE_ROOT)/ace/SOCK_IO.i \ + $(ACE_ROOT)/ace/INET_Addr.h \ + $(ACE_ROOT)/ace/INET_Addr.i \ + $(ACE_ROOT)/ace/SOCK_Stream.i \ + $(ACE_ROOT)/ace/Hash_Map_Manager.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/SOCK_Acceptor.h \ + $(ACE_ROOT)/ace/Time_Value.h \ + $(ACE_ROOT)/ace/SOCK_Acceptor.i \ + $(ACE_ROOT)/ace/SOCK_Connector.h \ + $(ACE_ROOT)/ace/SOCK_Connector.i \ + $(ACE_ROOT)/ace/Strategies.h \ + $(ACE_ROOT)/ace/Strategies_T.h \ + $(ACE_ROOT)/ace/Service_Config.h \ + $(ACE_ROOT)/ace/Service_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.i \ + $(ACE_ROOT)/ace/Service_Object.i \ + $(ACE_ROOT)/ace/Service_Config.i \ + $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ + $(ACE_ROOT)/ace/Synch_Options.h \ + $(ACE_ROOT)/ace/Connector.h \ + $(ACE_ROOT)/ace/Map_Manager.h \ + $(ACE_ROOT)/ace/Map_Manager.i \ + $(ACE_ROOT)/ace/Svc_Handler.h \ + $(ACE_ROOT)/ace/Task.h \ + $(ACE_ROOT)/ace/Thread_Manager.h \ + $(ACE_ROOT)/ace/Thread_Manager.i \ + $(ACE_ROOT)/ace/Task.i \ + $(ACE_ROOT)/ace/Task_T.h \ + $(ACE_ROOT)/ace/Message_Queue.h \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Message_Block.i \ + $(ACE_ROOT)/ace/IO_Cntl_Msg.h \ + $(ACE_ROOT)/ace/Message_Queue.i \ + $(ACE_ROOT)/ace/Task_T.i \ + $(ACE_ROOT)/ace/Dynamic.h \ + $(ACE_ROOT)/ace/Dynamic.i \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Svc_Handler.i \ + $(ACE_ROOT)/ace/Connector.i \ + $(ACE_ROOT)/ace/Acceptor.h \ + $(ACE_ROOT)/ace/Acceptor.i \ + $(TAO_ROOT)/tao/compat/objbase.h \ + $(TAO_ROOT)/tao/compat/initguid.h \ + $(TAO_ROOT)/tao/orbconf.h \ + $(TAO_ROOT)/tao/Align.h \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/Sequence.h \ + $(TAO_ROOT)/tao/Sequence.i \ + $(TAO_ROOT)/tao/Sequence_T.h \ + $(TAO_ROOT)/tao/Sequence_T.i \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/Exception.h \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/Any.h \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/params.h \ + $(TAO_ROOT)/tao/params.i \ + $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ + $(TAO_ROOT)/tao/Server_Strategy_Factory.h \ + $(TAO_ROOT)/tao/default_client.h \ + $(TAO_ROOT)/tao/default_client.i \ + $(TAO_ROOT)/tao/default_server.h \ + $(TAO_ROOT)/tao/ORB_Strategies_T.h \ + $(TAO_ROOT)/tao/ORB_Strategies_T.i \ + $(TAO_ROOT)/tao/default_server.i \ + $(TAO_ROOT)/tao/NVList.h \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/Request.h \ + $(TAO_ROOT)/tao/Request.i \ + $(TAO_ROOT)/tao/Stub.h \ + $(TAO_ROOT)/tao/Stub.i \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/Server_Request.h \ + $(TAO_ROOT)/tao/Server_Request.i \ + $(TAO_ROOT)/tao/Typecode.h \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/Marshal.h \ + $(TAO_ROOT)/tao/Marshal.i \ + $(TAO_ROOT)/tao/CDR.h \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/POA.h \ + $(TAO_ROOT)/tao/POAC.h \ + $(TAO_ROOT)/tao/POAC.i \ + $(TAO_ROOT)/tao/Servant_Base.h \ + $(TAO_ROOT)/tao/POAS.h \ + $(TAO_ROOT)/tao/PolicyS.h \ + $(TAO_ROOT)/tao/PolicyS.i \ + $(TAO_ROOT)/tao/POAS.i \ + $(TAO_ROOT)/tao/Object_Table.h \ + $(TAO_ROOT)/tao/Connect.h \ + $(TAO_ROOT)/tao/Connect.i \ + $(TAO_ROOT)/tao/ORB_Core.h \ + $(TAO_ROOT)/tao/ORB_Core.i \ + $(ACE_ROOT)/ace/Dynamic_Service.h \ + $(TAO_ROOT)/tao/Operation_Table.h \ + $(TAO_ROOT)/tao/debug.h \ + $(TAO_ROOT)/tao/IIOP_Object.h \ + $(TAO_ROOT)/tao/IIOP_Object.i \ + $(TAO_ROOT)/tao/IIOP_ORB.h \ + $(TAO_ROOT)/tao/IIOP_ORB.i \ + $(TAO_ROOT)/tao/IIOP_Interpreter.h \ + $(TAO_ROOT)/tao/GIOP.h \ + $(TAO_ROOT)/tao/GIOP.i \ + $(TAO_ROOT)/tao/singletons.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/orbsvcs_export.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.i \ + $(ACE_ROOT)/ace/SOCK_Dgram.h \ + $(ACE_ROOT)/ace/SOCK_Dgram.i \ + $(TAO_ROOT)/orbsvcs/orbsvcs/AV/AVStreams_i.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceS.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceC.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceC.i \ + $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceS.i \ + $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsS.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsC.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsC.i \ + $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsS.i \ + $(TAO_ROOT)/orbsvcs/orbsvcs/Property/CosPropertyService_i.h \ + $(ACE_ROOT)/ace/Process.h \ + $(ACE_ROOT)/ace/Process.i \ + $(TAO_ROOT)/orbsvcs/orbsvcs/AV/Endpoint_Strategy.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlS.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlC.h \ + $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlC.i \ + $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlS.i +.obj/server.o .obj/server.so .shobj/server.o .shobj/server.so: server.cpp server.h +.obj/child.o .obj/child.so .shobj/child.o .shobj/child.so: child.cpp # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/child.cpp b/TAO/orbsvcs/tests/AVStreams/benchmark/child.cpp new file mode 100644 index 00000000000..bb410808094 --- /dev/null +++ b/TAO/orbsvcs/tests/AVStreams/benchmark/child.cpp @@ -0,0 +1,63 @@ +// $Id$ + + +#include "child.h" +// Bench_Server_StreamEndPoint methods. + +int +Bench_Server_StreamEndPoint::handle_open (void) +{ + return 0; +} + +int +Bench_Server_StreamEndPoint::handle_close (void) +{ + // called when streamendpoint is being destructed + return 0; +} + +int +Bench_Server_StreamEndPoint::handle_stop (const AVStreams::flowSpec &the_spec, + CORBA::Environment &env) +{ + return 0; +} + +int +Bench_Server_StreamEndPoint::handle_start (const AVStreams::flowSpec &the_spec, + CORBA::Environment &env) +{ + return 0; +} + +int +Bench_Server_StreamEndPoint::handle_destroy (const AVStreams::flowSpec &the_spec, + CORBA::Environment &env) +{ + return 0; +} + +CORBA::Boolean +Bench_Server_StreamEndPoint::handle_connection_requested (AVStreams::flowSpec &the_spec, + CORBA::Environment &env) +{ + ACE_DEBUG ((LM_DEBUG,"(%P|%t) Bench_Server_StreamEndPoint::handle_connection_requested:() %s \n", + the_spec[0])); + return CORBA::B_TRUE; +} + +// -------------------------------------------------------------------------------- + +int +main (int argc, char **argv) +{ + TAO_AV_Child_Process_B bench_child; + + if (bench_child.init (argc,argv) == -1) + return 1; + if (bench_child.run () == -1) + return 2; + + return 0; +} diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/child.h b/TAO/orbsvcs/tests/AVStreams/benchmark/child.h new file mode 100644 index 00000000000..6493279305f --- /dev/null +++ b/TAO/orbsvcs/tests/AVStreams/benchmark/child.h @@ -0,0 +1,45 @@ +// $Id$ + +#if !defined (TAO_AV_BENCH_CHILD_H) +#define TAO_AV_BENCH_CHILD_H + +#include "ace/Get_Opt.h" +#include "ace/Acceptor.h" +#include "ace/Svc_Handler.h" +#include "ace/SOCK_Acceptor.h" +#include "ace/INET_Addr.h" +#include "ace/SOCK_CODgram.h" +#include "ace/Select_Reactor.h" +#include "orbsvcs/orbsvcs/Naming/Naming_Utils.h" +#include "orbsvcs/AV/AVStreams_i.h" + + +class Bench_Server_StreamEndPoint : + public virtual TAO_Server_StreamEndPoint +{ +public: + virtual int handle_open (void) ; + // called when streamendpoint is instantiated + + virtual int handle_close (void) ; + // called when streamendpoint is being destructed + + virtual int handle_stop (const AVStreams::flowSpec &the_spec, + CORBA::Environment &env) ; + // Application needs to define this + + virtual int handle_start (const AVStreams::flowSpec &the_spec, + CORBA::Environment &env) ; + // Application needs to define this + + + virtual int handle_destroy (const AVStreams::flowSpec &the_spec, + CORBA::Environment &env) ; + // Application needs to define this + + virtual CORBA::Boolean handle_connection_requested (AVStreams::flowSpec &the_spec, + CORBA::Environment &env) ; +}; + + +#endif /* TAO_AV_BENCH_CHILD_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/client.cpp b/TAO/orbsvcs/tests/AVStreams/benchmark/client.cpp index 75450e1f29e..0c1bd1e3402 100644 --- a/TAO/orbsvcs/tests/AVStreams/benchmark/client.cpp +++ b/TAO/orbsvcs/tests/AVStreams/benchmark/client.cpp @@ -85,24 +85,41 @@ Client::svc (void) this->argv_, TAO_TRY_ENV); TAO_CHECK_ENV; + // activate the client MMDevice with the ORB + this->orb_manager_.activate (&this->client_mmdevice_, + TAO_TRY_ENV); + TAO_CHECK_ENV; + + if (this->bind_to_server () == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) Error binding to the naming service\n"), + -1); + + // wait for the other clients to finish binding + this->barrier_->wait (); + + ACE_DEBUG ((LM_DEBUG, "(%P|%t) All threads finished, starting tests.\n")); + + AVStreams::streamQoS_var the_qos (new AVStreams::streamQoS); + AVStreams::flowSpec_var the_flows (new AVStreams::flowSpec); + // Bind the client and server mmdevices. + + this->streamctrl_.bind_devs + (this->client_mmdevice_._this (TAO_TRY_ENV), + this->server_mmdevice_.in (), + the_qos.inout (), + the_flows.in (), + TAO_TRY_ENV); + + TAO_CHECK_ENV; } - TAO_CATCHANY { - TAO_TRY_ENV.print_exception ("Client"); + TAO_TRY_ENV.print_exception ("streamctrl.bind_devs:"); return -1; } TAO_ENDTRY; - if (this->bind_to_server () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Error binding to the naming service\n"), - -1); - - // wait for the other clients to finish binding - this->barrier_->wait (); - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) All threads finished, starting tests.\n")); return 0; } @@ -193,11 +210,11 @@ main (int argc, char **argv) while ((c = opts ()) != -1) switch (c) { - case 'n': + case 't': thread_count = (u_int) ACE_OS::atoi (opts.optarg); continue; default: - ACE_DEBUG ((LM_DEBUG, "Usage: %s -n number_of_threads\n")); + ACE_DEBUG ((LM_DEBUG, "Usage: %s -t number_of_threads\n")); } ACE_Barrier *barrier; @@ -227,5 +244,4 @@ main (int argc, char **argv) ACE_Thread_Manager::instance ()->wait (); - } diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/client.h b/TAO/orbsvcs/tests/AVStreams/benchmark/client.h index 36074fa5d7d..8954ed16f6f 100644 --- a/TAO/orbsvcs/tests/AVStreams/benchmark/client.h +++ b/TAO/orbsvcs/tests/AVStreams/benchmark/client.h @@ -1,8 +1,8 @@ // $Id$ -#if !defined (TAO_AV_BENCH_H) -#define TAO_AV_BENCH_H +#if !defined (TAO_AV_BENCH_CLIENT_H) +#define TAO_AV_BENCH_CLIENT_H #include "ace/Reactor.h" #include "ace/Event_Handler.h" @@ -85,4 +85,4 @@ private: }; -#endif /* TAO_AV_BENCH_H */ +#endif /* TAO_AV_BENCH_CLIENT_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/server.cpp b/TAO/orbsvcs/tests/AVStreams/benchmark/server.cpp new file mode 100644 index 00000000000..873105d201b --- /dev/null +++ b/TAO/orbsvcs/tests/AVStreams/benchmark/server.cpp @@ -0,0 +1,129 @@ +// $Id$ + + +#include "server.h" + +Server::Server (void) + :process_strategy_ (&process_options_) +{ + this->process_options_.command_line ("./child -ORBport 0 -ORBobjrefstyle url"); +} + + +// Initializes the mpeg server +int +Server::init (int argc, + char **argv, + CORBA::Environment& env) +{ + int result; + + // Initialize the orb_manager + this->orb_manager_.init_child_poa (argc, + argv, + "child_poa", + env); + TAO_CHECK_ENV_RETURN (env, + -1); + + CORBA::ORB_var orb = + this->orb_manager_.orb (); + + PortableServer::POA_var child_poa = + this->orb_manager_.child_poa (); + + // Resolve the Naming service reference. + + CORBA::Object_var naming_obj = orb->resolve_initial_references ("NameService"); + if (CORBA::is_nil (naming_obj.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to resolve the Name Service.\n"), + -1); + + this->naming_context_ = + CosNaming::NamingContext::_narrow (naming_obj.in (), + env); + TAO_CHECK_ENV_RETURN (env,-1); + + // Register the video mmdevice object with the ORB + ACE_NEW_RETURN (this->mmdevice_, + TAO_MMDevice (&this->process_strategy_), + -1); + + // create the video server mmdevice with the naming service pointer. + this->orb_manager_.activate_under_child_poa ("Bench_Server_MMDevice", + this->mmdevice_, + env); + TAO_CHECK_ENV_RETURN (env,-1); + + // Register the mmdevice with the naming service. + CosNaming::Name server_mmdevice_name (1); + server_mmdevice_name.length (1); + server_mmdevice_name [0].id = CORBA::string_dup ("Bench_Server_MMDevice"); + + // Register the video control object with the naming server. + this->naming_context_->bind (server_mmdevice_name, + this->mmdevice_->_this (env), + env); + + if (env.exception () != 0) + { + env.clear (); + this->naming_context_->rebind (server_mmdevice_name, + this->mmdevice_->_this (env), + env); + TAO_CHECK_ENV_RETURN (env,-1); + } + return 0; +} + +// Runs the mpeg server +int +Server::run (CORBA::Environment& env) +{ + int result; + // Run the ORB event loop + this->orb_manager_.run (env); + + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Server::run () " + "came out of the (ORB) " + "event loop %p\n", + "run_event_loop")); + return 0; + +} + +Server::~Server (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Server: Removing handlers from the Reactor\n")); + + if (this->mmdevice_ != 0) + delete this->mmdevice_; + +} + + +int +main (int argc, char **argv) +{ + Server server; + TAO_TRY + { + if (server.init (argc, argv, TAO_TRY_ENV) == -1) + return 1; + TAO_CHECK_ENV; + + server.run (TAO_TRY_ENV); + TAO_CHECK_ENV; + } + TAO_CATCHANY + { + TAO_TRY_ENV.print_exception ("Bench_Server::Exception"); + return -1; + } + TAO_ENDTRY; + + return 0; +} diff --git a/TAO/orbsvcs/tests/AVStreams/benchmark/server.h b/TAO/orbsvcs/tests/AVStreams/benchmark/server.h new file mode 100644 index 00000000000..be1448079a5 --- /dev/null +++ b/TAO/orbsvcs/tests/AVStreams/benchmark/server.h @@ -0,0 +1,48 @@ +// $Id$ + +#if !defined (TAO_AV_BENCH_SERVER_H) +#define TAO_AV_BENCH_SERVER_H + + +#include "ace/Get_Opt.h" +#include "ace/Acceptor.h" +#include "ace/Svc_Handler.h" +#include "ace/SOCK_Acceptor.h" +#include "ace/INET_Addr.h" +#include "ace/SOCK_CODgram.h" +#include "ace/Select_Reactor.h" +#include "orbsvcs/orbsvcs/Naming/Naming_Utils.h" +#include "orbsvcs/AV/AVStreams_i.h" +#include "orbsvcs/AV/Endpoint_Strategy.h" + +class Server +{ +public: + Server (void); + // Default constructor + + int init (int argc, + char **argv, + CORBA::Environment& env); + + int run (CORBA::Environment& env); + + ~Server (void); +private: + TAO_ORB_Manager orb_manager_; + // the TAO ORB manager. + + CosNaming::NamingContext_var naming_context_; + // The root naming context of the naming service + + ACE_Process_Options process_options_; + // The process options for the process to be spawned by the process strategy + + TAO_AV_Endpoint_Process_Strategy_B process_strategy_; + // The proces strategy for the video. + + TAO_MMDevice *mmdevice_; + // The video server multimedia device +}; + +#endif /* TAO_AV_BENCH_SERVER_H */ -- cgit v1.2.1