summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2011-05-10 16:21:58 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2011-05-10 16:21:58 +0000
commit39ab4218c4e3686e9028429df27a93a17a2e8ebc (patch)
tree5d12f92cc12242ab555b26330db628d51185dd4c
parenta7780dff310fc13406f09fd6d2099b98aa418968 (diff)
downloadATCD-39ab4218c4e3686e9028429df27a93a17a2e8ebc.tar.gz
Tue May 10 16:13:44 UTC 2011 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--ChangeLog25
-rw-r--r--performance-tests/Alt_Mapping/StringMember/StringMember.idl2
-rw-r--r--performance-tests/Alt_Mapping/StringMember/StringMember.mpc26
-rw-r--r--performance-tests/Alt_Mapping/StringMember/StringMember_Test.cpp201
-rw-r--r--performance-tests/Alt_Mapping/StringMember/StringMember_Test.h67
-rw-r--r--performance-tests/Alt_Mapping/StringMember/client.cpp145
-rw-r--r--performance-tests/Alt_Mapping/StringMember/run_test.pl71
-rw-r--r--performance-tests/Alt_Mapping/StringMember/server.cpp98
8 files changed, 313 insertions, 322 deletions
diff --git a/ChangeLog b/ChangeLog
index cde4c1ee135..d93fa3f6bf7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+Tue May 10 16:13:44 UTC 2011 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * performance-tests/Alt_Mapping/StringMember/client.cpp:
+ * performance-tests/Alt_Mapping/StringMember/server.cpp:
+
+ Removed these files.
+
+ * performance-tests/Alt_Mapping/StringMember/StringMember_Test.cpp:
+ * performance-tests/Alt_Mapping/StringMember/StringMember_Test.h:
+
+ New files, combining client and server in the same process.
+
+ * performance-tests/Alt_Mapping/StringMember/StringMember.idl:
+
+ Removed the shutdown() operation, no need to invoke it remotely
+ any more.
+
+ * performance-tests/Alt_Mapping/StringMember/StringMember.mpc:
+ * performance-tests/Alt_Mapping/StringMember/run_test.pl:
+
+ Mods reflecting the above changes. The overall intent is to
+ measure the average latency difference between setting the
+ operation argument with and without a string copy, without
+ including any measurement of network overhead.
+
Tue Apr 12 20:11:30 UTC 2011 Jeff Parsons <j.parsons@vanderbilt.edu>
* performance-tests/Alt_Mapping/StringMember/*.*:
diff --git a/performance-tests/Alt_Mapping/StringMember/StringMember.idl b/performance-tests/Alt_Mapping/StringMember/StringMember.idl
index 6e9231930f5..f7ccf84b1e5 100644
--- a/performance-tests/Alt_Mapping/StringMember/StringMember.idl
+++ b/performance-tests/Alt_Mapping/StringMember/StringMember.idl
@@ -11,8 +11,6 @@ struct Foo
interface Test
{
void test_op (in Foo inarg);
-
- void shutdown ();
};
#endif // STRINGMEMBER_IDL
diff --git a/performance-tests/Alt_Mapping/StringMember/StringMember.mpc b/performance-tests/Alt_Mapping/StringMember/StringMember.mpc
index cc7af5296f7..07808bd7fca 100644
--- a/performance-tests/Alt_Mapping/StringMember/StringMember.mpc
+++ b/performance-tests/Alt_Mapping/StringMember/StringMember.mpc
@@ -38,25 +38,6 @@ project(*Stub): taolib, anytypecode, codeset, avoids_minimum_corba, avoids_ace_f
}
}
-project(*Client): taoexe, codeset {
- exename = client
- after += *Stub
- libs += String_Member_Stub
-
- IDL_Files {
- }
-
- Source_Files {
- client.cpp
- }
-
- Header_Files {
- }
-
- Inline_Files {
- }
-}
-
project(*Skel): portableserver, codeset, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro {
after += *Stub
sharedname = String_Member_Skel
@@ -80,8 +61,8 @@ project(*Skel): portableserver, codeset, avoids_minimum_corba, avoids_corba_e_co
}
}
-project(*Server): taoexe, codeset, portableserver {
- exename = server
+project(*Test): taoexe, codeset, portableserver {
+ exename = test
after += *Skel
libs += String_Member_Skel String_Member_Stub
@@ -89,10 +70,11 @@ project(*Server): taoexe, codeset, portableserver {
}
Source_Files {
- server.cpp
+ StringMember_Test.cpp
}
Header_Files {
+ StringMember_Test.h
}
Inline_Files {
diff --git a/performance-tests/Alt_Mapping/StringMember/StringMember_Test.cpp b/performance-tests/Alt_Mapping/StringMember/StringMember_Test.cpp
new file mode 100644
index 00000000000..16a412b2170
--- /dev/null
+++ b/performance-tests/Alt_Mapping/StringMember/StringMember_Test.cpp
@@ -0,0 +1,201 @@
+// $Id$
+
+#include "ace/High_Res_Timer.h"
+#include "ace/Basic_Stats.h"
+#include "ace/Sample_History.h"
+#include "ace/OS_NS_ctype.h"
+#include "ace/Get_Opt.h"
+
+#include "StringMember_Test.h"
+
+StringMember_Test::StringMember_Test (void)
+ : iterations_ (10000),
+ str_len_ (40),
+ str_copy_ (false)
+{
+}
+
+void
+StringMember_Test::shutdown (void)
+{
+ this->root_poa_->destroy (true, true);
+ this->orb_->destroy ();
+}
+
+int
+StringMember_Test::init (int argc, ACE_TCHAR *argv[])
+{
+ // Initialize the ORB.
+ this->orb_ = CORBA::ORB_init (argc, argv);
+
+ int result = this->parse_args (argc, argv);
+
+ if (result != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("parse_args failed\n")),
+ result);
+ }
+
+ // Get an Object reference to RootPOA.
+ CORBA::Object_var obj =
+ this->orb_->resolve_initial_references ("RootPOA");
+
+ // Narrow the Object reference to a POA reference
+ this->root_poa_ =
+ PortableServer::POA::_narrow (obj.in ());
+
+ // Get the POAManager of RootPOA
+ this->poa_manager_ =
+ this->root_poa_->the_POAManager ();
+
+ // Activate the servant under RootPOA.
+ // With the alternate mapping, ObjectId is an std::vector,
+ // no need for a _var.
+ PortableServer::ObjectId id =
+ this->root_poa_->activate_object (&this->servant_);
+
+ // Create an object reference.
+ this->test_obj_ = this->root_poa_->id_to_reference (id);
+
+ return 0;
+}
+
+int
+StringMember_Test::parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("n:l:c"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'n':
+ this->iterations_ = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+ case 'l':
+ this->str_len_ = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+ case 'c':
+ this->str_copy_ = true;
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-n <iterations> "
+ "-l <string length> "
+ "-c toggle string copy on "
+ "\n",
+ argv [0]),
+ -1);
+ }
+
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+StringMember_Test::run (void)
+{
+ this->poa_manager_->activate ();
+ Test_var objref = Test::_narrow (this->test_obj_.in ());
+
+ CORBA::String_var str = gen_string ();
+ std::string data (str.in ());
+
+ Foo arg;
+
+ // Set the arg to anything and make a call to set up and cache
+ // the CORBA connection. Subsequent timed calls will not incur
+ // the connection overhead.
+ arg.strmem = "who cares?";
+ objref->test_op (arg);
+
+ ACE_Sample_History history (this->iterations_);
+
+ if (this->str_copy_)
+ {
+ for (int i = 0; i < this->iterations_; ++i)
+ {
+ ACE_hrtime_t start = ACE_OS::gethrtime ();
+ arg.strmem = data.c_str ();
+ objref->test_op (arg);
+ ACE_hrtime_t stop = ACE_OS::gethrtime ();
+ history.sample (stop - start);
+ }
+ }
+ else
+ {
+ for (int i = 0; i < this->iterations_; ++i)
+ {
+ ACE_hrtime_t start = ACE_OS::gethrtime ();
+ arg.strmem = data;
+ objref->test_op (arg);
+ ACE_hrtime_t stop = ACE_OS::gethrtime ();
+ history.sample (stop - start);
+ }
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("string length = \t%d\n")
+ ACE_TEXT ("number of iterations = %d\n"),
+ this->str_len_,
+ this->iterations_));
+
+ ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
+ ACE_Basic_Stats stats;
+ history.collect_basic_stats (stats);
+ stats.dump_results (
+ (this->str_copy_ ? ACE_TEXT ("Copy") : ACE_TEXT ("No Copy")),
+ gsf);
+
+ return 0;
+}
+
+char *
+StringMember_Test::gen_string (void)
+{
+ char *buf = CORBA::string_alloc (this->str_len_);
+ CORBA::ULong i = 0;
+
+ while (i < this->str_len_)
+ {
+ int c = ACE_OS::rand () % 128;
+
+ if (ACE_OS::ace_isprint (c) && !ACE_OS::ace_isspace (c))
+ {
+ buf [i] = c;
+ i++;
+ }
+ }
+
+ buf[i] = 0;
+ return buf;
+}
+
+int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ StringMember_Test test;
+
+ test.init (argc, argv);
+
+ test.run ();
+
+ test.shutdown ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("client: CORBA Exception caught");
+ return -1;
+ }
+ catch (...)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "client: unknown exception caught\n"),
+ -1);
+ }
+
+ return 0;
+}
diff --git a/performance-tests/Alt_Mapping/StringMember/StringMember_Test.h b/performance-tests/Alt_Mapping/StringMember/StringMember_Test.h
new file mode 100644
index 00000000000..90ec58cd8d6
--- /dev/null
+++ b/performance-tests/Alt_Mapping/StringMember/StringMember_Test.h
@@ -0,0 +1,67 @@
+// $Id$
+
+//============================================================================
+//
+// = StringMember_Test
+// Collocation_Test.h
+//
+// = DESCRIPTION
+// Class to perform collocated performance test.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+//=============================================================================
+
+#if !defined (STRINGMEMBER_TEST_H)
+#define STRINGMEMBER_TEST_H
+
+#include "StringMemberS.h"
+
+class Test_i : public virtual POA_Test
+{
+public:
+ Test_i (void)
+ {
+ }
+
+ virtual void
+ test_op (const Foo & /* inarg */)
+ {
+ }
+};
+
+class StringMember_Test
+{
+public:
+ StringMember_Test (void);
+
+ void shutdown (void);
+
+ int init (int argc, ACE_TCHAR *argv[]);
+
+ int parse_args (int argc, ACE_TCHAR *argv[]);
+
+ int run (void);
+
+private:
+ char *gen_string (void);
+
+private:
+ CORBA::ORB_var orb_;
+
+ PortableServer::POA_var root_poa_;
+
+ PortableServer::POAManager_var poa_manager_;
+
+ CORBA::Object_var test_obj_;
+
+ Test_i servant_;
+
+ int iterations_;
+ CORBA::ULong str_len_;
+ bool str_copy_;
+};
+
+#endif // STRINGMEMBER_TEST_H
+
diff --git a/performance-tests/Alt_Mapping/StringMember/client.cpp b/performance-tests/Alt_Mapping/StringMember/client.cpp
deleted file mode 100644
index 3a89abf76fd..00000000000
--- a/performance-tests/Alt_Mapping/StringMember/client.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-// $Id$
-
-//========================================================================
-//
-// = FILENAME
-// client.cpp
-//
-// = DESCRIPTION
-// This is the driver program that compares copy and non-copy performance
-// of arg string member assignment from std::string.
-//
-// = AUTHOR
-// Jeff Parsons <j.parsons@vanderbilt.edu>
-//
-//=========================================================================
-
-#include "ace/High_Res_Timer.h"
-#include "ace/Basic_Stats.h"
-#include "ace/Sample_History.h"
-#include "ace/OS_NS_ctype.h"
-#include "ace/Get_Opt.h"
-
-#include "StringMemberC.h"
-
-const char *ior_file = "file://StringMember.ior";
-int niterations = 10000;
-CORBA::ULong len = 40;
-
-int
-parse_args (int argc, ACE_TCHAR *argv[])
-{
- ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("n:l:"));
- int c;
-
- while ((c = get_opts ()) != -1)
- switch (c)
- {
- case 'n':
- niterations = ACE_OS::atoi (get_opts.opt_arg ());
- break;
- case 'l':
- len = ACE_OS::atoi (get_opts.opt_arg ());
- break;
- case '?':
- default:
- ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s "
- "-n <iterations> "
- "-l <string length> "
- "\n",
- argv [0]),
- -1);
- }
- // Indicates sucessful parsing of the command line
- return 0;
-}
-
-char *
-gen_string (void)
-{
- char *buf = CORBA::string_alloc (len);
- CORBA::ULong i = 0;
-
- while (i < len)
- {
- int c = ACE_OS::rand () % 128;
-
- if (ACE_OS::ace_isprint (c) && !ACE_OS::ace_isspace (c))
- {
- buf [i] = c;
- i++;
- }
- }
-
- buf[i] = 0;
- return buf;
-}
-
-int
-ACE_TMAIN (int argc, char *argv[])
-{
- try
- {
- CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
-
- CORBA::Object_var obj = orb->string_to_object (ior_file);
-
- Test_var target = Test::_narrow (obj.in ());
-
- if (parse_args (argc, argv) != 0)
- {
- return 1;
- }
-
- CORBA::String_var str = gen_string ();
- std::string data (str.in ());
-
- Foo arg;
-
- ACE_Sample_History no_copy_history (niterations);
-
- for (int i = 0; i < niterations; ++i)
- {
- ACE_hrtime_t start = ACE_OS::gethrtime ();
- arg.strmem = data;
- target->test_op (arg);
- ACE_hrtime_t now = ACE_OS::gethrtime ();
- no_copy_history.sample (now - start);
- }
-
- ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
- ACE_Basic_Stats no_copy_stats;
- no_copy_history.collect_basic_stats (no_copy_stats);
- no_copy_stats.dump_results (ACE_TEXT ("No Copy"), gsf);
-
- ACE_Sample_History copy_history (niterations);
-
- for (int i = 0; i < niterations; ++i)
- {
- ACE_hrtime_t start = ACE_OS::gethrtime ();
- arg.strmem = data.c_str ();
- target->test_op (arg);
- ACE_hrtime_t now = ACE_OS::gethrtime ();
- copy_history.sample (now - start);
- }
-
- ACE_Basic_Stats copy_stats;
- copy_history.collect_basic_stats (copy_stats);
- copy_stats.dump_results (ACE_TEXT ("Copy"), gsf);
-
-// target->shutdown ();
- }
- catch (const CORBA::Exception& ex)
- {
- ex._tao_print_exception ("client: CORBA Exception caught");
- return -1;
- }
- catch (...)
- {
- ACE_ERROR_RETURN ((LM_ERROR, "client: unknown exception caught\n"),
- -1);
- }
-
- return 0;
-}
diff --git a/performance-tests/Alt_Mapping/StringMember/run_test.pl b/performance-tests/Alt_Mapping/StringMember/run_test.pl
index 03c0b93676e..6eb7f6d4e38 100644
--- a/performance-tests/Alt_Mapping/StringMember/run_test.pl
+++ b/performance-tests/Alt_Mapping/StringMember/run_test.pl
@@ -8,17 +8,11 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
use lib "$ENV{ACE_ROOT}/bin";
use PerlACE::TestTarget;
-my $server = PerlACE::TestTarget::create_target(1) || die "Create target 1 failed\n";
-my $client = PerlACE::TestTarget::create_target(2) || die "Create target 2 failed\n";
-
-$iorbase = "StringMember.ior";
-my $server_iorfile = $server->LocalFile ($iorbase);
-my $client_iorfile = $client->LocalFile ($iorbase);
-$server->DeleteFile($iorbase);
-$client->DeleteFile($iorbase);
+my $test = PerlACE::TestTarget::create_target(1) || die "Create target failed\n";
$num = 10000;
$len = 40;
+$copy = 0;
$status = 0;
# Parse the arguments
@@ -30,6 +24,7 @@ for ($i = 0; $i <= $#ARGV; $i++) {
print "\n";
print "-n num -- num iterations for stats\n";
print "-l length -- string member length\n";
+ print "-c -- toggle copying string assignment\n";
exit 0;
}
elsif ($ARGV[$i] eq "-n") {
@@ -40,59 +35,25 @@ for ($i = 0; $i <= $#ARGV; $i++) {
$len = $ARGV[$i + 1];
$i++;
}
+ elsif ($ARGV[$i] eq "-c") {
+ $copy = 1;
+ }
}
-$SV = $server->CreateProcess ("server");
-$CL = $client->CreateProcess ("client");
+$TEST = $test->CreateProcess ("test");
-$server->DeleteFile($iorbase); # Ignore errors
-$client->DeleteFile($iorbase);
+if ($copy == 1) {
+ $TEST->Arguments ("-n $num -l $len -c");
+}
+else {
+ $TEST->Arguments ("-n $num -l $len");
+}
-$server_status = $SV->Spawn ();
+$test_status = $TEST->SpawnWaitKill (10);
-if ($server_status != 0) {
- print STDERR "ERROR: server returned $server_status\n";
+if ($test_status != 0) {
+ print STDERR "ERROR: test returned $test_status\n";
$status = 1;
-} else {
- if ($server->WaitForFileTimed ($iorbase,
- $server->ProcessStartWaitInterval()) == -1) {
- print STDERR "ERROR: cannot find file <$server_iorfile>\n";
- $SV->Kill ();
- exit 1;
- }
-
- if ($server->GetFile ($iorbase) == -1) {
- print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
- }
- if ($client->PutFile ($iorbase) == -1) {
- print STDERR "ERROR: cannot set file <$client_iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
- }
-
- $CL->Arguments ("-n $num -l $len");
- $client_status = $CL->SpawnWaitKill ($server->ProcessStartWaitInterval() + 45);
-
- if ($client_status != 0) {
- print STDERR "ERROR: client returned $client_status\n";
- $status = 1;
- }
-
- $server_status = $SV->Kill ();
-
- if ($server_status != 0) {
- print STDERR "ERROR: server returned $server_status\n";
- $status = 1;
- }
-
- $server->GetStderrLog();
-
- $server->DeleteFile($iorbase);
- $client->DeleteFile($iorbase);
}
-$server->DeleteFile($iorbase);
-
exit $status;
diff --git a/performance-tests/Alt_Mapping/StringMember/server.cpp b/performance-tests/Alt_Mapping/StringMember/server.cpp
deleted file mode 100644
index 9f3b2c07402..00000000000
--- a/performance-tests/Alt_Mapping/StringMember/server.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = FILENAME
-// server.cpp
-//
-// = DESCRIPTION
-// The server process for the StringMember test
-//
-// = AUTHOR
-// Jeff Parsons <j.parsons@vanderbilt.edu>
-//
-// ============================================================================
-
-#include "ace/OS_NS_stdio.h"
-
-#include "StringMemberS.h"
-
-const char *ior_file = "StringMember.ior";
-
-class Test_i : public virtual POA_Test
-{
-public:
- Test_i (CORBA::ORB_ptr orb)
- : orb_ (orb)
- {
- }
-
- virtual void
- test_op (const Foo & /* inarg */)
- {
- }
-
- virtual void
- shutdown (void)
- {
- this->orb_->shutdown (false);
- }
-
-private:
- CORBA::ORB_ptr orb_;
-};
-
-int
-ACE_TMAIN (int argc, char *argv[])
-{
- try
- {
- CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
-
- CORBA::Object_var obj =
- orb->resolve_initial_references ("RootPOA");
-
- PortableServer::POA_var root_poa =
- PortableServer::POA::_narrow (obj.in ());
-
- PortableServer::POAManager_var poa_manager =
- root_poa->the_POAManager ();
-
- poa_manager->activate ();
-
- Test_i servant (orb.in ());
- Test_var objref = servant._this ();
-
- CORBA::String_var ior = orb->object_to_string (objref.in ());
-
- FILE *output_file= ACE_OS::fopen (ior_file, "w");
-
- if (output_file == 0)
- {
- ACE_ERROR ((LM_ERROR,
- "Cannot open output file for writing IOR: %s",
- ior_file));
- return -1;
- }
-
- ACE_OS::fprintf (output_file, "%s", ior.in ());
- ACE_OS::fclose (output_file);
-
- orb->run ();
-
- root_poa->destroy (false, false);
- orb->destroy ();
- }
- catch (const CORBA::Exception& ex)
- {
- ex._tao_print_exception ("server: CORBA Exception caught");
- return -1;
- }
- catch (...)
- {
- ACE_ERROR_RETURN ((LM_ERROR, "server: unknown exception caught\n"),
- -1);
- }
-
- return 0;
-}