diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-09-16 00:55:56 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-09-16 00:55:56 +0000 |
commit | a0e72e6ac078389ddd1a8ac96c31436c33be44f0 (patch) | |
tree | 5a6f31b1d38aafec77f3713d08ad302800021407 /TAO | |
parent | 7cae906eb6db2aaef8b627d2480b83baaf9b226d (diff) | |
download | ATCD-a0e72e6ac078389ddd1a8ac96c31436c33be44f0.tar.gz |
.
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/examples/Quoter/Factory_Finder.cpp (renamed from TAO/tests/Quoter/Factory_Finder.cpp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Factory_Finder.dsp (renamed from TAO/tests/Quoter/Factory_Finder.dsp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Factory_Finder.h (renamed from TAO/tests/Quoter/Factory_Finder.h) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Factory_Finder_i.cpp (renamed from TAO/tests/Quoter/Factory_Finder_i.cpp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Factory_Finder_i.h (renamed from TAO/tests/Quoter/Factory_Finder_i.h) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Generic_Factory.cpp (renamed from TAO/tests/Quoter/Generic_Factory.cpp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Generic_Factory.dsp (renamed from TAO/tests/Quoter/Generic_Factory.dsp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Generic_Factory.h (renamed from TAO/tests/Quoter/Generic_Factory.h) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Generic_Factory_i.cpp (renamed from TAO/tests/Quoter/Generic_Factory_i.cpp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Generic_Factory_i.h (renamed from TAO/tests/Quoter/Generic_Factory_i.h) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Makefile (renamed from TAO/tests/Quoter/Makefile) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Quoter.dsw (renamed from TAO/tests/Quoter/Quoter.dsw) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Quoter.idl (renamed from TAO/tests/Quoter/Quoter.idl) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Quoter_i.cpp (renamed from TAO/tests/Quoter/Quoter_i.cpp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/Quoter_i.h (renamed from TAO/tests/Quoter/Quoter_i.h) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/README (renamed from TAO/tests/Quoter/Documentation) | 59 | ||||
-rw-r--r-- | TAO/examples/Quoter/client.conf (renamed from TAO/tests/Quoter/client.conf) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/client.cpp (renamed from TAO/tests/Quoter/client.cpp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/client.dsp (renamed from TAO/tests/Quoter/client.dsp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/client.h (renamed from TAO/tests/Quoter/client.h) | 0 | ||||
-rwxr-xr-x | TAO/examples/Quoter/run_test.pl (renamed from TAO/tests/Quoter/run_test.pl) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/server.conf (renamed from TAO/tests/Quoter/server.conf) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/server.cpp (renamed from TAO/tests/Quoter/server.cpp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/server.dsp (renamed from TAO/tests/Quoter/server.dsp) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/server.h (renamed from TAO/tests/Quoter/server.h) | 0 | ||||
-rw-r--r-- | TAO/examples/Quoter/svc.conf (renamed from TAO/tests/Quoter/svc.conf) | 0 | ||||
-rwxr-xr-x | TAO/examples/Quoter/testall.pl (renamed from TAO/tests/Quoter/testall.pl) | 0 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/Makefile | 316 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/README | 12 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/client.cpp | 42 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/gen.cpp | 177 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/impl.cpp | 76 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/objcreate.cpp | 55 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/perf.cpp | 25 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/skel.cpp | 221 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/stub.cpp | 159 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/tao.cpp | 100 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/CodeGen/tao.h | 23 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/Makefile | 65 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/README | 20 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/client.cpp | 312 | ||||
-rwxr-xr-x | TAO/performance-tests/Demux/gen_bin | 6 | ||||
-rwxr-xr-x | TAO/performance-tests/Demux/make_all | 19 | ||||
-rwxr-xr-x | TAO/performance-tests/Demux/run_all_client | 37 | ||||
-rwxr-xr-x | TAO/performance-tests/Demux/run_all_server | 20 | ||||
-rwxr-xr-x | TAO/performance-tests/Demux/run_client | 17 | ||||
-rwxr-xr-x | TAO/performance-tests/Demux/run_server | 10 | ||||
-rw-r--r-- | TAO/performance-tests/Demux/server.cpp | 317 | ||||
-rw-r--r-- | TAO/tests/Quoter/README | 50 |
49 files changed, 2085 insertions, 53 deletions
diff --git a/TAO/tests/Quoter/Factory_Finder.cpp b/TAO/examples/Quoter/Factory_Finder.cpp index 9bb2b2133c0..9bb2b2133c0 100644 --- a/TAO/tests/Quoter/Factory_Finder.cpp +++ b/TAO/examples/Quoter/Factory_Finder.cpp diff --git a/TAO/tests/Quoter/Factory_Finder.dsp b/TAO/examples/Quoter/Factory_Finder.dsp index 2154731b0e2..2154731b0e2 100644 --- a/TAO/tests/Quoter/Factory_Finder.dsp +++ b/TAO/examples/Quoter/Factory_Finder.dsp diff --git a/TAO/tests/Quoter/Factory_Finder.h b/TAO/examples/Quoter/Factory_Finder.h index 09cff9259f8..09cff9259f8 100644 --- a/TAO/tests/Quoter/Factory_Finder.h +++ b/TAO/examples/Quoter/Factory_Finder.h diff --git a/TAO/tests/Quoter/Factory_Finder_i.cpp b/TAO/examples/Quoter/Factory_Finder_i.cpp index 4284f9074ff..4284f9074ff 100644 --- a/TAO/tests/Quoter/Factory_Finder_i.cpp +++ b/TAO/examples/Quoter/Factory_Finder_i.cpp diff --git a/TAO/tests/Quoter/Factory_Finder_i.h b/TAO/examples/Quoter/Factory_Finder_i.h index 4ce73d28a98..4ce73d28a98 100644 --- a/TAO/tests/Quoter/Factory_Finder_i.h +++ b/TAO/examples/Quoter/Factory_Finder_i.h diff --git a/TAO/tests/Quoter/Generic_Factory.cpp b/TAO/examples/Quoter/Generic_Factory.cpp index a2badd69620..a2badd69620 100644 --- a/TAO/tests/Quoter/Generic_Factory.cpp +++ b/TAO/examples/Quoter/Generic_Factory.cpp diff --git a/TAO/tests/Quoter/Generic_Factory.dsp b/TAO/examples/Quoter/Generic_Factory.dsp index 998edcd6be1..998edcd6be1 100644 --- a/TAO/tests/Quoter/Generic_Factory.dsp +++ b/TAO/examples/Quoter/Generic_Factory.dsp diff --git a/TAO/tests/Quoter/Generic_Factory.h b/TAO/examples/Quoter/Generic_Factory.h index bee301b10b9..bee301b10b9 100644 --- a/TAO/tests/Quoter/Generic_Factory.h +++ b/TAO/examples/Quoter/Generic_Factory.h diff --git a/TAO/tests/Quoter/Generic_Factory_i.cpp b/TAO/examples/Quoter/Generic_Factory_i.cpp index 83b560c7e37..83b560c7e37 100644 --- a/TAO/tests/Quoter/Generic_Factory_i.cpp +++ b/TAO/examples/Quoter/Generic_Factory_i.cpp diff --git a/TAO/tests/Quoter/Generic_Factory_i.h b/TAO/examples/Quoter/Generic_Factory_i.h index 100b1a6c22e..100b1a6c22e 100644 --- a/TAO/tests/Quoter/Generic_Factory_i.h +++ b/TAO/examples/Quoter/Generic_Factory_i.h diff --git a/TAO/tests/Quoter/Makefile b/TAO/examples/Quoter/Makefile index f82ad30d39f..f82ad30d39f 100644 --- a/TAO/tests/Quoter/Makefile +++ b/TAO/examples/Quoter/Makefile diff --git a/TAO/tests/Quoter/Quoter.dsw b/TAO/examples/Quoter/Quoter.dsw index d76f398199f..d76f398199f 100644 --- a/TAO/tests/Quoter/Quoter.dsw +++ b/TAO/examples/Quoter/Quoter.dsw diff --git a/TAO/tests/Quoter/Quoter.idl b/TAO/examples/Quoter/Quoter.idl index dcc1f460e89..dcc1f460e89 100644 --- a/TAO/tests/Quoter/Quoter.idl +++ b/TAO/examples/Quoter/Quoter.idl diff --git a/TAO/tests/Quoter/Quoter_i.cpp b/TAO/examples/Quoter/Quoter_i.cpp index e3e5c488add..e3e5c488add 100644 --- a/TAO/tests/Quoter/Quoter_i.cpp +++ b/TAO/examples/Quoter/Quoter_i.cpp diff --git a/TAO/tests/Quoter/Quoter_i.h b/TAO/examples/Quoter/Quoter_i.h index aa835cad233..aa835cad233 100644 --- a/TAO/tests/Quoter/Quoter_i.h +++ b/TAO/examples/Quoter/Quoter_i.h diff --git a/TAO/tests/Quoter/Documentation b/TAO/examples/Quoter/README index 8e067074f7f..c4206b99ec8 100644 --- a/TAO/tests/Quoter/Documentation +++ b/TAO/examples/Quoter/README @@ -1,7 +1,18 @@ +// $Id$ -Quoter example -------------- +Here is a Stock Quoter example that features the use of the TAO IDL +compiler, the different types of configuration settings (global vs +tss, etc), and the Life Cycle Service. + +For your convenience, the run_test.btm has been provided. It is a +batch file that runs under 4NT. Work is in progress for a regular +batch file that performs the same action. We'll probably get it +working on other platforms as soon as it is completed. + +---------------------------------------- +DOCUMENTATION FOR THE EXAMPLE +============================= Context: The Quoter example serves several tests, the first is the test of several multithreading policies and the second is showing the @@ -66,4 +77,46 @@ client: Creates one Quoter through using the Quoter_Factory_Finder. After that !!!!Note: To make use of the move operation you need to use the -sm switch on the perl script. This activates in the server multiple objects, which is needed for -moving.
\ No newline at end of file +moving. + +RUNNING THE EXAMPLE +=================== + +run_test + +Name Server +----------- + +Found under TAO\Orbsvcs, this is run for connections from the +server, client, and factory finder. Plans to move this into the +server are under consideration. + +To run with the default settings, use + +run_tests /ns + +Quoter Server +------------- + +To run with the default settings, use + +run_tests /sv + + +Quoter Client +------------- + +To run with the default settings, use + +run_tests /cl + +Quoter Factory Finder +--------------------- + +To run with the default settings, use + +run_tests /ff + +Quoter example +------------- + diff --git a/TAO/tests/Quoter/client.conf b/TAO/examples/Quoter/client.conf index 6eee002c688..6eee002c688 100644 --- a/TAO/tests/Quoter/client.conf +++ b/TAO/examples/Quoter/client.conf diff --git a/TAO/tests/Quoter/client.cpp b/TAO/examples/Quoter/client.cpp index 052c81f9b94..052c81f9b94 100644 --- a/TAO/tests/Quoter/client.cpp +++ b/TAO/examples/Quoter/client.cpp diff --git a/TAO/tests/Quoter/client.dsp b/TAO/examples/Quoter/client.dsp index 001cc1350a3..001cc1350a3 100644 --- a/TAO/tests/Quoter/client.dsp +++ b/TAO/examples/Quoter/client.dsp diff --git a/TAO/tests/Quoter/client.h b/TAO/examples/Quoter/client.h index 1e37d188b79..1e37d188b79 100644 --- a/TAO/tests/Quoter/client.h +++ b/TAO/examples/Quoter/client.h diff --git a/TAO/tests/Quoter/run_test.pl b/TAO/examples/Quoter/run_test.pl index 42d1be9df40..42d1be9df40 100755 --- a/TAO/tests/Quoter/run_test.pl +++ b/TAO/examples/Quoter/run_test.pl diff --git a/TAO/tests/Quoter/server.conf b/TAO/examples/Quoter/server.conf index 43c6a486c92..43c6a486c92 100644 --- a/TAO/tests/Quoter/server.conf +++ b/TAO/examples/Quoter/server.conf diff --git a/TAO/tests/Quoter/server.cpp b/TAO/examples/Quoter/server.cpp index f92de0c4743..f92de0c4743 100644 --- a/TAO/tests/Quoter/server.cpp +++ b/TAO/examples/Quoter/server.cpp diff --git a/TAO/tests/Quoter/server.dsp b/TAO/examples/Quoter/server.dsp index 27da53ef3ed..27da53ef3ed 100644 --- a/TAO/tests/Quoter/server.dsp +++ b/TAO/examples/Quoter/server.dsp diff --git a/TAO/tests/Quoter/server.h b/TAO/examples/Quoter/server.h index 51af5cfa68a..51af5cfa68a 100644 --- a/TAO/tests/Quoter/server.h +++ b/TAO/examples/Quoter/server.h diff --git a/TAO/tests/Quoter/svc.conf b/TAO/examples/Quoter/svc.conf index 43c6a486c92..43c6a486c92 100644 --- a/TAO/tests/Quoter/svc.conf +++ b/TAO/examples/Quoter/svc.conf diff --git a/TAO/tests/Quoter/testall.pl b/TAO/examples/Quoter/testall.pl index 5f25258cae3..5f25258cae3 100755 --- a/TAO/tests/Quoter/testall.pl +++ b/TAO/examples/Quoter/testall.pl diff --git a/TAO/performance-tests/Demux/CodeGen/Makefile b/TAO/performance-tests/Demux/CodeGen/Makefile new file mode 100644 index 00000000000..a0218e3634c --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/Makefile @@ -0,0 +1,316 @@ +#---------------------------------------------------------------------------- +# $Id$ +# +# Makefile to compile the Demux application +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +BIN = tao +LIB = libtao.a +SHLIB = libtao.$(SOEXT) + +FILES = tao \ + gen \ + client \ + stub \ + skel \ + impl \ + perf \ + objcreate + +LSRC = $(addsuffix .cpp,$(FILES)) +LOBJ = $(addsuffix .o,$(FILES)) +SHOBJ = $(addsuffix .so,$(FILES)) + +LDLIBS = -ltao +LIBS = -lACE + +VLDLIBS = $(LDLIBS:%=%$(VAR)) + +#BUILD = $(VLIB) $(VSHLIB) $(SHLIBA) $(VBIN) +BUILD = $(VSHLIB) $(SHLIBA) $(VBIN) + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU +include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU + +#---------------------------------------------------------------------------- +# Include macros and targets +# Local modifications to variables imported by includes above. +#---------------------------------------------------------------------------- + +CPPFLAGS += -DDEBUG + +#---------------------------------------------------------------------------- +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +.obj/tao.o .shobj/tao.so: tao.cpp tao.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(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/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i +.obj/gen.o .shobj/gen.so: gen.cpp tao.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(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/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i +.obj/client.o .shobj/client.so: client.cpp tao.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(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/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i +.obj/stub.o .shobj/stub.so: stub.cpp tao.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(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/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i +.obj/skel.o .shobj/skel.so: skel.cpp tao.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(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/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i +.obj/impl.o .shobj/impl.so: impl.cpp tao.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(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/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i +.obj/perf.o .shobj/perf.so: perf.cpp tao.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(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/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i +.obj/objcreate.o .shobj/objcreate.so: objcreate.cpp tao.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/config.h \ + $(ACE_ROOT)/ace/streams.h \ + $(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/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/performance-tests/Demux/CodeGen/README b/TAO/performance-tests/Demux/CodeGen/README new file mode 100644 index 00000000000..13fcae3c48f --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/README @@ -0,0 +1,12 @@ +This directory contains a code generator that will generate stubs and +skeletons for an interface called "tao_demux". The number of +operations in this interface is controlled by the -m option to the +executable "tao". + +Usage: + +tao -o <num of objs> -m < num of operations> + +The stubs and skeletons are for 2-way calls. The operation names and +object keys are automatically generated and have arbitrary string +names.
\ No newline at end of file diff --git a/TAO/performance-tests/Demux/CodeGen/client.cpp b/TAO/performance-tests/Demux/CodeGen/client.cpp new file mode 100644 index 00000000000..31ba40da66c --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/client.cpp @@ -0,0 +1,42 @@ +// $Id$ + +#include "tao.h" + +ACE_RCSID(CodeGen, client, "$Id$") + +// Generate the client side include file "client.i". This file has a table of +// function pointers to the the different operations of the +// interface. Depending on the strategy chosen, we make appropriate calls + +long GenClientCode(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + fstream client_incl; + int i; + ACE_CString *str; + + client_incl.open("client.i", ios::out); + + for(i=0; i < limit; i++){ + if (arr.get(str, i) == -1) + { + return -1; + } + client_incl << "void " << str->rep() << "(tao_demux_ptr obj)" << endl; + client_incl << "{" << endl; + client_incl << "\tCORBA_Environment env;" << endl << endl; + client_incl << "\tobj->" << str->rep() << "(env);" << endl; + client_incl << "}" << endl; + } + client_incl << endl; + client_incl << "static const method_db mtbl[] = {" << endl; + for (i=0; i < limit; i++){ + if (arr.get(str, i) == -1) + { + return -1; + } + client_incl << "\t" << str->rep() << "," << endl; + } + client_incl << "};" << endl << endl; + client_incl.close(); +} + diff --git a/TAO/performance-tests/Demux/CodeGen/gen.cpp b/TAO/performance-tests/Demux/CodeGen/gen.cpp new file mode 100644 index 00000000000..e477cf2ecb2 --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/gen.cpp @@ -0,0 +1,177 @@ +// $Id$ + +#include "tao.h" + +ACE_RCSID(CodeGen, gen, "$Id$") + +static long GenDistinctString(ACE_Unbounded_Queue<ACE_CString> &, int); +static long GenRand(int, int); +static long IsPresent(ACE_Unbounded_Queue<ACE_CString> &, int, ACE_CString &); +static ACE_CString CreateString(long); +static char GetVarChar(int); + +// object table generator +long GenObjectTable(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + int i,j,k; // indices + long rnd; // random number + int opt; + fstream arrfp; + ACE_CString *str; + + + // Generate "limit" distinct strings + for (i=0; i < limit; i++) + { + if (GenDistinctString(arr, i) == -1) // side effect: inserts a new string + return -1; // at locn i in array "arr" + } + + // write the strings into a file whose format will be understood by GPERF + arrfp.open("gperf_objects.dat",ios::out); + + arrfp << "struct object_db {" << endl; + arrfp << "\tchar *name; // name of method" << endl; + arrfp << "\tCORBA_Object_ptr obj; //fn pointer to obj impl" << endl; + arrfp << "};" << endl; + arrfp << "%%" << endl; + + for(i=0; i < limit; i++) + { + if (arr.get(str, i) == -1) + { + // error + return -1; + } + arrfp << str->rep() << ", " << "0" << endl; + // we do not know the addresses of the objects. We shall insert them + // later. + } + arrfp.close(); + return 0; +} + +// method table generator +long GenMethodTable(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + int i,j,k; // indices + long rnd; // random number + int opt; + fstream arrfp; + ACE_CString *str; + + + // Generate "limit" distinct strings + for (i=0; i < limit; i++){ + if (GenDistinctString(arr, i) == -1) // side effect: inserts a new string at locn i + return -1; // in array "arr" + } + + // write the strings into a file whose format will be understood by GPERF + arrfp.open("gperf_methods.dat",ios::out); + + arrfp << "struct method_db {" << endl; + arrfp << "\tchar *name; // name of method" << endl; + arrfp << "\tTAO_Skeleton skel_ptr; //fn pointer to skeleton" << endl; + arrfp << "};" << endl; + arrfp << "%%" << endl; + + for(i=0; i < limit; i++) + { + if (arr.get(str, i) == -1) + { + // error + return -1; + } + arrfp << (str->rep()) << ", " << "_skel_tao_demux::" << str->rep() << + "_skel" << endl; + } + arrfp.close(); + return 0; +} + + +// generate a distinct string and insert it at location "limit" +long GenDistinctString(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + int i, j; // indices + long rnd; + ACE_CString s; + long status; + + rnd = GenRand(3,32); // get a random number between 3 and 32 which will be + // used as a string length of the distinct string to be + // generated. We use 3-32 because certain function + // names such as _N, _C cause name conflicts. + // Continue generating strings until a distinct one not generated before + // is formed + do { + s = CreateString(rnd); + status = IsPresent (arr, limit, s); + if (status == -1) + return -1; + } while (status > 0); + + // save it at this location + if (arr.enqueue_tail(s) == -1) + { + return -1; + } + return 0; +} + +// generate a random number in the given limits +long GenRand(int low, int up) +{ + return (lrand48() % (up-low+1)) + low; // rnd will be the size of the +} + +// check if the given string is present in the array +long IsPresent(ACE_Unbounded_Queue<ACE_CString> &arr, int limit, ACE_CString &s) +{ + ACE_CString *str; + + if (!strcasecmp(s.rep(), "_is_a")) + return 1; + + for (int i=0; i < limit; i++){ + if (arr.get(str, i) == -1) + { + return -1; + } + if (!strcasecmp(str->rep(), s.rep())) + return 1; // they are same + } + return 0; // not present +} + +// create a string of length = len +ACE_CString CreateString(long len) +{ + int i; + ACE_CString s; + char ch; + + for (i=0; i < len; i++){ + ch = GetVarChar(i); + s += ACE_CString(&ch); + } + return s; +} + +// Generate a valid character for a C++ variable +char GetVarChar(int i) +{ + // for i == 0, we cannot return a digit as the first character + char ch; + while(1) { + ch = GenRand(48, 122); + if (isdigit(ch) || isupper(ch) || islower(ch) || (ch == '_')){ + if ((i == 0) && (isdigit(ch) || (ch == '_'))) + continue; + break; //otherwise + } + } + return ch; +} + diff --git a/TAO/performance-tests/Demux/CodeGen/impl.cpp b/TAO/performance-tests/Demux/CodeGen/impl.cpp new file mode 100644 index 00000000000..b7143a5c0d8 --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/impl.cpp @@ -0,0 +1,76 @@ +// $Id$ + +#include "tao.h" + +ACE_RCSID(CodeGen, impl, "$Id$") + +// generate the implementation header +long GenServantHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + // generate the implementation class + fstream hdr; + int i; + ACE_CString *str; + + hdr.open("tao_demux_i.h", ios::out); + + hdr << "#if !defined(TAO_DEMUX_I_H)" << endl; + hdr << "#define TAO_DEMUX_I_H" << endl << endl; + + hdr << "#include \"tao_demuxS.h\"" << endl << endl; + + hdr << "class tao_demux_i: public virtual _skel_tao_demux" << endl; + hdr << "{" << endl; + hdr << "public:" << endl; + hdr << "\ttao_demux_i(char *obj_name);" << endl; + hdr << "\t~tao_demux_i();" << endl; + hdr << "\t//now all the methods" << endl; + + for(i=0; i < limit; i++) + { + if (arr.get(str, i) == -1) + return -1; + + hdr << "\tvoid " << str->rep() << + "(CORBA_Environment &env);" << endl; + } + hdr << "};" << endl; + + hdr << "#endif" << endl; +} + + +// generate the implementation +long GenServantImpl(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + // generate the implementation class + fstream impl; + int i; + ACE_CString *str; + + impl.open("tao_demux_i.cpp", ios::out); + + impl << "#include <iostream.h>" << endl; + impl << "#include \"tao_demux_i.h\"" << endl << endl; + + impl << "tao_demux_i::tao_demux_i(char *obj_name)" << endl; + impl << " :_skel_tao_demux(obj_name){}" << endl; + impl << "tao_demux_i::~tao_demux_i(){}" << endl; + impl << "\t//now all the methods" << endl; + + for(i=0; i < limit; i++) + { + if (arr.get(str, i) == -1) + return -1; + + impl << "void tao_demux_i::" << str->rep() << + "(CORBA_Environment &env)" << endl; + impl << "{" << endl; + impl << "#ifdef DEBUG" << endl; + impl << " cout << \"Object name = \" << this->_get_name(env) << " << + "\", Operation name = " << str->rep() << "\" << endl;" << endl; + impl << "#endif" << endl; + impl << "}" << endl << endl; + } +} + diff --git a/TAO/performance-tests/Demux/CodeGen/objcreate.cpp b/TAO/performance-tests/Demux/CodeGen/objcreate.cpp new file mode 100644 index 00000000000..a6a3e2ede6d --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/objcreate.cpp @@ -0,0 +1,55 @@ +// $Id$ + +#include "tao.h" + +ACE_RCSID(CodeGen, objcreate, "$Id$") + +long GenObjectCreateCode(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + // code for creating objects. The strategy will be based on active demux or + // other strategies + fstream file; + int i; + ACE_CString *str; + + file.open("obj_create.i", ios::out); + + file << "\t if (params->demux_strategy() == " << + "TAO_OA_Parameters::TAO_ACTIVE_DEMUX){" << endl; + + for (i=0; i < limit; i++) + { + if (arr.get(str, i) == -1) + return -1; + + file << "\t\tmymux[" << i << "] = new tao_demux_i(\"" << i << "\");" << + endl; + file << "\t\tstr = orb_ptr->object_to_string(mymux[" << i << "], env);" + << endl; + file << "#ifdef DEBUG" << endl; + file << "\t\tcout << \"IOR = \" << (char *)str << endl;" << endl; + file << "#endif" << endl; + file << "\t\tiorfile << (char *)str << endl; " << endl; + file << "\t\tCORBA_string_free(str);" << endl; + } + file << "\t } else {" << endl; + for (i=0; i < limit; i++) + { + if (arr.get(str, i) == -1) + return -1; + + file << "\t\tmymux[" << i << "] = new tao_demux_i(CORBA_string_dup (\"" + << str->rep() << "\"));" << endl; + file << "\t\tstr = orb_ptr->object_to_string(mymux[" << i << "], env);" + << endl; + file << "#ifdef DEBUG" << endl; + file << "\t\tcout << \"IOR = \" << (char *)str << endl;" << endl; + file << "#endif" << endl; + file << "\t\tiorfile << (char *)str << endl; " << endl; + file << "\t\tCORBA_string_free(str);" << endl; + } + file << "\t }" << endl; + + file.close(); + return 0; +} diff --git a/TAO/performance-tests/Demux/CodeGen/perf.cpp b/TAO/performance-tests/Demux/CodeGen/perf.cpp new file mode 100644 index 00000000000..a3cffc21d2f --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/perf.cpp @@ -0,0 +1,25 @@ +// $Id$ + +#include "tao.h" + +ACE_RCSID(CodeGen, perf, "$Id$") + +void GenGPERFCode() +{ + char command[500]; + + // first generate code for object hash + sprintf(command, + "gperf -c -C -D -E -T -f 0 -a -o -t -p -L C++ -Z Method_Hash %s >\ +gperf_method.i", "gperf_methods.dat"); + system(command); + + // omit the -C switch for gperf because we will not know the address of the + // objects until they are instantiated. But we do know the keys in advance. + sprintf(command, + "gperf -c -D -E -T -f 0 -a -o -t -p -L C++ -Z Object_Hash %s >\ +gperf_object.i", "gperf_objects.dat"); + system(command); + +} + diff --git a/TAO/performance-tests/Demux/CodeGen/skel.cpp b/TAO/performance-tests/Demux/CodeGen/skel.cpp new file mode 100644 index 00000000000..2933e042b05 --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/skel.cpp @@ -0,0 +1,221 @@ +// $Id$ + +#include "tao.h" + +ACE_RCSID(CodeGen, skel, "$Id$") + +long GenServerHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + fstream hdr; + int i; + ACE_CString *str; + + hdr.open("tao_demuxS.h", ios::out); + + hdr << "#if !defined(TAO_DEMUX_S_H)" << endl; + hdr << "#define TAO_DEMUX_S_H" << endl << endl; + + hdr << "#include \"tao_demuxC.h\"" << endl; + hdr << "class _skel_tao_demux: public tao_demux" << endl; + hdr << "{" << endl; + hdr << "protected:" << endl; + hdr << "\t_skel_tao_demux(const char *objname=0);" << endl; + hdr << "\tvirtual ~_skel_tao_demux() {}" << endl; + hdr << "public:" << endl; + hdr << "\t//All methods defined on this interface" << endl; + for(i=0; i < limit; i++){ + if (arr.get(str, i) == -1) + { + return -1; + } + //generate skeletons + hdr << "\tvirtual void " << str->rep() << + "(CORBA_Environment &env) = 0;" << endl; + } + hdr << endl; + hdr << "\t// All skeletons used for dispatching" << endl; + for(i=0; i < limit; i++){ + if (arr.get(str, i) == -1) + { + return -1; + } + //generate skeletons + hdr << "\tstatic void " << str->rep() << + "_skel(CORBA_ServerRequest &req, CORBA_Object_ptr obj, " << + "CORBA_Environment &env);" << endl; + } + hdr << "\tstatic void " << + "_is_a_skel(CORBA_ServerRequest &req, CORBA_Object_ptr obj, " << + "CORBA_Environment &env);" << endl; + hdr << "};" << endl; + + hdr << "#endif" << endl; + hdr.close(); +} + +// generate server side skeletons +long GenServerSkels(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + fstream skel; + int i; + ACE_CString *str; + + skel.open("tao_demuxS.cpp", ios::out); + + skel << "#include \"tao_demuxS.h\"" << endl; + // skel << "#include \"iiopobj.h\"" << endl; + // skel << "#include \"params.h\"" << endl; + // skel << "#include \"corba/optable.h\"" << endl; + // skel << "#include \"corba/corbacom.h\"" << endl << endl; + + // table of methods + skel << "static const TAO_operation_db_entry tao_demux_operations [] = {" << endl; + for (i=0; i < limit; i++) + { + if (arr.get(str, i) == -1) + { + return -1; + } + skel << "\t{\"" << str->rep() << "\", &_skel_tao_demux::" << str->rep() << + "_skel}," << endl; + + } + skel << "\t{\"_is_a\", &_skel_tao_demux::_is_a_skel}" << endl; + skel << "};" << endl; + + // table of methods + skel << "static const TAO_operation_db_entry tao_active_demux_operations [] = {" << endl; + for (i=0; i < limit; i++) + { + if (arr.get(str, i) == -1) + { + return -1; + } + skel << "\t{\"" << i << "\", &_skel_tao_demux::" << str->rep() << + "_skel}," << endl; + + } + skel << "\t{\"" << limit << "\", &_skel_tao_demux::_is_a_skel}" << endl; + skel << "};" << endl; + + // instantiate operation lookup tables + skel << "// instantiate a dynamic hash operation table" << endl; + skel << "TAO_Dynamic_Hash_OpTable dyn_hash_tao_demux_op_tbl(" << + "tao_demux_operations, " << (limit+1) << ", " << (limit+1)*2 << ");" << endl; + + skel << "// instantiate a linear search based operation table" << endl; + skel << "TAO_Linear_OpTable linear_tao_demux_op_tbl(" << + "tao_demux_operations, " << limit+1 << ");" << endl; + + skel << "// instantiate a active demux operation table" << endl; + skel << "TAO_Active_Demux_OpTable active_tao_demux_op_tbl(" << + "tao_active_demux_operations, " << limit+1 << ");" << endl; + + skel << "// constructor for skel_tao_demux" << endl; + skel << "_skel_tao_demux::_skel_tao_demux(const char *obj_name)" << endl; + // skel << "\t:optable_(&tao_demux_op_tbl)" << endl; + skel << "{" << endl; + skel << "\tconst char* repoID = \"IDL:tao_demux:1.0\";" << endl; + skel << "\tCORBA_String_var _tao_typeid = repoID;" << endl; + skel << "\tIIOP_Object *data; // IIOP object reference" << endl; + skel << "\tCORBA_POA_ptr oa = TAO_OA_PARAMS::instance()->oa(); // our OA" << endl; + skel << "\tTAO_Operation_Table_Parameters *op_params = " << endl; + skel << "\t\tTAO_OP_TABLE_PARAMETERS::instance();" << endl << endl; + skel << "\tCORBA_Long i;" << endl; + + // set the operation table based on user's choice + skel << "\tswitch(op_params->lookup_strategy()){" << endl; + skel << "\tcase TAO_Operation_Table_Parameters::TAO_ACTIVE_DEMUX:" << endl; + skel << "\t\tthis->optable_ = &active_tao_demux_op_tbl;" << endl; + skel << "\t\tbreak;" << endl; + skel << "\tcase TAO_Operation_Table_Parameters::TAO_LINEAR:" << endl; + skel << "\t\tthis->optable_ = &linear_tao_demux_op_tbl;" << endl; + skel << "\t\tbreak;" << endl; + skel << "\tcase TAO_Operation_Table_Parameters::TAO_DYNAMIC_HASH:" << endl; + skel << "\t\tthis->optable_ = &dyn_hash_tao_demux_op_tbl;" << endl; + skel << "\t\tbreak;" << endl; + skel << "\tcase TAO_Operation_Table_Parameters::TAO_PERFECT_HASH:" << endl; + skel << "\t\tthis->optable_ = op_params->concrete_strategy ();" << endl; + skel << "\t\tbreak;" << endl; + skel << "\tcase TAO_Operation_Table_Parameters::TAO_USER_DEFINED:" << endl; + skel << "\t\tthis->optable_ = op_params->concrete_strategy ();" << endl; + skel << "\t\tbreak;" << endl; + skel << "\t}" << endl << endl; + + // code to create IIOP object + skel << "\tdata = new IIOP_Object(CORBA_string_dup(_tao_typeid));" << endl; + skel << "\tdata->profile.iiop_version.major = IIOP::MY_MAJOR;" << endl; + skel << "\tdata->profile.iiop_version.minor = IIOP::MY_MINOR;" << endl; + skel << "\tdata->profile.host = ACE_OS::strdup(oa->get_addr().get_host_name());" << endl; + skel << "\tdata->profile.port = oa->get_addr().get_port_number();" << endl; + skel << "\tdata->profile.object_key.length = ACE_OS::strlen(obj_name);" << endl; + skel << "\tdata->profile.object_key.maximum = " << + "data->profile.object_key.length;" << endl; + skel << "\tdata->profile.object_key.buffer = " << + "new CORBA_Octet [(size_t)data->profile.object_key.length+1];" << endl; + skel << "\tACE_OS::memcpy(data->profile.object_key.buffer, obj_name, " << + "data->profile.object_key.length);" << endl; + skel << "\tthis->set_parent(data);" << endl; + skel << "\tthis->sub_ = this;" << endl; + skel << "\tif (oa) oa->bind(data->profile.object_key, this);" << + "// register ourselves" << endl; + skel << "}" << endl << endl; + + // now the code for each skeleton + for(i=0; i < limit; i++){ + if (arr.get(str, i) == -1) + { + return -1; + } + skel << "void _skel_tao_demux::" << str->rep() << + "_skel(CORBA_ServerRequest &req, CORBA_Object_ptr obj, " << + "CORBA_Environment&env)" << endl; + skel << "{" << endl; + skel << "\tCORBA_NVList_ptr nvlist;" << endl; + skel << "\ttao_demux_ptr impl;" << endl << endl; + + // create a NVlist and populate it + skel << "\treq.orb()->create_list(0, nvlist);" << endl; + skel << "\treq.params(nvlist,env); //useless operation, but required " + << endl; + skel << "\t impl = (tao_demux_ptr) (obj->get_subclass());" << endl; + skel << "\t// now the magic of dynamic binding" << endl; + skel << "\timpl->" << str->rep() << "(env);" << endl; + skel << "}" << endl; + } + + // finally the code for _is_a + skel << "void _skel_tao_demux::_is_a_skel" << + "(CORBA_ServerRequest &req, CORBA_Object_ptr obj, " << + "CORBA_Environment&env)" << endl; + skel << "{" << endl; + skel << "\tCORBA_NVList_ptr nvlist;" << endl; + skel << "\tCORBA_NamedValue_ptr nv;" << endl; + skel << "\tCORBA_Any temp_value(_tc_CORBA_String);" << endl; + skel << "\tchar *_tao_typeid = \"IDL:tao_demux:1.0\";" << endl << endl; + + // create a NVlist and populate it + skel << "\treq.orb()->create_list(0, nvlist);" << endl; + skel << "\tnv = nvlist->add_value(0, temp_value, CORBA_ARG_IN, env);" << endl; + skel << "\treq.params(nvlist,env);" << endl; + skel << "\tif (env.exception() != 0)" << endl; + skel << "\t {" << endl; + skel << "\t\tdexc(env, \"is_a_skel, params\");" << endl; + skel << "\t\treturn;" << endl; + skel << "\t }" << endl << endl; + skel << "\tCORBA_Boolean *retval;" << endl; + skel << "\tCORBA_String value = *(CORBA_String *)nv->value()->value();" << endl; + skel << "\tif (strcmp((char *)value,(char *)_tao_typeid) == 0" << endl; + skel << "\t || strcmp((char *)value, _tc_CORBA_Object->id(env)) == 0)" << endl; + skel << "\t\tretval = new CORBA_Boolean(1);" << endl; + skel << "\telse" << endl; + skel << "\t\tretval = new CORBA_Boolean(0);" << endl; + skel << "\tCORBA_Any *any = new CORBA_Any(_tc_CORBA_Boolean, retval," << + "1);" << endl; + skel << "\treq.result(any, env);" << endl; + skel << "\tdexc(env, \"_is_a, result\");" << endl; + skel << "}" << endl; + + skel.close(); +} + diff --git a/TAO/performance-tests/Demux/CodeGen/stub.cpp b/TAO/performance-tests/Demux/CodeGen/stub.cpp new file mode 100644 index 00000000000..d33a88cc822 --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/stub.cpp @@ -0,0 +1,159 @@ +// $Id$ + +#include "tao.h" + +ACE_RCSID(CodeGen, stub, "$Id$") + +long GenClientHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + fstream hdr; + int i; + ACE_CString *str; + + hdr.open("tao_demuxC.h", ios::out); + + hdr << "//******** Generated by the tool: taoidl ********" << endl << endl; + + hdr << "#if !defined (TAO_DEMUXC_H)" << endl; + hdr << "#define TAO_DEMUXC_H" << endl << endl; + + hdr << "#include <stdlib.h>" << endl; + hdr << "#include \"tao/corba.h\"" << endl; + // hdr << "#include \"tao/orb.h\"" << endl; + // hdr << "#include \"tao/stub.h\"" << endl; + // hdr << "#include \"tao/optable.h\"" << endl; + + hdr << "class tao_demux;" << endl; + hdr << "typedef tao_demux *\ttao_demux_ptr;" << endl; + hdr << "class tao_demux: public virtual CORBA_Object" << endl; + hdr << "{" << endl; + hdr << "public:" << endl; + // define the CORBA compliant mapping + hdr << "\tstatic tao_demux_ptr _duplicate(tao_demux_ptr obj);" << endl; + hdr << "\tstatic tao_demux_ptr _narrow(CORBA_Object_ptr obj);" << endl; + hdr << "\tstatic tao_demux_ptr _nil();" << endl << endl; + + // now generate all the methods + for(i=0; i < limit; i++) + { + if (arr.get(str, i) == -1) + { + return -1; + } + hdr << "\tvirtual void " << str->rep() << "(CORBA_Environment &env);" << endl; + } + hdr << "protected:" << endl; + hdr << "\ttao_demux() {}" << endl; + hdr << "\ttao_demux(STUB_Object *objref): CORBA_Object(objref) {}" << endl; + hdr << "\tvirtual ~tao_demux() {}" << endl; + hdr << "private:" << endl; + hdr << "\t//copy constructor and assignment operator" << endl; + hdr << "\ttao_demux(const tao_demux&) { }" << endl; + hdr << "\tvoid operator=(const tao_demux&) { }" << endl; + hdr << "};" << endl; + + hdr << "#endif" << endl; + hdr.close(); +} + +long GenClientStubs(ACE_Unbounded_Queue<ACE_CString> &arr, int limit) +{ + fstream stub; + int i; + ACE_CString *str; + + stub.open("tao_demuxC.cpp", ios::out); + + stub << "#include \"tao_demuxC.h\"" << endl << endl; + + // generate the static functions + + // the _duplicate method + stub << "tao_demux_ptr tao_demux::_duplicate(tao_demux_ptr obj)" << endl; + stub << "{" << endl; + stub << "\tif (obj) obj->AddRef();" << endl; + stub << "\treturn obj;" << endl; + stub << "}" << endl << endl; + + // the _narrow method + stub << "tao_demux_ptr tao_demux::_narrow(CORBA_Object_ptr obj)" << endl; + stub << "{" << endl; + // check if object "is_a" IDL:tao_demux:1.0 and if so, addref and return a + // pointer to it + stub << "\tCORBA_Environment env;" << endl; + stub << "\tif (obj->_is_a(\"IDL:tao_demux:1.0\", env)){" << endl; + stub << "\t STUB_Object *istub;" << endl; + stub << "\t if (obj->QueryInterface(IID_STUB_Object, (void **)&istub)" << + " != NOERROR){" << endl; + stub << "\t\treturn tao_demux::_nil();" << endl; + stub << "\t }" << endl; + stub << "\t tao_demux_ptr new_obj = new tao_demux(istub);" << endl; + stub << "\t return tao_demux::_duplicate(new_obj);" << endl; + stub << "\t}" << endl; + stub << "\treturn tao_demux::_nil();" << endl; + stub << "}" << endl << endl; + + // the _nil method + stub << "tao_demux_ptr tao_demux::_nil()" << endl; + stub << "{" << endl; + stub << "\treturn (tao_demux_ptr)NULL;" << endl; + stub << "}" << endl << endl; + + // All the TAO_Param_Data and TAO_Call_Data structures + stub << + "// All the TAO_Param_Data and TAO_Call_Data structures required for invoking do_call" + << endl; + for(i=0; i < limit; i++){ + if (arr.get(str, i) == -1) + { + return -1; + } + + // generate TAO_Param_Data structure + stub << "static const TAO_Param_Data tao_demux_" << str->rep() << + "_params[] = {" << endl; + stub << "\t{_tc_CORBA_Void, PARAM_RETURN, 0}" << endl; + stub << "};" << endl; + + // generate TAO_Call_Data structure + stub << "static const TAO_Call_Data tao_demux_" << str->rep() << + "_calldata = {" << endl; + stub << "\t\"" << str->rep() << "\"," << endl; + stub << "\t1, //twoway" << endl; + stub << "\t1, &tao_demux_" << str->rep() << "_params[0]," << endl; + stub << "\t0, 0" << endl; + stub << "};" << endl; + + // generate TAO_Call_Data structure that uses active demultiplexing + stub << "static const TAO_Call_Data tao_demux_" << str->rep() << + "_active_calldata = {" << endl; + stub << "\t\"" << i << "\"," << endl; + stub << "\t1, //twoway" << endl; + stub << "\t1, &tao_demux_" << str->rep() << "_params[0]," << endl; + stub << "\t0, 0" << endl; + stub << "};" << endl; + + // now the actual stub + stub << "void tao_demux::" << str->rep() << "(CORBA_Environment &env)" + << endl; + stub << "{" << endl; + stub << "\tSTUB_Object *istub;" << endl; + stub << "\tif (this->QueryInterface (IID_STUB_Object, (void **) &istub) " + << "!= NOERROR){" << endl; + stub << "\t env.exception (new CORBA_DATA_CONVERSION (COMPLETED_NO));" << endl; + stub << "\t return;" << endl; + stub << "\t}" << endl; + stub << "\tTAO_Operation_Table_Parameters *paramTbl = " << endl; + stub << "\t\tTAO_OP_TABLE_PARAMETERS::instance();" << endl; + stub << "\tif (paramTbl->lookup_strategy() == "; + stub << "TAO_Operation_Table_Parameters::TAO_ACTIVE_DEMUX)" << endl; + stub << "\t\tistub->do_call(env, &tao_demux_" << str->rep() << + "_active_calldata);" << endl; + stub << "\telse" << endl; + stub << "\t\tistub->do_call(env, &tao_demux_" << str->rep() << + "_calldata);" << endl; + stub << "}" << endl << endl; + } + stub.close(); +} + diff --git a/TAO/performance-tests/Demux/CodeGen/tao.cpp b/TAO/performance-tests/Demux/CodeGen/tao.cpp new file mode 100644 index 00000000000..98a4647b6cc --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/tao.cpp @@ -0,0 +1,100 @@ +// $Id$ + +#include "tao.h" + +ACE_RCSID(CodeGen, tao, "$Id$") + +int main (int argc, char *argv[]) +{ + // define the two arrays that will hold generated object keys and method + // names of the hypothetical "tao_demux" interface + ACE_Unbounded_Queue<ACE_CString> *objectArr, *methodArr; + + // provide default values to the limit on the number of object keys and + // method names + long objectLimit = 5, + methodLimit = 4; + + // for parsing the arguments + ACE_Get_Opt get_opt (argc, argv, "hm:o:"); + + for (int c; (c = get_opt ()) != EOF;) + { + switch (c) + { + case 'm': // number of methods + methodLimit = ACE_OS::atoi (get_opt.optarg); + break; + case 'o': // number of object keys + objectLimit = ACE_OS::atoi (get_opt.optarg); + break; + case 'h': // usage + default: + Usage (); + return 1; + } + } + + cout << "Generating code for " << objectLimit << " objects and " << + methodLimit << " methods" << endl; + objectArr = new ACE_Unbounded_Queue<ACE_CString> [objectLimit]; + methodArr = new ACE_Unbounded_Queue<ACE_CString> [methodLimit]; + + // generate the object keys + if (GenObjectTable (*objectArr, objectLimit) == -1) + { + } + + // generate method names + if (GenMethodTable (*methodArr, methodLimit) == -1) + { + } + + // generate client side stub headers + if (GenClientHeader (*methodArr, methodLimit) == -1) + { + } + + // generate client stubs + if (GenClientStubs (*methodArr, methodLimit) == -1) + { + } + + // generate include code for client-side main program + if (GenClientCode (*methodArr, methodLimit) == -1) + { + } + + // generate server skeleton header + if (GenServerHeader (*methodArr, methodLimit) == -1) + { + } + + // generate server skeletons + if (GenServerSkels (*methodArr, methodLimit) == -1) + { + } + + // generate th eimpl header + if (GenServantHeader (*methodArr, methodLimit) == -1) + { + } + + // generate impl + if (GenServantImpl (*methodArr, methodLimit) == -1) + { + } + + // generate code that creates instances of objects + if (GenObjectCreateCode (*objectArr, objectLimit) == -1) + { + } + + GenGPERFCode (); +} + +void Usage (void) +{ + cerr << "Usage: tao [-m <#methods>] [-o <#objects>] [-h]" << endl; + return; +} diff --git a/TAO/performance-tests/Demux/CodeGen/tao.h b/TAO/performance-tests/Demux/CodeGen/tao.h new file mode 100644 index 00000000000..d35b3548996 --- /dev/null +++ b/TAO/performance-tests/Demux/CodeGen/tao.h @@ -0,0 +1,23 @@ +// $Id$ + +#include <iostream.h> +#include <fstream.h> + +#include "ace/SString.h" +#include "ace/Containers.h" +#include "ace/Singleton.h" +#include "ace/Get_Opt.h" + +long GenObjectTable(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); +long GenMethodTable(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); +long GenClientHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); +long GenClientStubs(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); +long GenClientCode(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); +long GenObjectCreateCode(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); +long GenServerHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); +long GenServerSkels(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); +long GenServantHeader(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); +long GenServantImpl(ACE_Unbounded_Queue<ACE_CString> &arr, int limit); +void GenGPERFCode(); +void Usage(); + diff --git a/TAO/performance-tests/Demux/Makefile b/TAO/performance-tests/Demux/Makefile new file mode 100644 index 00000000000..85ce98899c4 --- /dev/null +++ b/TAO/performance-tests/Demux/Makefile @@ -0,0 +1,65 @@ +#---------------------------------------------------------------------------- +# $Id$ +# +# Top-level Makefile for the CORBA request demultiplexing benchmark +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +LDLIBS = -lTAO + +PROG_SRCS = client.cpp tao_demuxC.cpp tao_demuxS.cpp tao_demux_i.cpp server.cpp + +LSRC = $(PROG_SRCS) + +TAO_DEMUX_CLIENT_OBJS = client.o tao_demuxC.o + +TAO_DEMUX_SERVER_OBJS = server.o tao_demuxC.o tao_demuxS.o tao_demux_i.o + +BIN = client server + +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 $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU +#include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU + +#---------------------------------------------------------------------------- +# Local modifications to variables imported by includes above. +#---------------------------------------------------------------------------- + +LDFLAGS += -lTAO +LDFLAGS += -L$(TAO_ROOT)/tao +CPPFLAGS += -I$(TAO_ROOT) + +ifdef quantify +LDFLAGS += -L/pkg/purify/quantify-2.1-solaris2/ -lquantify_stubs +endif + +ifdef debug +CPPFLAGS += -DDEBUG +endif + +server: $(addprefix $(VDIR),$(TAO_DEMUX_SERVER_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) + +client: $(addprefix $(VDIR),$(TAO_DEMUX_CLIENT_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) + +clean: + $(MAKE) realclean + rm -fr tao_demux* gperf* *.i client server + diff --git a/TAO/performance-tests/Demux/README b/TAO/performance-tests/Demux/README new file mode 100644 index 00000000000..133758e62e6 --- /dev/null +++ b/TAO/performance-tests/Demux/README @@ -0,0 +1,20 @@ + +***** NOTE: This is still under development and will not work ***** + + +This test directory tests various demultiplexing strategies used in +TAO. + +Description of various files: + +make_all script that generates executables for different number + of objects and methods +gen_bin generates the binary for the desired number of objects + and methods +run_client runs a client +run_server runs a server +run_all_client runs all clients generated by the make_all +run_all_server runs all servers generated by the make_all +CodeGen Directory containing the code generator +server.cpp server main program +client.cpp client main program diff --git a/TAO/performance-tests/Demux/client.cpp b/TAO/performance-tests/Demux/client.cpp new file mode 100644 index 00000000000..f69d001788a --- /dev/null +++ b/TAO/performance-tests/Demux/client.cpp @@ -0,0 +1,312 @@ +// $Id$ + +#include <sys/types.h> +#include <stdio.h> +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include "tao_demuxC.h" +#include "tao/debug.h" + +#include "ace/streams.h" + +ACE_RCSID(Demux_Test, client, "$Id$") + +void print_exception (const CORBA_Exception *x, + const char *info, + FILE *stream + ); + +char Usage[] = "\ +Usage: client options\n\ +options:\n\ +-l strategy: operation lookup strategy - a(active), l(linear), d (dyn hash), p (perf)\n\ +-i iter: number of iterations \n\ +-m num: number of methods \n\ +-o num: number of objects \n\ +-t type: type can be l(linear), r(random), b (best), w (worst)\n\ +"; + +#if !defined (__cplusplus) +typedef void (*SIG_TYP)(); +#endif + +#ifdef SVR4 +void +sigpipe (int foo) +#else + void +sigpipe () +#endif +{ +} + +static const char ior_prefix [] = "IOR:"; +static const char iiop_prefix [] = "iiop:"; + +enum SendType{ + LINEAR, + BEST, + WORST, + RANDOM +}; + +void do_test(tao_demux_ptr *demux, int olimit, int mlimit, SendType, int iter); + +int +main (int argc, char *argv[]) +{ + + unsigned long addr_tmp; + unsigned short done = 0; + int c; + + CORBA_ORB_ptr orb_ptr; + CORBA_Environment env; + CORBA_Object_ptr objref; + tao_demux_ptr *demux; + unsigned loop_count = 0; + int exit_later = 0; + int i; + int ObjectLimit = 5, + MethodLimit = 4; + int iter= 1; // number of iterations + SendType st = RANDOM; + TAO_Operation_Table_Parameters *op_params = TAO_OP_TABLE_PARAMETERS::instance(); + + CORBA_String str; + fstream iorfile; + + while (!done && ((c = getopt (argc, argv, "i:l:t:m:o:")) != + -1)){ + switch(c){ + case 'i': + iter = atoi (optarg); + break; + case 'l': // op table lookup strategy + break; + case 'm': + MethodLimit = atoi(optarg); + break; + case 'o': + ObjectLimit = atoi(optarg); + break; + case 't': + switch(*optarg){ + case 'b': + st = BEST; + break; + case 'w': + st = WORST; + break; + case 'l': + st = LINEAR; + break; + case 'r': + default: + st = RANDOM; + break; + } + break; + default: + goto usage; + } + } + + TAO_debug_level = 0; + // + // Transmitter + // + orb_ptr = CORBA_ORB_init (argc, argv, "ior", env); + if (env.exception () != 0) { + print_exception (env.exception (), "ORB initialization", stdout); + return 1; + } + + str = CORBA_string_alloc (500); + + // read the IOR from the file ior.txt + iorfile.open("./ior.txt", ios::in); + + for (;!iorfile.eof ();){ + memset(str, '\0', 500); + iorfile >> ((char *)str); + if (iorfile.good ()) + loop_count++; + } + iorfile.close(); + + ACE_DEBUG ((LM_DEBUG, "Total of %d object references read\n", loop_count)); + demux = new tao_demux_ptr [loop_count]; + for (i=0; i < loop_count; i++){ + demux[i] = 0; + } + + // read the IOR from the file ior.txt + iorfile.open("./ior.txt", ios::in); + + for (i=0; i < loop_count; i++){ + ACE_OS::memset (str, '\0', 500); + iorfile >> ((char *)str); + objref = orb_ptr->string_to_object(str, env); + if (env.exception() != 0){ + print_exception(env.exception(), "string2object", stdout); + return 1; + } + + cout << "objref " << i << " has key = " << objref->_get_name(env) << endl; + if (!CORBA_is_nil(objref)){ + // narrow to the desired interface type + demux[i] = tao_demux::_narrow (objref); + } + } + iorfile.close(); + CORBA_string_free(str); + + + // send operations + do_test(demux, ObjectLimit, MethodLimit, st, iter); + + for (i=0; i < loop_count; i++){ + CORBA_release(demux[i]); + } + delete [] demux; + return(0); +usage: + fprintf (stderr, Usage); + return 1; +} + +typedef void (*method_ptr)(tao_demux_ptr); +struct method_db { + method_ptr method; +}; + +#include "client.i" + +void do_test(tao_demux_ptr *demux, int olimit, int mlimit, SendType st, int iter) +{ + int i, j, k; + int loop = 0; + hrtime_t start, end, sum, diff; + fstream result; + CORBA_Environment env; + + result.open("result.dat",ios::out|ios::app); +#ifdef __TAO_ACTIVE__ + result << "# ACTIVE "; +#endif +#ifdef __TAO_GPERF__ + result << "# GPERF "; +#endif +#ifdef __TAO_LINEAR__ + result << "# LINEAR "; +#endif + + // result << "@type xy" << endl; + sum = 0; + + if (st == LINEAR){ + result << " LINEAR" << endl; +#ifdef __DEBUG__ + cout << "Linear strategy for sending" << endl; +#endif + for (k=0; k < iter; k++) { + // invoke the jth method on the ith object + for (i=0; i < olimit; i++){ + for (j=0; j < mlimit; j++){ + loop++; + start = ACE_OS::gethrtime (); + mtbl[j].method(demux[i]); + end = ACE_OS::gethrtime (); + diff = (end - start); +#ifdef __DEBUG__ + cout << "Latency for this request = " << diff/1.0e+06 << endl; +#endif + sum += diff; + // result << loop << "\t" << diff/1.e+06 << endl; + } + } + } + } else if (st == BEST){ + result << " BEST" << endl; +#ifdef __DEBUG__ + cout << "best strategy for sending" << endl; +#endif + for (k=0; k < iter; k++) { + // invoke the jth method on the ith object + for (i=0; i < olimit; i++){ + for (j=0; j < mlimit; j++){ + loop++; + start = ACE_OS::gethrtime (); + mtbl[0].method(demux[0]); + end = ACE_OS::gethrtime (); + diff = (end - start); +#ifdef __DEBUG__ + cout << "Latency for this request = " << diff/1.0e+06 << endl; +#endif + sum += diff; + // result << loop << "\t" << diff/1.e+06 << endl; + } + } + } + } else if (st == RANDOM) { + result << " RANDOM" << endl; +#ifdef __DEBUG__ + cout << "Random strategy for sending" << endl; +#endif + // choose the object and method name randomly + srand48(time(NULL)); + long p, q; + for (k=0; k < iter; k++) { + for (i=0; i < olimit; i++){ + for (j=0; j < mlimit; j++){ + loop++; + p = lrand48() % olimit; + q = lrand48() % mlimit; + start = ACE_OS::gethrtime (); +#ifdef DEBUG + ACE_DEBUG ((LM_DEBUG, "Invoking op %s on object with key %s\n", + mtbl[q], demux[p]->_get_name(env))); +#endif + mtbl[q].method(demux[p]); + end = ACE_OS::gethrtime (); + diff = (end - start); +#ifdef __DEBUG__ + cout << "Latency for this request = " << diff/1.0e+06 << endl; +#endif + sum += diff; + // result << loop << "\t" << diff/1.e+06 << endl; + } + } + } + } else if (st == WORST){ + result << " WORST" << endl; +#ifdef __DEBUG__ + cout << "worst strategy for sending" << endl; +#endif + // invoke the jth method on the ith object + for (k=0; k < iter; k++) { + for (i=0; i < olimit; i++){ + for (j=0; j < mlimit; j++){ + loop++; + start = ACE_OS::gethrtime (); + mtbl[mlimit-1].method(demux[olimit-1]); + end = ACE_OS::gethrtime (); + diff = (end - start); +#ifdef __DEBUG__ + cout << "Latency for this request = " << diff/1.0e+06 << endl; +#endif + sum += diff; + // result << loop << "\t" << diff/1.e+06 << endl; + } + } + } + } + result << olimit << "\t" << mlimit << "\t" << sum/(loop*1000000.0) << endl; + cout << olimit << "\t" << mlimit << "\t" << sum/(loop*1000000.0) << endl; + result.close(); +} + diff --git a/TAO/performance-tests/Demux/gen_bin b/TAO/performance-tests/Demux/gen_bin new file mode 100755 index 00000000000..b0650ff4249 --- /dev/null +++ b/TAO/performance-tests/Demux/gen_bin @@ -0,0 +1,6 @@ +#!/bin/sh +make clean +./CodeGen/tao -o $1 -m $2 +make +mv client client_${1}_${2} +mv server server_${1}_${2} diff --git a/TAO/performance-tests/Demux/make_all b/TAO/performance-tests/Demux/make_all new file mode 100755 index 00000000000..4ac9b18cc3f --- /dev/null +++ b/TAO/performance-tests/Demux/make_all @@ -0,0 +1,19 @@ +rm -fr server_*_* client_*_* +gen_bin 1 1 +gen_bin 1 10 +gen_bin 1 100 +gen_bin 100 1 +gen_bin 100 10 +gen_bin 100 100 +gen_bin 200 1 +gen_bin 200 10 +gen_bin 200 100 +gen_bin 300 1 +gen_bin 300 10 +gen_bin 300 100 +gen_bin 400 1 +gen_bin 400 10 +gen_bin 400 100 +gen_bin 500 1 +gen_bin 500 10 +gen_bin 500 100 diff --git a/TAO/performance-tests/Demux/run_all_client b/TAO/performance-tests/Demux/run_all_client new file mode 100755 index 00000000000..a5a3b61c48f --- /dev/null +++ b/TAO/performance-tests/Demux/run_all_client @@ -0,0 +1,37 @@ +#!/bin/sh +# usage: run_client <num objs> <num methods> <num iters> +run_client 500 100 1 +sleep 5 +run_client 500 10 1 +sleep 5 +run_client 500 1 1 +sleep 5 +run_client 400 100 1 +sleep 5 +run_client 400 10 1 +sleep 5 +run_client 400 1 1 +sleep 5 +run_client 300 100 1 +sleep 5 +run_client 300 10 1 +sleep 5 +run_client 300 1 1 +sleep 5 +run_client 200 100 1 +sleep 5 +run_client 200 10 1 +sleep 5 +run_client 200 1 1 +sleep 5 +run_client 100 100 1 +sleep 5 +run_client 100 10 1 +sleep 5 +run_client 100 1 1 +sleep 5 +run_client 1 100 1 +sleep 5 +run_client 1 10 10 +sleep 5 +run_client 1 1 100 diff --git a/TAO/performance-tests/Demux/run_all_server b/TAO/performance-tests/Demux/run_all_server new file mode 100755 index 00000000000..15b4762efcb --- /dev/null +++ b/TAO/performance-tests/Demux/run_all_server @@ -0,0 +1,20 @@ +#!/bin/sh +# usage: run_server <num objs> <num methods> <num iters> +run_server 500 100 1 +run_server 500 10 1 +run_server 500 1 1 +run_server 400 100 1 +run_server 400 10 1 +run_server 400 1 1 +run_server 300 100 1 +run_server 300 10 1 +run_server 300 1 1 +run_server 200 100 1 +run_server 200 10 1 +run_server 200 1 1 +run_server 100 100 1 +run_server 100 10 1 +run_server 100 1 1 +run_server 1 100 1 +run_server 1 10 10 +run_server 1 1 100 diff --git a/TAO/performance-tests/Demux/run_client b/TAO/performance-tests/Demux/run_client new file mode 100755 index 00000000000..19dab08670d --- /dev/null +++ b/TAO/performance-tests/Demux/run_client @@ -0,0 +1,17 @@ +#!/bin/sh +client_${1}_${2} -o ${1} -m ${2} -t r -i $3 +sleep 5 +client_${1}_${2} -o ${1} -m ${2} -t w -i $3 +sleep 5 +client_${1}_${2} -o ${1} -m ${2} -t r -i $3 +sleep 5 +client_${1}_${2} -o ${1} -m ${2} -t w -i $3 +sleep 5 +client_${1}_${2} -o ${1} -m ${2} -t r -i $3 +sleep 5 +client_${1}_${2} -o ${1} -m ${2} -t w -i $3 +sleep 5 +client_${1}_${2} -o ${1} -m ${2} -t r -i $3 +sleep 5 +client_${1}_${2} -o ${1} -m ${2} -t w -i $3 +sleep 5 diff --git a/TAO/performance-tests/Demux/run_server b/TAO/performance-tests/Demux/run_server new file mode 100755 index 00000000000..7f2ac61445a --- /dev/null +++ b/TAO/performance-tests/Demux/run_server @@ -0,0 +1,10 @@ +#!/bin/sh +server_${1}_${2} -OAhost merengue -OAobjdemux linear -OAtablesize ${1} -o ${1} -m ${2} -t l -i $3 +server_${1}_${2} -OAhost merengue -OAobjdemux linear -OAtablesize ${1} -o ${1} -m ${2} -t l -i $3 +server_${1}_${2} -OAhost merengue -OAobjdemux active_demux -OAtablesize ${1} -o ${1} -m ${2} -t a -i $3 +server_${1}_${2} -OAhost merengue -OAobjdemux active_demux -OAtablesize ${1} -o ${1} -m ${2} -t a -i $3 +server_${1}_${2} -OAhost merengue -OAobjdemux user_def -o ${1} -m ${2} -t g -i $3 +server_${1}_${2} -OAhost merengue -OAobjdemux user_def -o ${1} -m ${2} -t g -i $3 +server_${1}_${2} -OAhost merengue -o ${1} -m ${2} -i $3 +server_${1}_${2} -OAhost merengue -o ${1} -m ${2} -i $3 + diff --git a/TAO/performance-tests/Demux/server.cpp b/TAO/performance-tests/Demux/server.cpp new file mode 100644 index 00000000000..d4c10e35a5d --- /dev/null +++ b/TAO/performance-tests/Demux/server.cpp @@ -0,0 +1,317 @@ +// $Id$ + +#include "tao_demux_i.h" + +#ifdef USE_QUANTIFY +#include <quantify.h> +#endif + +#include <iostream.h> +#include <fstream.h> + +#include "ace/SString.h" + +ACE_RCSID(Demux_Test, server, "$Id$") + +void print_exception (const CORBA_Exception *x, + const char *info, + FILE *stream + ); + +#if !defined (__cplusplus) +typedef void (*SIG_TYP)(); +#endif + +#ifdef SVR4 +void +sigpipe (int foo) +#else + void +sigpipe () +#endif +{ +} + +//****************** perf hash for obj lookup ************* +// for perfect hash +struct object_db +{ + char *name; // name of method + CORBA_Object_ptr obj; //fn pointer to obj impl +}; + +// include the perfect hash code for objects +#include "gperf_object.i" + +// Perfect hash table class +class TAO_Perfect_Hash_ObjTable: public TAO_Object_Table +{ +public: + TAO_Perfect_Hash_ObjTable (Object_Hash *oh); + + ~TAO_Perfect_Hash_ObjTable (void); + + virtual int bind (const CORBA_OctetSeq &key, + CORBA_Object_ptr obj); + // Registers a CORBA_Object into the object table and associates the + // key with it. Returns -1 on failure, 0 on success, 1 on + // duplicate. + + virtual int find (const CORBA_OctetSeq &key, + CORBA_Object_ptr &obj); + // Looks up an object in the object table using <{key}>. Returns + // non-negative integer on success, or -1 on failure. + +private: + Object_Hash *hash_; +}; + +TAO_Perfect_Hash_ObjTable::TAO_Perfect_Hash_ObjTable (Object_Hash *oh) + : hash_ (oh) +{ +} + +TAO_Perfect_Hash_ObjTable::~TAO_Perfect_Hash_ObjTable (void) +{ +} + +int +TAO_Perfect_Hash_ObjTable::bind (const CORBA_OctetSeq &key, CORBA_Object_ptr obj) +{ + struct object_db *entry; + + ACE_CString objkey ((char *)key.buffer, key.length); + entry = this->hash_->in_word_set (objkey.rep (), key.length); + if (entry != 0) + { + // now fill up the entry + entry->obj = obj; + } + else + { + return -1; // error + } +} + +int +TAO_Perfect_Hash_ObjTable::find (const CORBA_OctetSeq &key, CORBA_Object_ptr &obj) +{ + struct object_db *entry; + + ACE_CString objkey ((char *)key.buffer, key.length); + entry = this->hash_->in_word_set (objkey.rep (), key.length); + + if (entry != 0) + { + obj = entry->obj; + return 0; + } + else + { + return -1; + } +} + +//****************** perf hash for opname lookup ************* +struct method_db +{ + char *name; // name of method + TAO_Skeleton skel_ptr_; //fn pointer to obj impl +}; + +#include "gperf_method.i" + +// Perfect hash table class +class TAO_Perfect_Hash_Op_Table: public TAO_Operation_Table +{ +public: + TAO_Perfect_Hash_Op_Table (Method_Hash *mh); + + ~TAO_Perfect_Hash_Op_Table (void); + + virtual int find (const CORBA_String &opname, + TAO_Skeleton &skel_ptr); + // Uses <{opname}> to look up the skeleton function and pass it back + // in <{skelfunc}>. Returns non-negative integer on success, or -1 + // on failure. + + virtual int bind (const CORBA_String &opname, + const TAO_Skeleton skelptr); + // Associate the skeleton <{skel_ptr}> with an operation named + // <{opname}>. Returns -1 on failure, 0 on success, 1 on duplicate. +private: + Method_Hash *hash_; +}; + +TAO_Perfect_Hash_Op_Table::TAO_Perfect_Hash_Op_Table (Method_Hash *mh) + : hash_ (mh) +{ +} + +TAO_Perfect_Hash_Op_Table::~TAO_Perfect_Hash_Op_Table (void) +{ +} + +int +TAO_Perfect_Hash_Op_Table::bind (const CORBA_String &opname, + const TAO_Skeleton skelptr) +{ + return 0; // nothing to do +} + +int +TAO_Perfect_Hash_Op_Table::find (const CORBA_String &opname, + TAO_Skeleton &skelptr) +{ + method_db *entry; + + entry = (method_db*) this->hash_->in_word_set (opname, ACE_OS::strlen (opname)); + if (entry != 0) + { + skelptr = entry->skel_ptr_; + return 0; + } + else + { + return -1; + } +} + +//*********************************************************** +char Usage[] = "\ +Usage: server [options] \n\ +Common options:\n\ +-t demux_strategy: l(linear), g(GPERF), a (delayered active demux), d (dynamic hash)\n\ +-i iter: number of iterations to expect from client \n\ +"; + +extern CORBA_Double TAO_Avg; +extern CORBA_Long TAO_HowMany; +extern CORBA_Long TAO_Loop; +int +main (int argc, char *const *argv) +{ + unsigned long addr_tmp; + int c; + unsigned short done = 0; + CORBA_Environment env; + CORBA_ORB_ptr orb_ptr; + CORBA_POA_ptr oa_ptr; + int iter = 1; + TAO_OA_Parameters *params = TAO_OA_PARAMS::instance(); + char *orb_name = "ior"; + int idle = -1; + int use_ior = 0; + int terminationStatus = 0; + tao_demux_i **mymux; // array of objects implementing the "demux" interface + int numObjs = 5, numMethods = 4; + Object_Hash oh; + TAO_Object_Table *objt = new TAO_Perfect_Hash_ObjTable (&oh); + Method_Hash mh; + TAO_Operation_Table *optbl = new TAO_Perfect_Hash_Op_Table (&mh); + + TAO_Operation_Table_Parameters *op_params = + TAO_OP_TABLE_PARAMETERS::instance(); + + fstream iorfile; // stores the object references of all the objects + fstream outfile; + CORBA_String str; // scratch area + + params->userdef_lookup_strategy (objt); + + orb_ptr = CORBA_ORB_init (argc, argv, orb_name, env); + if (env.exception () != 0) { + print_exception (env.exception (), "ORB init", stdout); + return 1; + } + + oa_ptr = orb_ptr->BOA_init (argc, argv, "ROA"); + if (env.exception () != 0) { + print_exception (env.exception (), "OA init", stdout); + return 1; + } + + TAO_debug_level = 0; + // Now process the options other than Orbix specific options + while ((c = getopt (argc, argv, "ui:t:o:m:")) != -1) + { + switch (c) + { + case 't': + switch (*optarg) + { + case 'l': + op_params->lookup_strategy + (TAO_Operation_Table_Parameters::TAO_LINEAR); + break; + case 'a': + op_params->lookup_strategy + (TAO_Operation_Table_Parameters::TAO_ACTIVE_DEMUX); + break; + case 'g': + op_params->lookup_strategy + (TAO_Operation_Table_Parameters::TAO_PERFECT_HASH); + op_params->concrete_strategy (optbl); + break; + case 'd': + default: + op_params->lookup_strategy + (TAO_Operation_Table_Parameters::TAO_DYNAMIC_HASH); + break; + } + break; + case 'u': + use_ior = 1; + orb_name = ""; + break; + case 'i': + iter = atoi (optarg); + break; + case 'o': + numObjs = atoi(optarg); + break; + case 'm': + numMethods = atoi(optarg); + break; + default: + goto usage; + } + } + + TAO_Avg = 0; + TAO_Loop = 0; + TAO_HowMany = iter*numObjs*numMethods; + + // + // Receiver + // + + iorfile.open ("ior.txt", ios::out); + mymux = new tao_demux_i* [numObjs]; + + // instantiate objects +#include "obj_create.i" + iorfile.close(); + cout << "Server ready to handle events" << endl; + +#if defined (USE_QUANTIFY) + quantify_clear_data(); + quantify_start_recording_data(); +#endif + + ACE_Service_Config::run_reactor_event_loop(); + + outfile.open ("muxcost.dat", ios::out|ios::app); + outfile << numObjs << "\t" << numMethods << "\t" << TAO_Avg << endl; + outfile.close (); + // + // Shut down the OA -- recycles all underlying resources (e.g. file + // descriptors, etc). + // + oa_ptr->clean_shutdown (env); + return terminationStatus; +usage: + fprintf (stderr, Usage); + return(1); +} + diff --git a/TAO/tests/Quoter/README b/TAO/tests/Quoter/README deleted file mode 100644 index ffcf5896fcc..00000000000 --- a/TAO/tests/Quoter/README +++ /dev/null @@ -1,50 +0,0 @@ -// $Id$ - -Here is a Stock Quoter example that features the use of the TAO IDL -compiler, the different types of configuration settings (global vs -tss, etc), and the Life Cycle Service. - -For your convenience, the run_test.btm has been provided. It is a -batch file that runs under 4NT. Work is in progress for a regular -batch file that performs the same action. - -And we'll probably get it working on other platforms as soon as it -is completed [since I've heard that some people actually use -platforms/opsystems besides NT ;-) ] - - -run_test - -Name Server ------------ - -Found under TAO\Orbsvcs, this is run for connections from the -server, client, and factory finder. Plans to move this into the -server are under consideration. - -To run with the default settings, use - -run_tests /ns - -Quoter Server -------------- - -To run with the default settings, use - -run_tests /sv - - -Quoter Client -------------- - -To run with the default settings, use - -run_tests /cl - -Quoter Factory Finder ---------------------- - -To run with the default settings, use - -run_tests /ff - |