diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-12-13 20:35:37 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-12-13 20:35:37 +0000 |
commit | 9c459acec39c04fbfb00d3a05c29303b7c5fbb33 (patch) | |
tree | a3cab59761bfdfc74507ec8505c1ac4e30ae0946 | |
parent | c28a6ca49793a92aa910583c9e10a66021d6996c (diff) | |
download | ATCD-9c459acec39c04fbfb00d3a05c29303b7c5fbb33.tar.gz |
ChangeLogTag: Fri Dec 13 14:30:19 2002 Jeff Parsons <j.parsons@vanderbilt.edu>
8 files changed, 626 insertions, 0 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index cab5baf2561..9a5f25c9cbf 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,19 @@ +Fri Dec 13 14:30:19 2002 Jeff Parsons <j.parsons@vanderbilt.edu> + + * orbsvcs/tests/InterfaceRepo/InterfaceRepo.dsw: + + Added project below to workspace. + + * orbsvcs/tests/InterfaceRepo/Latency_Test/Latency Test.dsp: + * orbsvcs/tests/InterfaceRepo/Latency_Test/Latency_Query_Client.cpp: + * orbsvcs/tests/InterfaceRepo/Latency_Test/Latency_Query_Client.h: + * orbsvcs/tests/InterfaceRepo/Latency_Test/Makefile: + * orbsvcs/tests/InterfaceRepo/Latency_Test/client.cpp: + * orbsvcs/tests/InterfaceRepo/Latency_Test/run_test.pl: + + New files for a simple latency/throughput test on the Interface + Repository. + Fri Dec 13 13:14:19 2002 Jeff Parsons <j.parsons@vanderbilt.edu> * orbsvcs/IFR_Service/Makefile.BE: diff --git a/TAO/orbsvcs/tests/InterfaceRepo/InterfaceRepo.dsw b/TAO/orbsvcs/tests/InterfaceRepo/InterfaceRepo.dsw index 99c0944da0e..df2374b2760 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/InterfaceRepo.dsw +++ b/TAO/orbsvcs/tests/InterfaceRepo/InterfaceRepo.dsw @@ -39,6 +39,18 @@ Package=<4> ###############################################################################
+Project: "Latency Test"=".\Latency_Test\Latency Test.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "Persistence_Test"=.\Persistence_Test\Persistence_Test.dsp - Package Owner=<4>
Package=<5>
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Latency Test.dsp b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Latency Test.dsp new file mode 100644 index 00000000000..b30e0bb916a --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Latency Test.dsp @@ -0,0 +1,114 @@ +# Microsoft Developer Studio Project File - Name="Latency Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Latency Test - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Latency Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Latency Test.mak" CFG="Latency Test - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Latency Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Latency Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Latency Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../" /I "../../../../../" /I "../../../../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib TAO.lib TAO_IFR_Client.lib /nologo /subsystem:console /machine:I386 /out:"Release/client.exe" /libpath:"../../../../../ace" /libpath:"../../../../tao" /libpath:"../../../../tao/IFR_Client"
+
+!ELSEIF "$(CFG)" == "Latency Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../../../" /I "../../../../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib TAOd.lib TAO_IFR_Clientd.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"../../../../../ace" /libpath:"../../../../tao" /libpath:"../../../../tao/IFR_Client"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Latency Test - Win32 Release"
+# Name "Latency Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Latency_Query_Client.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h"
+# Begin Source File
+
+SOURCE=.\Latency_Query_Client.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i:inl"
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Latency_Query_Client.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Latency_Query_Client.cpp new file mode 100644 index 00000000000..824b5879aad --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Latency_Query_Client.cpp @@ -0,0 +1,257 @@ +// -*- C++ -*- +// $Id$ + +#include "Latency_Query_Client.h" +#include "ace/Get_Opt.h" +#include "ace/High_Res_Timer.h" +#include "ace/Stats.h" +#include "ace/Sample_History.h" + +ACE_RCSID (Latency_Test, + Latency_Query_Client, + "$Id$") + +const CORBA::ULong DEFAULT_NUMCALLS = 250; + +Latency_Query_Client::Latency_Query_Client (void) + : debug_ (0), + do_dump_history_ (0), + iterations_ (DEFAULT_NUMCALLS) +{ +} + +Latency_Query_Client::~Latency_Query_Client (void) +{ +} + +int +Latency_Query_Client::init (int argc, + char *argv[]) +{ + ACE_TRY_NEW_ENV + { + this->orb_ = CORBA::ORB_init (argc, + argv, + 0 + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + int retval = this->parse_args (argc, + argv); + + if (retval != 0) + { + return retval; + } + + CORBA::Object_var object = + this->orb_->resolve_initial_references ("InterfaceRepository" + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (object.in ())) + { + ACE_ERROR_RETURN (( + LM_ERROR, + "Null objref from resolve_initial_references\n" + ), + -1 + ); + } + + this->repo_ = + CORBA::Repository::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (this->repo_.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "CORBA::Repository::_narrow failed\n"), + -1); + } + + retval = this->populate_ifr (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (retval != 0) + { + return retval; + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Latency_Query_Client::init:"); + return -1; + } + ACE_ENDTRY; + + return 0; +} + +int +Latency_Query_Client::run (void) +{ + CORBA::DefinitionKind dk; + + ACE_TRY_NEW_ENV + { + for (int j = 0; j < 100; ++j) + { + ACE_hrtime_t start = 0; + dk = this->tdef_->def_kind (ACE_ENV_SINGLE_ARG_PARAMETER); + + if (dk != CORBA::dk_Alias) + { + return -1; + } + + ACE_TRY_CHECK; + } + + ACE_Sample_History history (this->iterations_); + ACE_hrtime_t test_start = ACE_OS::gethrtime (); + + for (int i = 0; i < this->iterations_; ++i) + { + ACE_hrtime_t start = ACE_OS::gethrtime (); + + dk = this->tdef_->def_kind (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_hrtime_t now = ACE_OS::gethrtime (); + history.sample (now - start); + } + + ACE_hrtime_t test_end = ACE_OS::gethrtime (); + + ACE_DEBUG ((LM_DEBUG, + "test finished\n")); + ACE_DEBUG ((LM_DEBUG, + "High resolution timer calibration....")); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + ACE_DEBUG ((LM_DEBUG, + "done\n")); + + if (this->do_dump_history_) + { + history.dump_samples ("HISTORY", gsf); + } + + ACE_Basic_Stats stats; + history.collect_basic_stats (stats); + stats.dump_results ("Total", gsf); + + ACE_Throughput_Stats::dump_throughput ("Total", + gsf, + test_end - test_start, + stats.samples_count ()); + + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Latency_Query_Client::run:"); + return -1; + } + ACE_ENDTRY; + + return 0; +} + +Latency_Query_Client::parse_args (int argc, + char *argv[]) +{ + ACE_Get_Opt opts (argc, argv, "dhi:"); + int c; + int result = 0; + + while ((c = opts ()) != -1) + switch (c) + { + case 'd': + this->debug_ = 1; + break; + case 'h': + this->do_dump_history_ = 1; + break; + case 'i': + result = ACE_OS::atoi (opts.opt_arg ()); + + if (result > 0) + { + this->iterations_ = result; + } + + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " [-d]" + " [-i iterations]" + "\n", + argv [0]), + -1); + } + + return 0; +} + +int +Latency_Query_Client::populate_ifr (ACE_ENV_SINGLE_ARG_DECL) +{ + CORBA::Contained_var irobj = this->repo_->lookup_id ("IDL:longtype:1.0" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (! CORBA::is_nil (irobj.in ())) + { + this->tdef_ = CORBA::AliasDef::_narrow (irobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (this->tdef_.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Latency_Query_Client::populate_ifr - " + "AliasDef::_narrow returned null\n"), + -1); + } + + return 0; + } + + CORBA::PrimitiveDef_var longdef = + this->repo_->get_primitive (CORBA::pk_long + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (longdef.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Latency_Query_Client::populate_ifr - " + "get_primitive returned null\n"), + -1); + } + + this->tdef_ = + this->repo_->create_alias ("IDL:longtype:1.0", + "longtype", + "1.0", + longdef.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (CORBA::is_nil (this->tdef_.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Latency_Query_Client::populate_ifr - " + "create_alias returned null\n"), + -1); + } + + return 0; +} + diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Latency_Query_Client.h b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Latency_Query_Client.h new file mode 100644 index 00000000000..18b8164a0ea --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Latency_Query_Client.h @@ -0,0 +1,74 @@ +// -*- C++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/orbsvcs/tests/InterfaceRepo +// +// = FILENAME +// Latency_Query_Client.h +// +// = DESCRIPTION +// This class tests the latency of queries made on the IFR. +// +// = AUTHOR +// Jeff Parsons <parsons@isis-server.isis.vanderbilt.edu> +// +// ============================================================================ + +#if !defined (LATENCY_QUERY_CLIENT_H) +#define LATENCY_QUERY_CLIENT_H + +#include "tao/IFR_Client/IFR_BasicC.h" +#include "tao/corba.h" + +class Latency_Query_Client +{ + // = TITLE + // Querying IFR Client Implementation + // + // = DESCRIPTION + // Class wrapper for a client which queries the Interface Repository. +public: + Latency_Query_Client (void); + // Constructor + + ~Latency_Query_Client (void); + // Destructor + + int init (int argc, + char *argv[]); + // Initialize the ORB and get the IFR object reference. + + int run (void); + // Execute test code. +private: + int parse_args (int argc, + char *argv[]); + // Process the command line arguments. + + int populate_ifr (ACE_ENV_SINGLE_ARG_DECL); + // Put in something to query about. + +private: + CORBA::Boolean debug_; + // Toggle debugging output. + + CORBA::Boolean do_dump_history_; + // Toggle saving of dump history. + + CORBA::ULong iterations_; + // Number of queries in a run. + + CORBA::ORB_var orb_; + // Storage of the ORB reference. + + CORBA::Repository_var repo_; + // Storage of the IFR reference. + + CORBA::AliasDef_var tdef_; + // Storage of the typedef definition that we will query. +}; + +#endif /* LATENCY_QUERY_CLIENT_H */ diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Makefile b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Makefile new file mode 100644 index 00000000000..234f63208e5 --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/Makefile @@ -0,0 +1,55 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +LDLIBS = -lTAO_IFR_Client -lTAO + +PROG_SRCS = client.cpp Latency_Query_Client.cpp + +SRC = $(PROG_SRCS) + +IFR_TEST_OBJS = client.o Latency_Query_Client.o + +BIN = Latency_Test + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(TAO_ROOT)/rules.tao.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +LDFLAGS += -L$(TAO_ROOT)/tao + +Latency_Test: $(addprefix $(VDIR),$(IFR_TEST_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + + diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/client.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/client.cpp new file mode 100644 index 00000000000..b718a900b2e --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/client.cpp @@ -0,0 +1,29 @@ +// -*- C++ -*- +// $Id$ + +#include "Latency_Query_Client.h" + +ACE_RCSID (Latency__Test, + client, + "$Id$") + +int +main (int argc, char *argv[]) +{ + Latency_Query_Client client; + + ACE_DEBUG ((LM_DEBUG, + "\n\t IFR Latency Test \n\n")); + + int retval = client.init (argc, + argv); + + if (retval == -1) + { + return 1; + } + + retval = client.run (); + + return retval; +} diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/run_test.pl new file mode 100755 index 00000000000..ff69afd4809 --- /dev/null +++ b/TAO/orbsvcs/tests/InterfaceRepo/Latency_Test/run_test.pl @@ -0,0 +1,69 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "../../../../../bin"; +use PerlACE::Run_Test; + +$iorfile = "if_repo.ior"; + +$status = 0; +$nice = "-ORBDottedDecimalAddresses 1"; +$debug = ""; +$history = ""; +$iterations = ""; +$other = ""; + +for ($i = 0; $i <= $#ARGV; $i++) { + if ($ARGV[$i] eq "-d") { + $debug = "-d"; + } + elsif ($ARGV[$i] eq "-h") { + $history = "-h "; + $i++; + } + elsif ($ARGV[$i] eq "-i") { + $iterations = "-i ".$ARGV[$i + 1]; + $i++; + } + else { + $other .= $ARGV[$i]; + } +} + +unlink $iorfile; + +$SV = new PerlACE::Process ("../../../IFR_Service/IFR_Service", " $nice"); +$CL = new PerlACE::Process ("client", + "-ORBInitRef InterfaceRepository=file://$iorfile" + . " $debug $history $iterations"); + +$SV->Spawn (); + +if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) { + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $SV->Kill (); + exit 1; +} + +$client = $CL->SpawnWaitKill (60); + +if ($client != 0) { + print STDERR "ERROR: client returned $client\n"; + $status = 1; +} + +$server = $SV->TerminateWaitKill (5); + +if ($server != 0) { + print STDERR "ERROR: server returned $server\n"; + $status = 1; +} + +unlink $iorfile; + +exit $status; + |