summaryrefslogtreecommitdiff
path: root/ACE/performance-tests/Synch-Benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/performance-tests/Synch-Benchmarks')
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp237
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h153
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.inl43
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Base_Test/Makefile.am52
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Base_Test/Synch_Benchmarks_Base_Test.mpc16
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp62
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp205
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Makefile.am44
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Adaptive_Lock_Performance_Test_Base.cpp48
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Adaptive_Lock_Performance_Test_Base.h24
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Benchmark_Performance.cpp60
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Benchmark_Performance.h48
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Makefile.am73
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test.cpp122
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test.h32
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp469
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.h133
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.inl269
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/README76
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/Synch_Benchmarks_Perf_Test.mpc16
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_mutex_test.cpp32
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_recursive_lock_test.cpp33
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_sema_test.cpp38
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/condb_test.cpp69
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/conds_test.cpp72
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/context_test.cpp38
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/guard_test.cpp126
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/memory_test.cpp42
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/mutex_test.cpp45
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/pipe_proc_test.cpp86
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/pipe_thr_test.cpp79
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/recursive_lock_test.cpp44
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/rwrd_test.cpp45
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/rwwr_test.cpp45
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/sema_test.cpp45
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/sysvsema_test.cpp67
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Perf_Test/token_test.cpp46
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/README46
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Synch_Benchmarks.mpc12
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp95
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.h114
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Makefile.am36
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Synch_Lib/README4
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Synch_Benchmarks_Synch_Lib.mpc7
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/Synch_Lib/export_mac.h40
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/benchmarks19
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/context.c76
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/context.csh16
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/orig-results73
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/results/.no_prune1
-rwxr-xr-xACE/performance-tests/Synch-Benchmarks/run_tests.pl131
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire.conf20
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire_read.conf20
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire_write.conf20
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire.conf20
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire_read.conf20
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire_write.conf20
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t1.conf32
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t16.conf32
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t2.conf32
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t32.conf32
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t4.conf32
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t64.conf32
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t8.conf32
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/svcconf/svc.conf29
-rw-r--r--ACE/performance-tests/Synch-Benchmarks/synch_driver.cpp52
66 files changed, 4229 insertions, 0 deletions
diff --git a/ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp b/ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
new file mode 100644
index 00000000000..48d57269f18
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
@@ -0,0 +1,237 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+
+#include "Baseline_Test.h"
+
+# if defined (ACE_HAS_THREADS)
+
+#include "ace/OS_NS_unistd.h"
+#include "ace/Service_Repository.h"
+#include "ace/Get_Opt.h"
+#include "ace/Thread_Manager.h"
+
+#if !defined (__ACE_INLINE__)
+#include "Baseline_Test.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID (Base_Test,
+ Baseline_Test,
+ "$Id$")
+
+Baseline_Test_Options baseline_options;
+// Static Baseline Options holds the test configuration information
+// and the test statistics.
+
+Baseline_Test_Base::Baseline_Test_Base (void)
+ : Benchmark_Base (Benchmark_Base::BASELINE),
+ yield_method_ (Baseline_Test_Options::USE_SLEEP_ZERO),
+ iteration_ (DEFAULT_ITERATIONS),
+ what_(TEST_LOCK)
+{
+}
+
+int
+Baseline_Test_Base::init (int argc, ACE_TCHAR *argv[])
+{
+ return this->parse_args (argc, argv);
+}
+
+int
+Baseline_Test_Base::parse_args (int argc, ACE_TCHAR *argv[])
+{
+ //FUZZ: disable check_for_lack_ACE_OS
+ ACE_Get_Opt getopt (argc, argv, ACE_TEXT("i:ylrw"), 0);
+ int c;
+
+ while ((c = getopt ()) != -1)
+ //FUZZ: enable check_for_lack_ACE_OS
+ switch (c)
+ {
+ case 'i': // Total iterations
+ {
+ int tmp = ACE_OS::atoi (getopt.opt_arg ());
+ if (tmp <= 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%d is not a valid value for iteration\n",
+ tmp), -1);
+ else
+ this->iteration_ = static_cast<size_t> (tmp);
+ }
+ break;
+
+ case 'y': // Use thr_yield.
+ this->yield_method_ = Baseline_Test_Options::USE_THR_YIELD;
+ break;
+
+ case 'l':
+ this->what_ = TEST_LOCK;
+ break;
+
+ case 'r':
+ this->what_ = TEST_READLOCK;
+ break;
+
+ case 'w':
+ this->what_ = TEST_WRITELOCK;
+ break;
+
+ default:
+ ACE_ERROR ((LM_ERROR, "Invalid argument %c used\n", c));
+ break;
+ }
+ return 0;
+}
+
+void
+Baseline_Test_Base::yield (void)
+{
+ if (this->yield_method_ == Baseline_Test_Options::USE_SLEEP_ZERO)
+ ACE_OS::sleep (0);
+ else
+ ACE_OS::thr_yield ();
+}
+
+Baseline_Test_Options::Baseline_Test_Options (void)
+ : test_try_lock_ (0),
+ verbose_ (0),
+ current_yield_method_ (0),
+ current_iteration_ (0),
+ total_iteration_ (DEFAULT_ITERATIONS)
+{
+}
+
+int
+Baseline_Test_Options::parse_args (int argc, ACE_TCHAR *argv[])
+{
+ //FUZZ: disable check_for_lack_ACE_OS
+ ACE_Get_Opt getopt (argc, argv, ACE_TEXT("tv"), 0);
+ int c;
+
+ while ((c = getopt ()) != -1)
+ //FUZZ: enable check_for_lack_ACE_OS
+ switch (c)
+ {
+ case 't':
+ this->test_try_lock_ = 1;
+ break;
+
+ case 'v':
+ this->verbose_ = 1;
+ break;
+
+ default:
+ ACE_ERROR ((LM_ERROR, "Invalid arguemnt %c used.\n", c));
+ break;
+ }
+ return 0;
+}
+
+int
+Baseline_Test_Options::reset_params (size_t iteration,
+ int yield)
+{
+ this->current_iteration_ = 0;
+ this->timer.reset ();
+
+ this->current_yield_method_ = yield;
+ this->total_iteration_ = iteration;
+ return 0;
+}
+
+void
+Baseline_Test_Options::print_result (void)
+{
+ ACE_Time_Value tv;
+ ACE_hrtime_t nsec;
+
+ this->timer.elapsed_time_incr (tv);
+ this->timer.elapsed_time_incr (nsec);
+ ACE_DEBUG ((LM_DEBUG,
+ "Total Time: %d sec %d usec for a "
+ "total of %d iterations\n"
+ "Average time: %d nanoseconds.\n",
+ tv.sec (), tv.usec (),
+ this->current_iteration_,
+ (int) (nsec / this->current_iteration_)));
+}
+
+Baseline_Test::Baseline_Test (void)
+ : current_test_ (0),
+ get_lock_ (2),
+ let_go_lock_ (2)
+{
+}
+
+// Initialize and run the benchmarks tests.
+
+int
+Baseline_Test::init (int argc, ACE_TCHAR **argv)
+{
+ return baseline_options.parse_args (argc, argv);
+}
+
+int
+Baseline_Test::pre_run_test (Benchmark_Base *bb)
+{
+ this->current_test_ = (Baseline_Test_Base *) bb;
+ baseline_options.reset_params (this->current_test_->iteration (),
+ this->current_test_->yield_method ());
+ if (baseline_options.test_try_lock ())
+ {
+ ACE_Thread_Manager::instance ()->spawn
+ (ACE_THR_FUNC (Baseline_Test::hold_lock),
+ (void *) this);
+
+ this->get_lock_.wait ();
+ // Wait until the lock is held by the spawning thread.
+ }
+
+ return 0;
+}
+
+int
+Baseline_Test::run_test (void)
+{
+ if (baseline_options.test_try_lock ())
+ return this->current_test_->test_try_lock ();
+ else
+ return this->current_test_->test_acquire_release ();
+}
+
+int
+Baseline_Test::post_run_test (void)
+{
+ if (baseline_options.test_try_lock ())
+ {
+ // Release the lock we hold.
+ this->let_go_lock_.wait ();
+
+ ACE_Thread_Manager::instance ()->wait ();
+ }
+
+ baseline_options.print_result ();
+
+ return 0;
+}
+
+int
+Baseline_Test::valid_test_object (Benchmark_Base *bb)
+{
+ return (bb->benchmark_type () == Benchmark_Base::BASELINE);
+}
+
+void *
+Baseline_Test::hold_lock (void *arg)
+{
+ Baseline_Test *this_test = (Baseline_Test *) arg;
+ this_test->current_test_->acquire ();
+ this_test->get_lock_.wait ();
+
+ this_test->let_go_lock_.wait ();
+ return 0;
+}
+
+ACE_SVC_FACTORY_DEFINE (Baseline_Test)
+
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h b/ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
new file mode 100644
index 00000000000..2896833f60e
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
@@ -0,0 +1,153 @@
+// -*- C++ -*-
+// $Id$
+
+#ifndef ACE_BASELINE_TEST_H
+#define ACE_BASELINE_TEST_H
+
+#include "Synch_Lib/Benchmark_Base.h"
+
+#if defined (ACE_HAS_THREADS)
+
+#include "ace/Profile_Timer.h"
+#include "ace/svc_export.h"
+#include "ace/Barrier.h"
+
+const unsigned long DEFAULT_ITERATIONS = 1000000;
+
+class ACE_Svc_Export Baseline_Test_Base : public Benchmark_Base
+{
+ // = TITLE
+ // This class identifies itself as Benmarking Performance Test class.
+public:
+ enum {
+ TEST_LOCK,
+ TEST_READLOCK,
+ TEST_WRITELOCK
+ };
+
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ // Standard initializing method for Baseline Test.
+
+ int parse_args (int argc, ACE_TCHAR *argv[]);
+ // Parsing the svc.conf file arguments.
+
+ virtual int acquire () = 0;
+ virtual int release () = 0;
+ // These two method are used to test try_acquire performance.
+
+ virtual int test_acquire_release () = 0;
+ virtual int test_try_lock () = 0;
+ // Real test methods.
+
+ virtual int yield_method ();
+ // Query the yield method used.
+
+ virtual void yield ();
+ // Yield to other thread.
+
+ size_t iteration (void);
+ // Access methods.
+
+protected:
+ Baseline_Test_Base (void);
+
+ int yield_method_;
+ // Should we your thr_yield or sleep (0).
+
+ size_t iteration_;
+ // Total number of operations. <iterations_>
+
+ int what_;
+ // What test should be performed?
+};
+
+class ACE_Svc_Export Baseline_Test_Options
+{
+ // = TITLE
+ // This class holds the global settings for Baseline Test.
+public:
+ friend class Baseline_Test;
+
+ enum
+ {
+ USE_SLEEP_ZERO,
+ USE_THR_YIELD
+ };
+
+ Baseline_Test_Options (void);
+ // ctor.
+
+ int parse_args (int argc, ACE_TCHAR *argv[]);
+ // Parse and set the Baseline_Test options and flags.
+
+ int reset_params (size_t iteration, int yield);
+ // Reset test parameters for next round.
+
+ int test_try_lock (void);
+ // Return test configuration.
+
+ void start_inc_timer (void);
+ void stop_inc_timer (void);
+ // Start/stop measuring time.
+
+ int inc_loop_counter (void);
+ // Returns
+
+ size_t current_iteration (void);
+ // Return <iteration_>.
+
+ void print_result (void);
+ // Print out the result.
+
+private:
+ int test_try_lock_;
+ // A flag indicates whether we are testing try_lock or lock and
+ // release.
+
+ int verbose_;
+ // Print out the result in verbose mode.
+
+ int current_yield_method_;
+ // yield or sleep.
+
+ size_t current_iteration_;
+ // Number of iteration.
+
+ size_t total_iteration_;
+ // Total number of target iteration.
+
+ ACE_High_Res_Timer timer;
+ // Profile timer result.
+};
+
+extern Baseline_Test_Options baseline_options;
+
+class ACE_Svc_Export Baseline_Test : public Benchmark_Method_Base
+{
+public:
+ Baseline_Test (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int pre_run_test (Benchmark_Base *bp);
+ virtual int run_test (void);
+ virtual int post_run_test (void);
+ virtual int valid_test_object (Benchmark_Base *);
+
+ static void *hold_lock (void * arg);
+ // This method runs in a separate thread, and is used to hold the lock while
+ // we test the performance of try lock.
+
+private:
+ Baseline_Test_Base *current_test_;
+ ACE_Barrier get_lock_;
+ ACE_Barrier let_go_lock_;
+};
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Test)
+
+#if defined (__ACE_INLINE__)
+#include "Baseline_Test.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* ACE_HAS_THREADS */
+
+#endif /* ACE_BASELINE_TEST_H */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.inl b/ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.inl
new file mode 100644
index 00000000000..05aa007478d
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.inl
@@ -0,0 +1,43 @@
+// $Id$
+
+ACE_INLINE size_t
+Baseline_Test_Base::iteration (void)
+{
+ return this->iteration_;
+}
+
+ACE_INLINE int
+Baseline_Test_Base::yield_method (void)
+{
+ return this->yield_method_;
+}
+
+ACE_INLINE int
+Baseline_Test_Options::test_try_lock (void)
+{
+ return this->test_try_lock_;
+}
+
+ACE_INLINE size_t
+Baseline_Test_Options::current_iteration (void)
+{
+ return this->current_iteration_;
+}
+
+ACE_INLINE void
+Baseline_Test_Options::start_inc_timer (void)
+{
+ this->timer.start_incr ();
+}
+
+ACE_INLINE void
+Baseline_Test_Options::stop_inc_timer (void)
+{
+ this->timer.stop_incr ();
+}
+
+ACE_INLINE int
+Baseline_Test_Options::inc_loop_counter (void)
+{
+ return (++this->current_iteration_ < this->total_iteration_);
+}
diff --git a/ACE/performance-tests/Synch-Benchmarks/Base_Test/Makefile.am b/ACE/performance-tests/Synch-Benchmarks/Base_Test/Makefile.am
new file mode 100644
index 00000000000..f5f4158d270
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Base_Test/Makefile.am
@@ -0,0 +1,52 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
+
+ACE_BUILDDIR = $(top_builddir)
+ACE_ROOT = $(top_srcdir)
+
+
+## Makefile.Synch_Benchmarks_Base_Test.am
+
+if !BUILD_ACE_FOR_TAO
+
+noinst_LTLIBRARIES = libBase_Test.la
+
+libBase_Test_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(srcdir)/..
+
+libBase_Test_la_SOURCES = \
+ Baseline_Test.cpp \
+ base_test.cpp \
+ mutex_test.cpp
+
+../Synch_Lib:
+ mkdir -p ../Synch_Lib
+
+libBase_Test_la_DEPENDENCIES = \
+ ../Synch_Lib
+
+libBase_Test_la_LDFLAGS = \
+ -L../Synch_Lib
+
+noinst_HEADERS = \
+ Baseline_Test.h \
+ Baseline_Test.inl
+
+endif !BUILD_ACE_FOR_TAO
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/performance-tests/Synch-Benchmarks/Base_Test/Synch_Benchmarks_Base_Test.mpc b/ACE/performance-tests/Synch-Benchmarks/Base_Test/Synch_Benchmarks_Base_Test.mpc
new file mode 100644
index 00000000000..47d16a47bb3
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Base_Test/Synch_Benchmarks_Base_Test.mpc
@@ -0,0 +1,16 @@
+// -*- MPC -*-
+// $Id$
+
+project : acelib {
+ sharedname = Base_Test
+ avoids += ace_for_tao
+ after += Synch_Lib
+ libs += Synch_Lib
+ libpaths += ../Synch_Lib
+
+ specific (automake) {
+ includes += $(srcdir)/..
+ } else {
+ includes += ..
+ }
+}
diff --git a/ACE/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp
new file mode 100644
index 00000000000..6d3622c27b8
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp
@@ -0,0 +1,62 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+
+#include "Baseline_Test.h"
+
+# if defined (ACE_HAS_THREADS)
+
+#include "ace/Log_Msg.h"
+
+class ACE_Svc_Export Baseline_Base_Test : public Baseline_Test_Base
+{
+public:
+ virtual int acquire ();
+ virtual int release ();
+ // These two method are used to test try_acquire performance.
+
+ virtual int test_acquire_release ();
+ virtual int test_try_lock ();
+ // Real test methods.
+};
+
+int
+Baseline_Base_Test::acquire ()
+{
+ return 0;
+}
+
+int
+Baseline_Base_Test::release ()
+{
+ return 0;
+}
+
+int
+Baseline_Base_Test::test_acquire_release ()
+{
+ baseline_options.start_inc_timer ();
+
+ for (; baseline_options.inc_loop_counter () ; )
+ ;
+
+ baseline_options.stop_inc_timer ();
+ return 0;
+}
+
+int
+Baseline_Base_Test::test_try_lock ()
+{
+ baseline_options.start_inc_timer ();
+
+ for (; baseline_options.inc_loop_counter () ; )
+ ;
+
+ baseline_options.stop_inc_timer ();
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Base_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Base_Test)
+
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp
new file mode 100644
index 00000000000..162f60943f6
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp
@@ -0,0 +1,205 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+
+#include "Baseline_Test.h"
+
+# if defined (ACE_HAS_THREADS)
+
+#include "ace/Log_Msg.h"
+#include "ace/Token.h"
+#include "ace/Process_Mutex.h"
+#include "ace/RW_Mutex.h"
+#include "ace/RW_Process_Mutex.h"
+#include "ace/RW_Thread_Mutex.h"
+#include "ace/Lock_Adapter_T.h"
+#include "ace/Recursive_Thread_Mutex.h"
+#include "ace/Semaphore.h"
+#include "ace/Null_Semaphore.h"
+#include "ace/Process_Semaphore.h"
+
+
+template<class LOCK>
+class ACE_Svc_Export Baseline_Lock_Test : public Baseline_Test_Base
+{
+public:
+ virtual int acquire ();
+ virtual int release ();
+ // These two method are used to test try_acquire performance.
+
+ virtual int test_acquire_release ();
+ virtual int test_try_lock ();
+ // Real test methods.
+
+private:
+ LOCK lock_;
+ //
+};
+
+template<class LOCK> int
+Baseline_Lock_Test<LOCK>::acquire ()
+{
+ int retv = 0;
+ switch (this->what_)
+ {
+ case TEST_READLOCK:
+ retv = this->lock_.acquire_read ();
+ break;
+ case TEST_WRITELOCK:
+ retv = this->lock_.acquire_write ();
+ break;
+ case TEST_LOCK:
+ default:
+ retv = this->lock_.acquire ();
+ break;
+ }
+
+ return retv;
+}
+
+template<class LOCK> int
+Baseline_Lock_Test<LOCK>::release ()
+{
+ return this->lock_.release ();
+}
+
+template<class LOCK> int
+Baseline_Lock_Test<LOCK>::test_acquire_release ()
+{
+ baseline_options.start_inc_timer ();
+
+ switch (this->what_)
+ {
+ case TEST_READLOCK:
+ for (; baseline_options.inc_loop_counter () ; )
+ {
+ this->lock_.acquire_read ();
+ this->lock_.release ();
+ }
+ break;
+ case TEST_WRITELOCK:
+ for (; baseline_options.inc_loop_counter () ; )
+ {
+ this->lock_.acquire_write ();
+ this->lock_.release ();
+ }
+ break;
+ case TEST_LOCK:
+ default:
+ for (; baseline_options.inc_loop_counter () ; )
+ {
+ this->lock_.acquire ();
+ this->lock_.release ();
+ }
+ break;
+ }
+
+ baseline_options.stop_inc_timer ();
+
+ return 0;
+}
+
+template<class LOCK> int
+Baseline_Lock_Test<LOCK>::test_try_lock ()
+{
+ baseline_options.start_inc_timer ();
+ switch (this->what_)
+ {
+ case TEST_READLOCK:
+ for (; baseline_options.inc_loop_counter () ; )
+ this->lock_.tryacquire_read (); // This should always fail.
+ break;
+ case TEST_WRITELOCK:
+ for (; baseline_options.inc_loop_counter () ; )
+ this->lock_.tryacquire_write (); // This should always fail.
+ break;
+ case TEST_LOCK:
+ default:
+ for (; baseline_options.inc_loop_counter () ; )
+ this->lock_.tryacquire (); // This should always fail.
+ break;
+ }
+
+ for (; baseline_options.inc_loop_counter () ; )
+ this->lock_.tryacquire (); // This should always fail.
+
+ baseline_options.stop_inc_timer ();
+ return 0;
+}
+
+typedef Baseline_Lock_Test<ACE_Thread_Mutex> Baseline_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Mutex_Test)
+
+typedef Baseline_Lock_Test<ACE_RW_Thread_Mutex> Baseline_RW_Thread_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_RW_Thread_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_RW_Thread_Mutex_Test)
+
+typedef Baseline_Lock_Test<ACE_RW_Mutex> Baseline_RW_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_RW_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_RW_Mutex_Test)
+
+typedef Baseline_Lock_Test<ACE_Process_Mutex> Baseline_Process_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Process_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Process_Mutex_Test)
+
+typedef Baseline_Lock_Test<ACE_RW_Process_Mutex> Baseline_RW_Process_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_RW_Process_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_RW_Process_Mutex_Test)
+
+typedef Baseline_Lock_Test<ACE_Null_Mutex> Baseline_Null_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Null_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Null_Mutex_Test)
+
+typedef Baseline_Lock_Test< ACE_Lock_Adapter<ACE_Null_Mutex> > Baseline_Adaptive_Null_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Adaptive_Null_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Adaptive_Null_Mutex_Test)
+
+typedef Baseline_Lock_Test<ACE_Recursive_Thread_Mutex> Baseline_Recursive_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Recursive_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Recursive_Mutex_Test)
+
+typedef Baseline_Lock_Test< ACE_Lock_Adapter<ACE_Thread_Mutex> > Baseline_Adaptive_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Adaptive_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Adaptive_Mutex_Test)
+
+typedef Baseline_Lock_Test< ACE_Lock_Adapter<ACE_RW_Mutex> > Baseline_Adaptive_RW_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Adaptive_RW_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Adaptive_RW_Mutex_Test)
+
+typedef Baseline_Lock_Test< ACE_Lock_Adapter<ACE_Recursive_Thread_Mutex> > Baseline_Adaptive_Recursive_Mutex_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Adaptive_Recursive_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Adaptive_Recursive_Mutex_Test)
+
+typedef Baseline_Lock_Test<ACE_Semaphore> Baseline_Semaphore_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Semaphore_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Semaphore_Test)
+
+typedef Baseline_Lock_Test<ACE_Semaphore> Baseline_Process_Semaphore_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Process_Semaphore_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Process_Semaphore_Test)
+
+typedef Baseline_Lock_Test<ACE_Null_Semaphore> Baseline_Null_Semaphore_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Null_Semaphore_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Null_Semaphore_Test)
+
+typedef Baseline_Lock_Test<ACE_Token> Baseline_Token_Test;
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Token_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Token_Test)
+
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Makefile.am b/ACE/performance-tests/Synch-Benchmarks/Makefile.am
new file mode 100644
index 00000000000..068a35d9c61
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Makefile.am
@@ -0,0 +1,44 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
+
+ACE_BUILDDIR = $(top_builddir)
+ACE_ROOT = $(top_srcdir)
+
+SUBDIRS = \
+ Synch_Lib \
+ Perf_Test \
+ Base_Test \
+ .
+
+## Makefile.Synch_Benchmarks.am
+
+noinst_PROGRAMS = synch_driver
+
+synch_driver_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+synch_driver_SOURCES = \
+ synch_driver.cpp
+
+synch_driver_LDFLAGS = \
+ -LSynch_Lib
+
+synch_driver_LDADD = \
+ $(top_builddir)/performance-tests/Synch-Benchmarks/Synch_Lib/libSynch_Lib.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Adaptive_Lock_Performance_Test_Base.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Adaptive_Lock_Performance_Test_Base.cpp
new file mode 100644
index 00000000000..32ad7ea5431
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Adaptive_Lock_Performance_Test_Base.cpp
@@ -0,0 +1,48 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "Performance_Test_Options.h"
+#include "Adaptive_Lock_Performance_Test_Base.h"
+
+ACE_RCSID(Synch_Benchmarks, Adaptive_Lock_Performance_Test_Base_, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+ACE_Lock *Adaptive_Lock_Performance_Test_Base::lock_ = 0;
+
+int
+Adaptive_Lock_Performance_Test_Base::fini (void)
+{
+ delete Adaptive_Lock_Performance_Test_Base::lock_;
+ Adaptive_Lock_Performance_Test_Base::lock_ = 0;
+ return 0;
+}
+
+int
+Adaptive_Lock_Performance_Test_Base::svc (void)
+{
+ // Extract out the unique thread-specific value to be used as an
+ // index...
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ while (!this->done ())
+ {
+ Adaptive_Lock_Performance_Test_Base::lock_->acquire ();
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ Adaptive_Lock_Performance_Test_Base::lock_->release ();
+ }
+ /* NOTREACHED */
+ return 0;
+}
+
+int
+Adaptive_Lock_Performance_Test_Base::set_lock (ACE_Lock *lock)
+{
+ delete Adaptive_Lock_Performance_Test_Base::lock_;
+ Adaptive_Lock_Performance_Test_Base::lock_ = lock;
+ return (Adaptive_Lock_Performance_Test_Base::lock_ != 0 ? 0 : -1);
+}
+
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Adaptive_Lock_Performance_Test_Base.h b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Adaptive_Lock_Performance_Test_Base.h
new file mode 100644
index 00000000000..9fb65628ea8
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Adaptive_Lock_Performance_Test_Base.h
@@ -0,0 +1,24 @@
+// $Id$
+
+#ifndef ACE_ADAPTIVE_LOCK_PERFORMANCE_TEST_BASE_H
+#define ACE_ADAPTIVE_LOCK_PERFORMANCE_TEST_BASE_H
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, Adaptive_Lock_Performance_Test_Base, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Adaptive_Lock_Performance_Test_Base : public Benchmark_Performance
+{
+public:
+ virtual int init (int, ACE_TCHAR *[]) = 0;
+ virtual int fini (void);
+ virtual int svc (void);
+
+ int set_lock (ACE_Lock *lock);
+
+private:
+ static ACE_Lock *lock_;
+};
+#endif /* ACE_HAS_THREADS */
+#endif /* ACE_ADAPTIVE_LOCK_PERFORMANCE_TEST_BASE_H */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Benchmark_Performance.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Benchmark_Performance.cpp
new file mode 100644
index 00000000000..48fe88cad2f
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Benchmark_Performance.cpp
@@ -0,0 +1,60 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "Benchmark_Performance.h"
+#include "ace/Basic_Types.h"
+
+ACE_RCSID(Synch_Benchmarks, Benchmark_Performance, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+// Global variables (used by the dynamically linked services).
+ACE_Svc_Export int synch_count;
+int buffer;
+
+// Initialize the static variables.
+/* static */
+sig_atomic_t Benchmark_Performance::done_ = 0;
+
+Benchmark_Performance_Test_Base::Benchmark_Performance_Test_Base (void)
+ : Benchmark_Base (Benchmark_Base::PERFORMANCE)
+{
+}
+
+sig_atomic_t
+Benchmark_Performance::done (void)
+{
+ return Benchmark_Performance::done_;
+}
+
+void
+Benchmark_Performance::done (sig_atomic_t d)
+{
+ Benchmark_Performance::done_ = d;
+}
+
+int
+Benchmark_Performance::init (int, ACE_TCHAR **)
+{
+ return 1;
+}
+
+int
+Benchmark_Performance::info (ACE_TCHAR **, size_t) const
+{
+ return -1;
+}
+
+int
+Benchmark_Performance::fini (void)
+{
+ return -1;
+}
+
+void *
+Benchmark_Performance::svc_run (Benchmark_Performance *bp)
+{
+ return (void *) (bp->svc () == -1 ? (intptr_t) -1 : (intptr_t) 0);
+}
+
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Benchmark_Performance.h b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Benchmark_Performance.h
new file mode 100644
index 00000000000..b66a83048a7
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Benchmark_Performance.h
@@ -0,0 +1,48 @@
+/* -*- C++ -*- */
+// $Id$
+
+/* Defines the class used to dynamically link in the benchmark tests */
+
+#ifndef ACE_BENCHMARK_PERFORMANCE_H
+#define ACE_BENCHMARK_PERFORMANCE_H
+
+#include "Synch_Lib/Benchmark_Base.h"
+
+#if defined (ACE_HAS_THREADS)
+
+#include "ace/svc_export.h"
+
+extern int buffer;
+extern ACE_Svc_Export int synch_count;
+
+class ACE_Svc_Export Benchmark_Performance_Test_Base : public Benchmark_Base
+{
+ // = TITLE
+ // This class identifies itself as Benmarking Performance Test class.
+protected:
+ Benchmark_Performance_Test_Base (void);
+};
+
+class ACE_Svc_Export Benchmark_Performance : public Benchmark_Performance_Test_Base
+{
+ // = TITLE
+ // Base class for all the timing tests.
+public:
+ // = Hooks inherited from ACE_Service_Object.
+ virtual int svc (void) = 0;
+ virtual int init (int, ACE_TCHAR *[]);
+ virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int fini (void);
+ static void *svc_run (Benchmark_Performance *bp);
+
+ // = Set/get flag that controls how the tests are shut down
+ // gracefully.
+ static void done (sig_atomic_t);
+ static sig_atomic_t done (void);
+
+protected:
+ static sig_atomic_t done_;
+ // Keeps track if we are finished or not.
+};
+#endif /* ACE_HAS_THREADS */
+#endif /* ACE_BENCHMARK_PERFORMANCE_H */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Makefile.am b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Makefile.am
new file mode 100644
index 00000000000..ac4f8fc9a00
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Makefile.am
@@ -0,0 +1,73 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
+
+ACE_BUILDDIR = $(top_builddir)
+ACE_ROOT = $(top_srcdir)
+
+
+## Makefile.Synch_Benchmarks_Perf_Test.am
+
+if !BUILD_ACE_FOR_TAO
+
+noinst_LTLIBRARIES = libPerf_Test.la
+
+libPerf_Test_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(srcdir)/..
+
+libPerf_Test_la_SOURCES = \
+ Adaptive_Lock_Performance_Test_Base.cpp \
+ Benchmark_Performance.cpp \
+ Performance_Test.cpp \
+ Performance_Test_Options.cpp \
+ adaptive_mutex_test.cpp \
+ adaptive_recursive_lock_test.cpp \
+ adaptive_sema_test.cpp \
+ condb_test.cpp \
+ conds_test.cpp \
+ context_test.cpp \
+ guard_test.cpp \
+ memory_test.cpp \
+ mutex_test.cpp \
+ pipe_proc_test.cpp \
+ pipe_thr_test.cpp \
+ recursive_lock_test.cpp \
+ rwrd_test.cpp \
+ rwwr_test.cpp \
+ sema_test.cpp \
+ sysvsema_test.cpp \
+ token_test.cpp
+
+../Synch_Lib:
+ mkdir -p ../Synch_Lib
+
+libPerf_Test_la_DEPENDENCIES = \
+ ../Synch_Lib
+
+libPerf_Test_la_LDFLAGS = \
+ -L../Synch_Lib
+
+noinst_HEADERS = \
+ Adaptive_Lock_Performance_Test_Base.h \
+ Benchmark_Performance.h \
+ Performance_Test.h \
+ Performance_Test_Options.h \
+ Performance_Test_Options.inl
+
+endif !BUILD_ACE_FOR_TAO
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test.cpp
new file mode 100644
index 00000000000..42045f5963e
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test.cpp
@@ -0,0 +1,122 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+
+#include "Performance_Test.h"
+
+# if defined (ACE_HAS_THREADS)
+
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+#include "ace/Service_Repository.h"
+#include "ace/Reactor.h"
+
+ACE_RCSID (Perf_Test,
+ Performance_Test,
+ "$Id$")
+
+Performance_Test::Performance_Test (void)
+ : n_lwps_ (0),
+ orig_n_lwps_ (0)
+{
+}
+
+// Initialize and run the benchmarks tests.
+
+int
+Performance_Test::init (int argc, ACE_TCHAR **argv)
+{
+ ACE_DEBUG ((LM_DEBUG, "Performance_Test::init\n"));
+ performance_test_options.parse_args (argc, argv);
+ return 0;
+}
+
+int
+Performance_Test::pre_run_test (Benchmark_Base *bb)
+{
+ this->orig_n_lwps_ = ACE_Thread::getconcurrency ();
+ this->n_lwps_ = performance_test_options.n_lwps ();
+ Benchmark_Performance *bp = (Benchmark_Performance *) bb;
+
+ if (this->n_lwps_ > 0)
+ ACE_Thread::setconcurrency (this->n_lwps_);
+
+ // We should probably use a "barrier" here rather than
+ // THR_SUSPENDED since many OS platforms lack the ability to
+ // create suspended threads...
+ if (ACE_Thread_Manager::instance ()->spawn_n
+ (performance_test_options.thr_count (), ACE_THR_FUNC (bp->svc_run),
+ (void *) bp, performance_test_options.t_flags () | THR_SUSPENDED) == -1)
+ ACE_ERROR ((LM_ERROR, "%p\n%a", "couldn't spawn threads", 1));
+ return 0;
+}
+
+int
+Performance_Test::run_test (void)
+{
+ // Tell the threads that we are not finished.
+ Benchmark_Performance::done (0);
+
+ // Allow thread(s) to make progress.
+ ACE_Thread_Manager::instance ()->resume_all ();
+
+ ACE_Time_Value timeout (performance_test_options.sleep_time ());
+
+ ACE_DEBUG ((LM_DEBUG, "starting timer\n"));
+ performance_test_options.start_timer ();
+
+ // Use Reactor as a timer (which can be interrupted by a signal).
+ ACE_Reactor::run_event_loop (timeout);
+
+ performance_test_options.stop_timer ();
+ ACE_DEBUG ((LM_DEBUG, "\nstopping timer\n"));
+
+ return 0;
+}
+
+int
+Performance_Test::post_run_test (void)
+{
+ // Stop thread(s) from making any further progress.
+ ACE_Thread_Manager::instance ()->suspend_all ();
+
+ // Tell the threads that we are finished.
+ Benchmark_Performance::done (1);
+
+ ACE_DEBUG ((LM_DEBUG, "------------------------------------------------------------------------\n"));
+ ACE_DEBUG ((LM_DEBUG, "targ 0x%x (%s, %s, %s)\n"
+ "n_lwps_orig = %d, n_lwps_set = %d, n_lwps_end = %d\n",
+ performance_test_options.t_flags (),
+ (performance_test_options.t_flags () & THR_DETACHED) ? "THR_DETACHED" : "Not Detached",
+ (performance_test_options.t_flags () & THR_BOUND) ? "THR_BOUND" : "Not Bound",
+ (performance_test_options.t_flags () & THR_NEW_LWP) ? "THR_NEW_LWP" : "No New_LWP",
+ this->orig_n_lwps_, this->n_lwps_, ACE_Thread::getconcurrency ()));
+ int count = performance_test_options.count ();
+ float rate = count / (float (performance_test_options.sleep_time ()));
+
+ ACE_DEBUG ((LM_DEBUG,
+ "to count = %d\nrate = %.3f ops/sec, per operation = %.2f usec\n",
+ count,
+ rate,
+ (1.0e6 / rate) / synch_count));
+ performance_test_options.print_results ();
+ // Allow thread(s) to finish up.
+ ACE_Thread_Manager::instance ()->resume_all ();
+
+ // Wait for all the threads to exit.
+ ACE_Thread_Manager::instance ()->wait ();
+ performance_test_options.init ();
+
+ return 0;
+}
+
+int
+Performance_Test::valid_test_object (Benchmark_Base *bb)
+{
+ return (bb->benchmark_type () == Benchmark_Base::PERFORMANCE);
+}
+
+ACE_SVC_FACTORY_DEFINE (Performance_Test)
+
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test.h b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test.h
new file mode 100644
index 00000000000..f56e8001e76
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test.h
@@ -0,0 +1,32 @@
+// -*- C++ -*-
+//
+// $Id$
+
+#ifndef ACE_PERFORMANCE_TEST_H
+#define ACE_PERFORMANCE_TEST_H
+
+#include "ace/svc_export.h"
+
+#if defined (ACE_HAS_THREADS)
+
+#include "Synch_Lib/Benchmark_Base.h"
+
+class ACE_Svc_Export Performance_Test : public Benchmark_Method_Base
+{
+public:
+ Performance_Test (void);
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int pre_run_test (Benchmark_Base *bp);
+ virtual int run_test (void);
+ virtual int post_run_test (void);
+ virtual int valid_test_object (Benchmark_Base *);
+private:
+ int n_lwps_;
+ int orig_n_lwps_;
+};
+
+ACE_SVC_FACTORY_DECLARE (Performance_Test)
+
+#endif /* ACE_HAS_THREADS */
+
+#endif /* ACE_PERFORMANCE_TEST_H */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp
new file mode 100644
index 00000000000..d2f5305de07
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp
@@ -0,0 +1,469 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "Performance_Test_Options.h"
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID(Synch_Benchmarks, Performance_Test_Options, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+// Manages the options.
+Performance_Test_Options performance_test_options;
+
+size_t
+Performance_Test_Options::count (void)
+{
+ size_t total = 0;
+
+ if (performance_test_options.verbose ())
+ ACE_DEBUG ((LM_DEBUG, "Thread work count size = %d\n", performance_test_options.thr_wc_size));
+
+ for (int i = 0; i < performance_test_options.thr_wc_size; i++)
+ {
+ if (performance_test_options.thr_work_count[i] != 0)
+ {
+ // if (performance_test_options.verbose ())
+ ACE_DEBUG ((LM_DEBUG, "count[%d] = %d\n", i, performance_test_options.thr_work_count[i]));
+ total += performance_test_options.thr_work_count[i];
+ }
+ }
+
+ return total;
+}
+
+void
+Performance_Test_Options::init (void)
+{
+ for (int i = 0; i < this->thr_wc_size; i++)
+ this->thr_work_count[i] = 0;
+}
+
+Performance_Test_Options::Performance_Test_Options (void)
+ : thr_wc_size (10000),
+ _service_entry (0),
+ _mapped_file (0),
+ _pipe_addr (const_cast<ACE_TCHAR *> (ACE_DEFAULT_RENDEZVOUS)),
+ _sleep_time (100),
+ _n_lwps (0),
+ _thr_count (4),
+ _t_flags (0),
+ _high_water_mark (8 * 1024),
+ _low_water_mark (1024),
+ _msg_size (128),
+ _initial_queue_length (0),
+ _logical_connections (1),
+ _physical_connections (1),
+ _iterations (100000),
+ _generate (0),
+ _udp (0),
+ _debugging (0),
+ _verbosity (0),
+ _ack (1),
+ _checksum (1),
+ _xdr (1),
+ _free_memory (1),
+ _zero_copy (0),
+ _print_summary (0),
+ _consecutive_ports (1),
+ _eager_exit (0)
+{
+ this->thr_work_count = new int[this->thr_wc_size];
+ this->init ();
+}
+
+void
+Performance_Test_Options::parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("a:A:bBc:C:dDe:F:g:H:i:L:l:M:m:n:Np:P:s:S:t:T:uvX:Z:"), 0);
+ int c;
+
+ while ((c = get_opt ()) != -1)
+ switch (c)
+ {
+ case 'a': // Not used. (do_ack ???)
+ this->_ack = ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT("ON")) == 0;
+ break;
+ case 'A': // Not used. (set rendezvous point.)
+ this->pipe_addr (get_opt.opt_arg ());
+ break;
+ case 'B': // Create thread with THR_BOUND.
+ this->t_flags (THR_BOUND);
+ break;
+ case 'c': // Not used. (# of connections.)
+ {
+ long connections = ACE_OS::atoi (get_opt.opt_arg ());
+
+ if (connections < 0)
+ this->physical_connections (size_t (-connections));
+ else if (connections > 0)
+ this->logical_connections (size_t (connections));
+ else
+ ACE_DEBUG ((LM_WARNING, "warning, 0 connections!\n"));
+
+ break;
+ }
+ case 'C': // Not used. (Toggle calculate checksum.)
+ this->_checksum = ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT("ON")) == 0;
+ break;
+ case 'd': // Not used. (Enable debugging.)
+ this->_debugging = 1;
+ break;
+ case 'D': // Create thread with THR_DETACHED.
+ this->t_flags (THR_DETACHED);
+ break;
+ case 'e': // Perform eager exit (without cleaning up.)
+ this->_eager_exit = ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT("ON")) == 0;
+ break;
+ case 'F': // Not used.
+ this->_free_memory = ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT("ON")) == 0;
+ break;
+ case 'g': // Not used. (generate data ??)
+ this->_generate = ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT("ON")) == 0;
+ break;
+ case 'H': // Not used. (set high water mark)
+ this->high_water_mark (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'i': // Not used. (# of iterations)
+ this->iterations (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'L': // Not used. (set low water mark)
+ this->low_water_mark (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'l': // Not used. (set initial queue length)
+ this->initial_queue_length (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'M': // Set message size in pipe_[proc|thr]_test.
+ this->msg_size (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'm': // Not used. (set mapped file name)
+ this->mapped_file (get_opt.opt_arg ());
+ break;
+ case 'N': // Create thread with flag THR_NEW_LWP.
+ this->t_flags (THR_NEW_LWP);
+ break;
+ case 'n': // Set # of lwp's
+ this->n_lwps (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'p': // Toggle whether summary is printed.
+ this->_print_summary = ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT("ON")) == 0;
+ break;
+ case 'P': // Not used.
+ this->consecutive_ports (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'S': // Not used (set service_entry ???)
+ this->service_entry (get_opt.opt_arg ());
+ break;
+ case 's': // Set testing duration.
+ this->sleep_time (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'T': // Enable/disable tracing.
+#if defined (ACE_HAS_TRACE)
+ if (ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT("ON")) == 0)
+ ACE_Trace::start_tracing ();
+ else if (ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT("OFF")) == 0)
+ ACE_Trace::stop_tracing ();
+#endif /* ACE_HAS_TRACE */
+ break;
+ case 't': // Set # of threads contending the lock.
+ this->thr_count (ACE_OS::atoi (get_opt.opt_arg ()));
+ break;
+ case 'u': // Not used. (use udp.)
+ this->_udp = 1;
+ break;
+ case 'v': // Not used. (set display verbosely)
+ this->_verbosity = 1;
+ break;
+ case 'X': // Not used. (Use xdr conversion.)
+ this->_xdr = ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT("ON")) == 0;
+ break;
+ case 'Z': // Not used. (Do zero copy.)
+ this->_zero_copy = ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT("ON")) == 0;
+ break;
+ default:
+ ACE_DEBUG ((LM_INFO,
+ "%s\n"
+ "\t[-a] (send acknowledgement)\n"
+ "\t[-A] address of pipe [%s]\n"
+ "\t[-B] (THR_BOUND)\n"
+ "\t[-c] + number of logical connections\n"
+ "\t[-c] - number of physical connections\n"
+ "\t[-C] (enable checksumming)\n"
+ "\t[-d] (enable debugging)\n"
+ "\t[-D] (THR_DETACHED)\n"
+ "\t[-e] (eager exit)\n"
+ "\t[-F] (free memory)\n"
+ "\t[-g] (generate data)\n"
+ "\t[-H] high water mark\n"
+ "\t[-i] number of test iterations [%d]\n"
+ "\t[-L] low water mark\n"
+ "\t[-m] mapped file\n"
+ "\t[-M] message size\n"
+ "\t[-n] number of LWPs\n"
+ "\t[-N] (THR_NEW_LWP)\n"
+ "\t[-p] (print benchmark summary)\n"
+ "\t[-P] number of consecutive ports\n"
+ "\t[-s] sleep time\n"
+ "\t[-S] service entry\n"
+ "\t[-t] number of threads [%d]\n"
+ "\t[-T] (enable tracing)\n"
+ "\t[-u] (UDP) \n"
+ "\t[-v] (verbose) \n"
+ "\t[-X] (enable xdr conversion)\n"
+ "\t[-Z] (enable zero-copy driver)\n%a",
+ argv[0],
+ this->pipe_addr (),
+ this->iterations (),
+ this->thr_count (),
+ 1));
+ /* NOTREACHED */
+ break;
+ }
+
+ if (this->do_print_summary ())
+ ACE_DEBUG ((LM_INFO,
+ "%8d = total iterations\n"
+ "%8d = logical connections\n"
+ "%8d = physical connections\n"
+ "%8d = message_size\n"
+ "%8d = calculated checksum\n"
+ "%8d = perform xdr conversion\n"
+ "%8d = number of LWPs requested\n"
+ "%8d = number of LWPs used\n",
+ this->iterations (),
+ this->logical_connections (),
+ this->physical_connections (),
+ this->msg_size (),
+ this->do_checksum () != 0,
+ this->do_xdr() != 0,
+ this->n_lwps (),
+ ACE_Thread::getconcurrency ()));
+ else if (this->verbose ())
+ ACE_DEBUG ((LM_INFO,
+ "%8d = total iterations\n"
+ "%8d = logical connections\n"
+ "%8d = physical connections\n"
+ "%8d = thread count\n"
+ "%8d = low water mark\n"
+ "%8d = high water mark\n"
+ "%8d = message_size\n"
+ "%8d = initial queue length\n"
+ "%8d = consecutive ports\n"
+ "%8d = calculated checksum\n"
+ "%8d = perform xdr conversion\n"
+ "%8d = zero-copy driver\n"
+ "%8d = free dynamic memory\n"
+ "%8d = print summary only\n"
+ "%8d = eager exit\n"
+ "%8d = UDP\n"
+ "%8d = send ack\n"
+ "%8d = THR_DETACHED\n"
+ "%8d = THR_BOUND\n"
+ "%8d = THR_NEW_LWP\n"
+ "%8d = sleep time\n",
+ this->iterations (),
+ this->logical_connections (),
+ this->physical_connections (),
+ this->thr_count (),
+ this->low_water_mark (),
+ this->high_water_mark (),
+ this->msg_size (),
+ this->initial_queue_length (),
+ this->consecutive_ports (),
+ this->do_checksum () != 0,
+ this->do_xdr() != 0,
+ this->do_zero_copy () != 0,
+ this->do_delete () != 0,
+ this->do_print_summary () != 0,
+ this->do_eager_exit () != 0,
+ this->do_udp () != 0,
+ this->do_ack () != 0,
+ (this->t_flags () & THR_DETACHED) != 0,
+ (this->t_flags () & THR_BOUND) != 0,
+ (this->t_flags () & THR_NEW_LWP) != 0,
+ this->sleep_time ()));
+}
+
+void
+Performance_Test_Options::print_results (void)
+{
+ ACE_Profile_Timer::ACE_Elapsed_Time et;
+ this->_itimer.elapsed_time (et);
+
+ ACE_Profile_Timer::Rusage rusage;
+ this->_itimer.elapsed_rusage (rusage);
+
+ size_t total = this->count ();
+ double nbytes = total * this->msg_size ();
+ double cpu_time = et.user_time + et.system_time;
+
+#if 0
+ mutex_timer.print_total ("ACE_Thread_Mutex overhead:", mutex_counter, 2);
+ condition_timer.print_total ("ACE_Condition overhead:", condition_counter, 2);
+ ACE_DEBUG ((LM_INFO,
+ "%8d (number of ACE_Thread_Mutex operations)\n"
+ "%8d (number of ACE_Condition operations)",
+ mutex_counter, condition_counter));
+#endif /* NDEBUG */
+
+ if (this->do_print_summary ())
+ {
+#if defined (ACE_HAS_PRUSAGE_T)
+ ACE_DEBUG ((LM_INFO,
+ "\n%8d PEs\n"
+ "%8.2f Mbit/sec\n"
+ "%8d (voluntary context switches)\n"
+ "%8d (involuntary context switches)\n"
+ "%8d (total context switches)\n"
+ "%8d.%d sec (wait-cpu time)\n"
+ "%8d.%d sec (user lock wait sleep time)\n"
+ "%8d.%d sec (all other sleep time)\n"
+ "%8d (major page faults)\n"
+ "%8d (minor page faults)\n"
+ "%8d (number of LWPs)\n",
+ this->thr_count (),
+ (nbytes / et.real_time) * 8.0 / 1024.0 / 1024.0,
+ rusage.pr_vctx,
+ rusage.pr_ictx,
+ rusage.pr_vctx + rusage.pr_ictx,
+ rusage.pr_wtime.tv_sec, rusage.pr_wtime.tv_nsec / 1000000,
+ rusage.pr_ltime.tv_sec, rusage.pr_ltime.tv_nsec / 1000000,
+ rusage.pr_slptime.tv_sec, rusage.pr_slptime.tv_nsec / 1000000,
+ rusage.pr_majf,
+ rusage.pr_minf,
+ ACE_Thread::getconcurrency ()));
+#elif defined (ACE_HAS_GETRUSAGE) && !defined (ACE_WIN32)
+ ACE_DEBUG ((LM_INFO,
+ "\n%8d PEs\n"
+ "%8.2f Mbit/sec\n"
+ "%8d (voluntary context switches)\n"
+ "%8d (involuntary context switches)\n"
+ "%8d (total context switches)\n"
+ "%8d.%d sec (user time)\n"
+ "%8d.%d sec (system time)\n"
+ "%8d (major page faults)\n"
+ "%8d (minor page faults)\n"
+ "%8d (number of LWPs)\n",
+ this->thr_count (),
+ (nbytes / et.real_time) * 8.0 / 1024.0 / 1024.0,
+ rusage.ru_nvcsw,
+ rusage.ru_nivcsw,
+ rusage.ru_nvcsw + rusage.ru_nivcsw,
+ rusage.ru_utime.tv_sec, rusage.ru_utime.tv_usec / 1000000,
+ rusage.ru_stime.tv_sec, rusage.ru_stime.tv_usec / 1000000,
+ rusage.ru_majflt,
+ rusage.ru_minflt,
+ ACE_Thread::getconcurrency ()));
+#elif defined (ACE_HAS_GETRUSAGE) && defined (ACE_WIN32)
+ // Need more stuff for Win32.
+ ACE_DEBUG ((LM_INFO,
+ "\n%8d PEs\n"
+ "%8.2f Mbit/sec\n"
+ "%8d (number of LWPs)\n",
+ this->thr_count (),
+ (nbytes / et.real_time) * 8.0 / 1024.0 / 1024.0,
+ ACE_Thread::getconcurrency ()));
+#endif /* ACE_HAS_PRUSAGE_T */
+ }
+ else
+ {
+ ACE_DEBUG ((LM_INFO,
+ "\ntotal work = %d\n"
+ "(Only interpret the next two statistics for throughput tests)\n"
+ "%f bytes in %.2f real seconds = %.2f Mbit/sec\n"
+ "%f bytes in %.2f CPU seconds = %.2f Mbit/sec\n",
+ total,
+ nbytes, et.real_time, (nbytes / et.real_time) * 8.0 / 1024.0 / 1024.0,
+ nbytes, cpu_time, (nbytes / cpu_time) * 8.0 / 1024.0 / 1024.0));
+
+#if defined (ACE_HAS_PRUSAGE_T)
+ ACE_DEBUG ((LM_INFO,
+ "%8d = lwpid\n"
+ "%8d = lwp count\n"
+ "%8d = minor page faults\n"
+ "%8d = major page faults\n"
+ "%8d = input blocks\n"
+ "%8d = output blocks\n"
+ "%8d = messages sent\n"
+ "%8d = messages received\n"
+ "%8d = signals received\n"
+ "%8ds, %dms = wait-cpu (latency) time\n"
+ "%8ds, %dms = user lock wait sleep time\n"
+ "%8ds, %dms = all other sleep time\n"
+ "%8d = voluntary context switches\n"
+ "%8d = involuntary context switches\n"
+ "%8d = total context switches\n"
+ "%8d = system calls\n"
+ "%8d = chars read/written\n"
+ "%8d = number of LWPs\n"
+ "---------------------\n"
+ "real time = %.3f\n"
+ "user time = %.3f\n"
+ "system time = %.3f\n"
+ "---------------------\n",
+ rusage.pr_lwpid,
+ rusage.pr_count,
+ rusage.pr_minf,
+ rusage.pr_majf,
+ rusage.pr_inblk,
+ rusage.pr_oublk,
+ rusage.pr_msnd,
+ rusage.pr_mrcv,
+ rusage.pr_sigs,
+ rusage.pr_wtime.tv_sec, rusage.pr_wtime.tv_nsec / 1000000,
+ rusage.pr_ltime.tv_sec, rusage.pr_ltime.tv_nsec / 1000000,
+ rusage.pr_slptime.tv_sec, rusage.pr_slptime.tv_nsec / 1000000,
+ rusage.pr_vctx,
+ rusage.pr_ictx,
+ rusage.pr_vctx + rusage.pr_ictx,
+ rusage.pr_sysc,
+ rusage.pr_ioch,
+ ACE_Thread::getconcurrency (),
+ et.real_time, et.user_time, et.system_time));
+#elif defined (ACE_HAS_GETRUSAGE) && !defined (ACE_WIN32)
+ ACE_DEBUG ((LM_INFO,
+ "%8d = minor page faults\n"
+ "%8d = major page faults\n"
+ "%8d = input blocks\n"
+ "%8d = output blocks\n"
+ "%8d = messages sent\n"
+ "%8d = messages received\n"
+ "%8d = signals received\n"
+ "%8d = voluntary context switches\n"
+ "%8d = involuntary context switches\n"
+ "%8d = total context switches\n"
+ "%8d = number of LWPs\n"
+ "---------------------\n"
+ "real time = %.3f\n"
+ "user time = %.3f\n"
+ "system time = %.3f\n"
+ "---------------------\n",
+ rusage.ru_minflt,
+ rusage.ru_majflt,
+ rusage.ru_inblock,
+ rusage.ru_oublock,
+ rusage.ru_msgsnd,
+ rusage.ru_msgrcv,
+ rusage.ru_nsignals,
+ rusage.ru_nvcsw,
+ rusage.ru_nivcsw,
+ rusage.ru_nvcsw + rusage.ru_nivcsw,
+ ACE_Thread::getconcurrency (),
+ et.real_time, et.user_time, et.system_time));
+#elif defined (ACE_HAS_GETRUSAGE) && defined (ACE_WIN32)
+ // need to write more dump ops for rusage on Win32
+ ACE_DEBUG ((LM_INFO,
+ "%8d = number of LWPs\n"
+ "---------------------\n"
+ "real time = %.3f\n"
+ "user time = %.3f\n"
+ "system time = %.3f\n"
+ "---------------------\n",
+ ACE_Thread::getconcurrency (),
+ et.real_time, et.user_time, et.system_time));
+#endif /* ACE_HAS_PRUSAGE_T */
+ }
+ if (performance_test_options.do_eager_exit ())
+ ACE_OS::_exit (0);
+}
+#endif /* ACE_HAS_THREADS */
+
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.h b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.h
new file mode 100644
index 00000000000..b4c53e30109
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.h
@@ -0,0 +1,133 @@
+/* -*- C++ -*- */
+// $Id$
+
+// Option manager for performance tests.
+
+#ifndef _PERFORMANCE_TEST_OPTIONS_H
+#define _PERFORMANCE_TEST_OPTIONS_H
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Profile_Timer.h"
+#include "ace/Log_Msg.h"
+#include "ace/Thread_Manager.h"
+#include "ace/Atomic_Op.h"
+#include "ace/svc_export.h"
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Performance_Test_Options
+{
+public:
+ Performance_Test_Options (void);
+ void parse_args (int argc, ACE_TCHAR *argv[]);
+
+ void init (void);
+
+ void start_timer (void);
+ void stop_timer (void);
+
+ void thr_count (size_t count);
+ size_t thr_count (void);
+
+ void pipe_addr (ACE_TCHAR pipe[]);
+ ACE_TCHAR *pipe_addr (void);
+
+ void mapped_file (ACE_TCHAR filename[]);
+ ACE_TCHAR *mapped_file (void);
+
+ void service_entry (ACE_TCHAR *service_entry);
+ ACE_TCHAR *service_entry (void);
+
+ void sleep_time (size_t count);
+ size_t sleep_time (void);
+
+ void logical_connections (size_t count);
+ size_t logical_connections (void);
+
+ void physical_connections (size_t count);
+ size_t physical_connections (void);
+
+ void consecutive_ports (size_t count);
+ size_t consecutive_ports (void);
+
+ void initial_queue_length (size_t length);
+ size_t initial_queue_length (void);
+
+ void high_water_mark (size_t size);
+ size_t high_water_mark (void);
+
+ void low_water_mark (size_t size);
+ size_t low_water_mark (void);
+
+ void msg_size (size_t size);
+ size_t msg_size (void);
+
+ void iterations (size_t n);
+ size_t iterations (void);
+
+ void n_lwps (size_t n);
+ size_t n_lwps (void);
+
+ void t_flags (long flag);
+ long t_flags (void);
+
+ size_t count (void);
+
+ int debug (void);
+ int verbose (void);
+ int do_checksum (void);
+ int do_generate (void);
+ int do_ack (void);
+ int do_delete (void);
+ int do_eager_exit (void);
+ int do_print_summary (void);
+ int do_udp (void);
+ int do_xdr (void);
+ int do_zero_copy (void);
+ void print_results (void);
+
+ ACE_Atomic_Op<ACE_Thread_Mutex, size_t> msg_count; // Keep track of number of messages atomically.
+ int *thr_work_count; // Count activity per-thread.
+ int thr_wc_size; // Max number of threads.
+
+private:
+ ACE_Profile_Timer _itimer; // Keep track of time.
+ ACE_TCHAR *_service_entry; // Name of the shared object file and shared object.
+ ACE_TCHAR *_mapped_file; // Name of the mapped file.
+ ACE_TCHAR *_pipe_addr; // Name of the STREAM pipe.
+ size_t _sleep_time; // Time to sleep.
+ size_t _n_lwps; // Number of LWPs.
+ size_t _thr_count; // Number of threads to spawn.
+ long _t_flags; // Flags to thr_create().
+ size_t _high_water_mark; // ACE_Queue high water mark.
+ size_t _low_water_mark; // ACE_Queue low water mark.
+ size_t _msg_size; // Size of a message.
+ size_t _initial_queue_length; // Initial number of items in the queue.
+ size_t _logical_connections; // Number of logical connections.
+ size_t _physical_connections; // Number of physical connections.
+ size_t _iterations; // Number of iterations to run the test program.
+ int _generate; // Generate the data.
+ int _udp; // Use UDP format.
+ int _debugging; // Extra debugging info.
+ int _verbosity; // Extra verbose messages.
+ int _ack; // Do an acknowledgement.
+ int _checksum; // Is checksumming enabled?.
+ int _xdr; // Is xdr conversion enabled?.
+ int _free_memory; // Are we freeing up memory?.
+ int _zero_copy; // Implement a zero-copy driver?.
+ int _print_summary; // Print a summary of the results only.
+ size_t _consecutive_ports; // Number of consecutive messages from same port.
+ int _eager_exit; // Exit eagerly, without cleaning up.
+};
+
+// Make this available to any code that wants to see it!
+extern ACE_Svc_Export Performance_Test_Options performance_test_options;
+
+#include "Performance_Test_Options.inl"
+#endif /* ACE_HAS_THREADS */
+#endif /* _PERFORMANCE_TEST_OPTIONS_H */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.inl b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.inl
new file mode 100644
index 00000000000..6856edfa3cd
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.inl
@@ -0,0 +1,269 @@
+/* -*- C++ -*- */
+// $Id$
+
+/* Option manager for ustreams */
+
+#include "ace/Get_Opt.h"
+
+// Since this is only included in the .h file, these should be
+// remain inline, not ACE_INLINE.
+// FUZZ: disable check_for_inline
+
+
+inline int
+Performance_Test_Options::do_print_summary (void)
+{
+ return this->_print_summary;
+}
+
+inline int
+Performance_Test_Options::do_udp (void)
+{
+ return this->_udp;
+}
+
+inline void
+Performance_Test_Options::start_timer (void)
+{
+ this->_itimer.start ();
+}
+
+inline void
+Performance_Test_Options::stop_timer (void)
+{
+ this->_itimer.stop ();
+}
+
+inline int
+Performance_Test_Options::do_generate (void)
+{
+ return this->_generate;
+}
+
+inline int
+Performance_Test_Options::do_ack (void)
+{
+ return this->_ack;
+}
+
+inline int
+Performance_Test_Options::do_eager_exit (void)
+{
+ return this->_eager_exit;
+}
+
+inline int
+Performance_Test_Options::do_zero_copy (void)
+{
+ return this->_zero_copy;
+}
+
+inline int
+Performance_Test_Options::do_checksum (void)
+{
+ return this->_checksum;
+}
+
+inline int
+Performance_Test_Options::do_delete (void)
+{
+ return this->_free_memory;
+}
+
+inline int
+Performance_Test_Options::do_xdr (void)
+{
+ return this->_xdr;
+}
+
+inline void
+Performance_Test_Options::n_lwps (size_t count)
+{
+ this->_n_lwps = count;
+}
+
+inline size_t
+Performance_Test_Options::n_lwps (void)
+{
+ return this->_n_lwps;
+}
+
+inline void
+Performance_Test_Options::pipe_addr (ACE_TCHAR *pipe)
+{
+ this->_pipe_addr = pipe;
+}
+
+inline ACE_TCHAR *
+Performance_Test_Options::pipe_addr (void)
+{
+ return this->_pipe_addr;
+}
+
+inline void
+Performance_Test_Options::service_entry (ACE_TCHAR *pipe)
+{
+ this->_service_entry = pipe;
+}
+
+inline ACE_TCHAR *
+Performance_Test_Options::service_entry (void)
+{
+ return this->_service_entry;
+}
+
+inline void
+Performance_Test_Options::mapped_file (ACE_TCHAR *filename)
+{
+ this->_mapped_file = filename;
+}
+
+inline ACE_TCHAR *
+Performance_Test_Options::mapped_file (void)
+{
+ return this->_mapped_file;
+}
+
+inline void
+Performance_Test_Options::sleep_time (size_t count)
+{
+ this->_sleep_time = count;
+}
+
+inline size_t
+Performance_Test_Options::sleep_time (void)
+{
+ return this->_sleep_time;
+}
+
+inline void
+Performance_Test_Options::thr_count (size_t count)
+{
+ this->_thr_count = count;
+}
+
+inline size_t
+Performance_Test_Options::thr_count (void)
+{
+ return this->_thr_count;
+}
+
+inline void
+Performance_Test_Options::consecutive_ports (size_t count)
+{
+ this->_consecutive_ports = count;
+}
+
+inline size_t
+Performance_Test_Options::consecutive_ports (void)
+{
+ return this->_consecutive_ports;
+}
+
+inline void
+Performance_Test_Options::logical_connections (size_t count)
+{
+ this->_logical_connections = count;
+}
+
+inline size_t
+Performance_Test_Options::logical_connections (void)
+{
+ return this->_logical_connections;
+}
+
+inline void
+Performance_Test_Options::physical_connections (size_t count)
+{
+ this->_physical_connections = count;
+}
+
+inline size_t
+Performance_Test_Options::physical_connections (void)
+{
+ return this->_physical_connections;
+}
+
+inline void
+Performance_Test_Options::initial_queue_length (size_t length)
+{
+ this->_initial_queue_length = length;
+}
+
+inline size_t
+Performance_Test_Options::initial_queue_length (void)
+{
+ return this->_initial_queue_length;
+}
+
+inline void
+Performance_Test_Options::high_water_mark (size_t size)
+{
+ this->_high_water_mark = size;
+}
+
+inline size_t
+Performance_Test_Options::high_water_mark (void)
+{
+ return this->_high_water_mark;
+}
+
+inline void
+Performance_Test_Options::low_water_mark (size_t size)
+{
+ this->_low_water_mark = size;
+}
+
+inline size_t
+Performance_Test_Options::low_water_mark (void)
+{
+ return this->_low_water_mark;
+}
+
+inline void
+Performance_Test_Options::msg_size (size_t size)
+{
+ this->_msg_size = size;
+}
+
+inline size_t
+Performance_Test_Options::msg_size (void)
+{
+ return this->_msg_size;
+}
+
+inline void
+Performance_Test_Options::iterations (size_t n)
+{
+ this->_iterations = n;
+}
+
+inline size_t
+Performance_Test_Options::iterations (void)
+{
+ return this->_iterations;
+}
+
+inline void
+Performance_Test_Options::t_flags (long flag)
+{
+ this->_t_flags |= flag;
+}
+
+inline long
+Performance_Test_Options::t_flags (void)
+{
+ return this->_t_flags;
+}
+
+inline int
+Performance_Test_Options::debug (void)
+{
+ return this->_debugging;
+}
+
+inline int
+Performance_Test_Options::verbose (void)
+{
+ return this->_verbosity;
+}
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/README b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/README
new file mode 100644
index 00000000000..28f1f160e8a
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/README
@@ -0,0 +1,76 @@
+The files in this directory support controlled benchmarking of the ACE
+synchronization mechanisms.
+
+ These mechanisms include:
+
+ . Mutexes
+ . Reader/writer locks
+ . Condition variables
+ . Semaphores
+ . Tokens
+ . Adaptive lockings
+
+There are additional tests that measure the memory bandwidth under the
+following conditions:
+
+ . User memory-to-memory copying of data within a single thread
+ . User memory-to-kernel-to-user memory copying via pipes
+ between separate processes, as well as between separate
+ threads in the same process
+
+There are many options available for this module that can be put into
+svc.conf files. See the Performance_Test_Options.[Chi] file for more
+details. Some reasonable options to use to run the tests are:
+
+ -v -B -s 15
+ -v -n 4 -t 4 -s 15
+
+You should experiment with other options as you see fit. Note that on
+Solaris, you should always make sure that you have more than 1 LWP (by
+using either the -B or the -n options) since otherwise the program may
+get into an infinite loop due to the semantics of SunOS unbound
+threads... (This may no longer be the case.)
+
+
+Available Options in Performance_Test module:
+=============================================
+
+Thread Creation:
+----------------
+ -B: Create thread with THR_BOUND
+ -D: Create thread with THR_DETACHED
+ -N: Create thread with flag THR_NEW_LWP
+ -n: Set # of lwp's (default is 0)
+ -t: Set # of threads contending the lock (default is 4)
+
+Run Test:
+---------
+ -s: Set testing duration (in seconds, default is 100)
+ -T: Enable/disable tracing.
+
+Misc:
+-----
+ -p: Toggle whether summary is printed
+ -e: Perform eager exit (without cleaning up)
+ -M: Set message size in pipe_[proc|thr]_test
+
+Reserved Flags:
+---------------
+ -a: Not used. (do_ack ???)
+ -A: Not used. (set rendezvous point)
+ -c: Not used. (# of connections)
+ -C: Not used. (Toggle calculate checksum)
+ -d: Not used. (Enable debugging)
+ -F: Not used. (Free memory)
+ -g: Not used. (generate data ??)
+ -H: Not used. (set high water mark)
+ -i: Not used. (# of iterations)
+ -L: Not used. (set low water mark)
+ -l: Not used. (set initial queue length)
+ -m: Not used. (set mapped file name)
+ -P: Not used. (set consecutive ports)
+ -S: Not used. (set service_entry ???)
+ -u: Not used. (use udp)
+ -v: Not used. (set display verbosely)
+ -X: Not used. (Use xdr conversion)
+ -Z: Not used. (Do zero copy)
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Synch_Benchmarks_Perf_Test.mpc b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Synch_Benchmarks_Perf_Test.mpc
new file mode 100644
index 00000000000..a76c10f94ee
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/Synch_Benchmarks_Perf_Test.mpc
@@ -0,0 +1,16 @@
+// -*- MPC -*-
+// $Id$
+
+project : acelib {
+ sharedname = Perf_Test
+ avoids += ace_for_tao
+ after += Synch_Lib
+ libs += Synch_Lib
+ libpaths += ../Synch_Lib
+
+ specific (automake) {
+ includes += $(srcdir)/..
+ } else {
+ includes += ..
+ }
+}
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_mutex_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_mutex_test.cpp
new file mode 100644
index 00000000000..d438e9ac3f4
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_mutex_test.cpp
@@ -0,0 +1,32 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/Log_Msg.h"
+#include "Adaptive_Lock_Performance_Test_Base.h"
+#include "ace/Lock_Adapter_T.h"
+
+ACE_RCSID(Synch_Benchmarks, adaptive_mutex_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Adaptive_Mutex_Test : public Adaptive_Lock_Performance_Test_Base
+{
+public:
+ virtual int init (int, ACE_TCHAR *[]);
+};
+
+int
+Adaptive_Mutex_Test::init (int, ACE_TCHAR *[])
+{
+ ACE_Lock *lock;
+ ACE_NEW_RETURN (lock,
+ ACE_Lock_Adapter<ACE_Thread_Mutex> (),
+ -1);
+
+ return this->set_lock (lock);
+}
+
+ACE_SVC_FACTORY_DECLARE (Adaptive_Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Adaptive_Mutex_Test)
+
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_recursive_lock_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_recursive_lock_test.cpp
new file mode 100644
index 00000000000..cc49bf1b698
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_recursive_lock_test.cpp
@@ -0,0 +1,33 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/Log_Msg.h"
+#include "Adaptive_Lock_Performance_Test_Base.h"
+#include "ace/Lock_Adapter_T.h"
+#include "ace/Recursive_Thread_Mutex.h"
+
+ACE_RCSID(Synch_Benchmarks, adaptive_recursive_lock_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Adaptive_Recursive_Lock_Test : public Adaptive_Lock_Performance_Test_Base
+{
+public:
+ virtual int init (int, ACE_TCHAR *[]);
+};
+
+int
+Adaptive_Recursive_Lock_Test::init (int, ACE_TCHAR *[])
+{
+ ACE_Lock *lock;
+ ACE_NEW_RETURN (lock,
+ ACE_Lock_Adapter<ACE_Recursive_Thread_Mutex> (),
+ -1);
+
+ return this->set_lock (lock);
+}
+
+ACE_SVC_FACTORY_DECLARE (Adaptive_Recursive_Lock_Test)
+ACE_SVC_FACTORY_DEFINE (Adaptive_Recursive_Lock_Test)
+
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_sema_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_sema_test.cpp
new file mode 100644
index 00000000000..2644aef7415
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/adaptive_sema_test.cpp
@@ -0,0 +1,38 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/Log_Msg.h"
+#include "Adaptive_Lock_Performance_Test_Base.h"
+#include "ace/Semaphore.h"
+#include "ace/Lock_Adapter_T.h"
+
+ACE_RCSID(Synch_Benchmarks, adaptive_sema_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Adaptive_Sema_Test : public Adaptive_Lock_Performance_Test_Base
+{
+public:
+ virtual int init (int, ACE_TCHAR *[]);
+
+private:
+ static ACE_Semaphore sema;
+};
+
+ACE_Semaphore Adaptive_Sema_Test::sema (1);
+
+int
+Adaptive_Sema_Test::init (int, ACE_TCHAR *[])
+{
+ ACE_Lock *lock;
+ ACE_NEW_RETURN (lock,
+ ACE_Lock_Adapter<ACE_Semaphore> (Adaptive_Sema_Test::sema),
+ -1);
+
+ return this->set_lock (lock);
+}
+
+ACE_SVC_FACTORY_DECLARE (Adaptive_Sema_Test)
+ACE_SVC_FACTORY_DEFINE (Adaptive_Sema_Test)
+
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/condb_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/condb_test.cpp
new file mode 100644
index 00000000000..9c0a09534e2
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/condb_test.cpp
@@ -0,0 +1,69 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, condb_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Cond_Brdcast_Test : public Benchmark_Performance
+{
+public:
+ virtual int svc (void);
+
+private:
+ static ACE_Thread_Mutex mutex;
+ static int resources;
+
+ static ACE_Condition_Thread_Mutex notfull;
+ static ACE_Condition_Thread_Mutex notempty;
+};
+
+ACE_Thread_Mutex Cond_Brdcast_Test::mutex;
+int Cond_Brdcast_Test::resources;
+ACE_Condition_Thread_Mutex Cond_Brdcast_Test::notfull (Cond_Brdcast_Test::mutex);
+ACE_Condition_Thread_Mutex Cond_Brdcast_Test::notempty (Cond_Brdcast_Test::mutex);
+
+int
+Cond_Brdcast_Test::svc (void)
+{
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ // Special case for first thread...
+ if (ni == 4)
+ while (!this->done ())
+ {
+ mutex.acquire ();
+ while (resources > 0)
+ notfull.wait ();
+ performance_test_options.thr_work_count[ni]++;
+ resources = performance_test_options.thr_count () - 1;
+ buffer++;
+ notempty.broadcast ();
+ mutex.release ();
+ }
+ else
+ while (!this->done ())
+ {
+ mutex.acquire ();
+ while (resources == 0)
+ notempty.wait ();
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ if (--resources == 0)
+ notfull.signal ();
+ mutex.release ();
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Cond_Brdcast_Test)
+ACE_SVC_FACTORY_DEFINE (Cond_Brdcast_Test)
+
+// ACE_Service_Object_Type cbt (&cond_brdcast_test, "Condition_Broadcast_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/conds_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/conds_test.cpp
new file mode 100644
index 00000000000..a30b67c040f
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/conds_test.cpp
@@ -0,0 +1,72 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, conds_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Cond_Signal_Test : public Benchmark_Performance
+{
+public:
+ virtual int svc (void);
+
+private:
+ static ACE_Thread_Mutex mutex;
+ static int resources;
+
+ static ACE_Condition_Thread_Mutex notfull;
+ static ACE_Condition_Thread_Mutex notempty;
+};
+
+ACE_Thread_Mutex Cond_Signal_Test::mutex;
+int Cond_Signal_Test::resources;
+ACE_Condition_Thread_Mutex Cond_Signal_Test::notfull (Cond_Signal_Test::mutex);
+ACE_Condition_Thread_Mutex Cond_Signal_Test::notempty (Cond_Signal_Test::mutex);
+
+int
+Cond_Signal_Test::svc (void)
+{
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ // This is a horrible hack and only works for Solaris threads. This
+ // clearly needs to change...
+ if (ni == 4)
+ while (!this->done ())
+ {
+ mutex.acquire ();
+
+ while (resources > 0)
+ notfull.wait ();
+
+ performance_test_options.thr_work_count[ni]++;
+ resources = performance_test_options.thr_count () - 1;
+ buffer++;
+ notempty.signal ();
+ mutex.release ();
+ }
+ else
+ while (!this->done ())
+ {
+ mutex.acquire ();
+ while (resources == 0)
+ notempty.wait ();
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ if (--resources == 0)
+ notfull.signal ();
+ mutex.release ();
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Cond_Signal_Test)
+ACE_SVC_FACTORY_DEFINE (Cond_Signal_Test)
+
+// ACE_Service_Object_Type cst (&cond_signal_test, "Condition_Signal_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/context_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/context_test.cpp
new file mode 100644
index 00000000000..fc4fa0dc26d
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/context_test.cpp
@@ -0,0 +1,38 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, context_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Context_Test : public Benchmark_Performance
+{
+public:
+ virtual int svc (void);
+};
+
+int
+Context_Test::svc (void)
+{
+ int ni = this->thr_id ();
+
+ synch_count = 1;
+
+ while (!this->done ())
+ {
+ ACE_Thread::yield ();
+ performance_test_options.thr_work_count[ni]++;
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Context_Test)
+ACE_SVC_FACTORY_DEFINE (Context_Test)
+
+// ACE_Service_Object_Type ct (&context_test, "Context_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/guard_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/guard_test.cpp
new file mode 100644
index 00000000000..b5296452322
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/guard_test.cpp
@@ -0,0 +1,126 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/Guard_T.h"
+#include "ace/Log_Msg.h"
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, mutex_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Guard_Test : public Benchmark_Performance
+{
+public:
+ enum
+ { // svc.conf options
+ TEST_ACE_GUARD, // -g
+ TEST_ACE_THREAD_MUTEX_GUARD // -t
+ };
+
+ virtual int svc (void);
+ virtual int init (int, ACE_TCHAR *[]);
+
+ void test_guard (int);
+#if defined (ACE_USES_OBSOLETE_GUARD_CLASSES)
+ void test_thread_guard (int);
+#endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */
+private:
+ static int guard_type_;
+ static ACE_Thread_Mutex mutex_;
+};
+
+int Guard_Test::guard_type_ = Guard_Test::TEST_ACE_GUARD;
+ACE_Thread_Mutex Guard_Test::mutex_;
+
+int
+Guard_Test::init (int argc, ACE_TCHAR *argv[])
+{
+ //FUZZ: disable check_for_lack_ACE_OS
+ ACE_Get_Opt getopt (argc, argv, ACE_TEXT("gt"));
+ int c;
+
+ while ((c = getopt()) != -1)
+ {
+ //FUZZ: enable check_for_lack_ACE_OS
+ switch (c)
+ {
+#if defined (ACE_USES_OBSOLETE_GUARD_CLASSES)
+ case 't':
+ Guard_Test::guard_type_ = Guard_Test::TEST_ACE_THREAD_MUTEX_GUARD;
+ break;
+#endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */
+ case 'g':
+ Guard_Test::guard_type_ = Guard_Test::TEST_ACE_GUARD;
+ break;
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Invalid option\n"), -1);
+ }
+ }
+ return 0;
+}
+
+int
+Guard_Test::svc (void)
+{
+ // Extract out the unique thread-specific value to be used as an
+ // index...
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ switch (Guard_Test::guard_type_)
+ {
+ case Guard_Test::TEST_ACE_GUARD:
+ this->test_guard (ni);
+ break;
+#if defined (ACE_USES_OBSOLETE_GUARD_CLASSES)
+ case Guard_Test::TEST_ACE_THREAD_MUTEX_GUARD:
+ this->test_thread_guard (ni);
+ break;
+#endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */
+ default:
+ return -1;
+ }
+ return 0;
+}
+
+void
+Guard_Test::test_guard (int ni)
+{
+ while (!this->done ())
+ {
+ {
+ ACE_GUARD (ACE_Thread_Mutex, _ace_mon, Guard_Test::mutex_);
+
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ }
+ }
+}
+
+#if defined (ACE_USES_OBSOLETE_GUARD_CLASSES)
+# define ACE_THREAD_GUARD(OBJ,LOCK) \
+ ACE_Thread_Mutex_Guard OBJ (LOCK); \
+ if (OBJ.locked () == 0) return;
+
+void
+Guard_Test::test_thread_guard (int ni)
+{
+ while (!this->done ())
+ {
+ {
+ ACE_THREAD_GUARD (_ace_mon, Guard_Test::mutex_);
+
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ }
+ }
+}
+#endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */
+ACE_SVC_FACTORY_DECLARE (Guard_Test)
+ACE_SVC_FACTORY_DEFINE (Guard_Test)
+
+// ACE_Service_Object_Type mut (&mutex_test, "Guard_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/memory_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/memory_test.cpp
new file mode 100644
index 00000000000..ff62b5e3a2a
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/memory_test.cpp
@@ -0,0 +1,42 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/OS_NS_string.h"
+#include "ace/Log_Msg.h"
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, memory_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Memory_Test : public Benchmark_Performance
+{
+public:
+ virtual int svc (void);
+};
+
+int
+Memory_Test::svc (void)
+{
+ int ni = this->thr_id ();
+ size_t length = performance_test_options.msg_size ();
+ char *from = new char[length];
+ char *to = new char[length];
+
+ synch_count = 1;
+
+ while (!this->done ())
+ {
+ ACE_OS::memcpy (to, from, length);
+ performance_test_options.thr_work_count[ni]++;
+ }
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Memory_Test)
+ACE_SVC_FACTORY_DEFINE (Memory_Test)
+
+// ACE_Service_Object_Type mt (&memory_test, "Memory_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/mutex_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/mutex_test.cpp
new file mode 100644
index 00000000000..c1e0a1e0ad0
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/mutex_test.cpp
@@ -0,0 +1,45 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, mutex_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Mutex_Test : public Benchmark_Performance
+{
+public:
+ virtual int svc (void);
+
+private:
+ static ACE_Thread_Mutex mutex;
+};
+
+ACE_Thread_Mutex Mutex_Test::mutex;
+
+int
+Mutex_Test::svc (void)
+{
+ // Extract out the unique thread-specific value to be used as an
+ // index...
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ while (!this->done ())
+ {
+ mutex.acquire ();
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ mutex.release ();
+ }
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Mutex_Test)
+ACE_SVC_FACTORY_DEFINE (Mutex_Test)
+
+// ACE_Service_Object_Type mut (&mutex_test, "Mutex_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/pipe_proc_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/pipe_proc_test.cpp
new file mode 100644
index 00000000000..10bed9b88f3
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/pipe_proc_test.cpp
@@ -0,0 +1,86 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_unistd.h"
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, pipe_proc_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Pipe_Proc_Test : public Benchmark_Performance
+{
+public:
+ int init (int, ACE_TCHAR **);
+ virtual int svc (void);
+
+private:
+ ACE_HANDLE pipe_handles[2];
+
+ void reader (ACE_HANDLE handle);
+};
+
+int
+Pipe_Proc_Test::init (int, ACE_TCHAR **)
+{
+ synch_count = 1;
+
+ if (ACE_OS::pipe (this->pipe_handles) == -1)
+ ACE_OS::perror (ACE_TEXT("pipe")), ACE_OS::exit (1);
+
+ switch (ACE_OS::fork ())
+ {
+ case -1:
+ ACE_OS::perror (ACE_TEXT("fork")), ACE_OS::exit (1);
+ case 0:
+ this->reader (pipe_handles[0]);
+ /* NOTREACHED */
+ break;
+ default:
+ break;
+ }
+ return 1;
+}
+
+void
+Pipe_Proc_Test::reader (ACE_HANDLE handle)
+{
+ int ni = this->thr_id ();
+ int length = performance_test_options.msg_size ();
+ char *to;
+
+ ACE_NEW (to, char[length]);
+
+ while (ACE_OS::read (handle, to, length) > 0)
+ performance_test_options.thr_work_count[ni]++;
+}
+
+
+int
+Pipe_Proc_Test::svc (void)
+{
+ ssize_t length = performance_test_options.msg_size ();
+ int ni = this->thr_id ();
+ ACE_HANDLE handle = this->pipe_handles[1];
+ char *from;
+
+ ACE_NEW_RETURN (from, char[length], -1);
+
+ while (!this->done ())
+ if (ACE_OS::write (handle, from, length) == length)
+ performance_test_options.thr_work_count[ni]++;
+ else
+ ACE_OS::perror (ACE_TEXT("write"));
+
+ ACE_OS::close (this->pipe_handles[0]);
+ ACE_OS::close (this->pipe_handles[1]);
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Pipe_Proc_Test)
+ACE_SVC_FACTORY_DEFINE (Pipe_Proc_Test)
+
+// ACE_Service_Object_Type ppt (&pipe_proc_test, "Pipe_Proc_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/pipe_thr_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/pipe_thr_test.cpp
new file mode 100644
index 00000000000..895b5a846fe
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/pipe_thr_test.cpp
@@ -0,0 +1,79 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/Thread_Manager.h"
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, pipe_thr_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Pipe_Thr_Test : public Benchmark_Performance
+{
+public:
+ virtual int init (int, ACE_TCHAR **);
+ virtual int svc (void);
+
+private:
+ ACE_HANDLE pipe_handles[2];
+
+ static void *reader (Pipe_Thr_Test *);
+};
+
+void *
+Pipe_Thr_Test::reader (Pipe_Thr_Test *t)
+{
+ ACE_HANDLE handle = t->pipe_handles[0];
+ int ni = t->thr_id ();
+ size_t length = performance_test_options.msg_size ();
+ char *to;
+ ACE_NEW_RETURN (to, char[length], 0);
+
+ while (ACE_OS::read (handle, to, length) > 0)
+ performance_test_options.thr_work_count[ni]++;
+
+ return 0;
+}
+
+int
+Pipe_Thr_Test::init (int, ACE_TCHAR **)
+{
+ synch_count = 1;
+
+ if (ACE_OS::pipe (this->pipe_handles) == -1)
+ ACE_OS::perror (ACE_TEXT("pipe")), ACE_OS::exit (1);
+
+ if (ACE_Thread_Manager::instance ()->spawn
+ (ACE_THR_FUNC (Pipe_Thr_Test::reader),
+ (void *) this, performance_test_options.t_flags ()) == -1)
+ ACE_OS::perror (ACE_TEXT("thr_create")), ACE_OS::exit (1);
+
+ return 1;
+}
+
+int
+Pipe_Thr_Test::svc (void)
+{
+ ssize_t length = performance_test_options.msg_size ();
+ ACE_HANDLE handle = this->pipe_handles[1];
+ char *from;
+ ACE_NEW_RETURN (from, char[length], -1);
+
+ while (!this->done ())
+ if (ACE_OS::write (handle, from, length) != length)
+ ACE_OS::perror (ACE_TEXT("write"));
+
+ ACE_OS::close (this->pipe_handles[0]);
+ ACE_OS::close (this->pipe_handles[1]);
+
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Pipe_Thr_Test)
+ACE_SVC_FACTORY_DEFINE (Pipe_Thr_Test)
+
+// ACE_Service_Object_Type ptt (&pipe_thr_test, "Pipe_Thr_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/recursive_lock_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/recursive_lock_test.cpp
new file mode 100644
index 00000000000..6246835ee88
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/recursive_lock_test.cpp
@@ -0,0 +1,44 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/Recursive_Thread_Mutex.h"
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, recursive_lock_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Recursive_Lock_Test : public Benchmark_Performance
+{
+public:
+ virtual int svc (void);
+
+private:
+ static ACE_Recursive_Thread_Mutex mutex;
+};
+
+ACE_Recursive_Thread_Mutex Recursive_Lock_Test::mutex;
+
+int
+Recursive_Lock_Test::svc (void)
+{
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ while (!this->done ())
+ {
+ this->mutex.acquire ();
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ this->mutex.release ();
+ }
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Recursive_Lock_Test)
+ACE_SVC_FACTORY_DEFINE (Recursive_Lock_Test)
+
+// ACE_Service_Object_Type rlt (&recursive_lock_test, "Recursive_Lock_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/rwrd_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/rwrd_test.cpp
new file mode 100644
index 00000000000..a0eb5c6cff8
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/rwrd_test.cpp
@@ -0,0 +1,45 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/RW_Mutex.h"
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, rwrd_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export RWRD_Test : public Benchmark_Performance
+{
+public:
+ virtual int svc (void);
+
+private:
+ static ACE_RW_Mutex rw_lock;
+};
+
+ACE_RW_Mutex RWRD_Test::rw_lock;
+
+int
+RWRD_Test::svc (void)
+{
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ while (!this->done ())
+ {
+ rw_lock.acquire_read ();
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ rw_lock.release ();
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (RWRD_Test)
+ACE_SVC_FACTORY_DEFINE (RWRD_Test)
+
+// ACE_Service_Object_Type rwrdt (&rwrd_test, "RWRD_Mutex_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/rwwr_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/rwwr_test.cpp
new file mode 100644
index 00000000000..1c7a25eae1f
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/rwwr_test.cpp
@@ -0,0 +1,45 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/RW_Mutex.h"
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, rwwr_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export RWWR_Test : public Benchmark_Performance
+{
+public:
+ virtual int svc (void);
+
+private:
+ static ACE_RW_Mutex rw_lock;
+};
+
+ACE_RW_Mutex RWWR_Test::rw_lock;
+
+int
+RWWR_Test::svc (void)
+{
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ while (!this->done ())
+ {
+ rw_lock.acquire_write ();
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ rw_lock.release ();
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (RWWR_Test)
+ACE_SVC_FACTORY_DEFINE (RWWR_Test)
+
+// ACE_Service_Object_Type rwwrt (&rwwr_test, "RWWR_Mutext_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/sema_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/sema_test.cpp
new file mode 100644
index 00000000000..9f1d7657139
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/sema_test.cpp
@@ -0,0 +1,45 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+#include "ace/Semaphore.h"
+
+ACE_RCSID(Synch_Benchmarks, sema_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Sema_Test : public Benchmark_Performance
+{
+public:
+ virtual int svc (void);
+
+private:
+ static ACE_Semaphore sema;
+};
+
+ACE_Semaphore Sema_Test::sema (1);
+
+int
+Sema_Test::svc (void)
+{
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ while (!this->done ())
+ {
+ sema.acquire ();
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ sema.release ();
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Sema_Test)
+ACE_SVC_FACTORY_DEFINE (Sema_Test)
+
+// ACE_Service_Object_Type semt (&sema_test, "Semaphore_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/sysvsema_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/sysvsema_test.cpp
new file mode 100644
index 00000000000..5899e4f1a75
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/sysvsema_test.cpp
@@ -0,0 +1,67 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/SV_Semaphore_Simple.h"
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, sysvsema_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export SYSVSema_Test : public Benchmark_Performance
+{
+public:
+ virtual int init (int, ACE_TCHAR *[]);
+ virtual int fini (void);
+ virtual int svc (void);
+
+private:
+ static ACE_SV_Semaphore_Simple *sema;
+};
+
+
+ACE_SV_Semaphore_Simple *SYSVSema_Test::sema = 0;
+
+int
+SYSVSema_Test::init (int, ACE_TCHAR *[])
+{
+#if defined (ACE_HAS_SYSV_IPC)
+ ACE_NEW_RETURN (SYSVSema_Test::sema, ACE_SV_Semaphore_Simple ((key_t) 1234), -1);
+ return 0;
+#else
+ ACE_ERROR_RETURN ((LM_ERROR, "SysV Semaphore not supported on this platform.\n"), -1);
+#endif /* ACE_HAS_SYSV_IPC */
+}
+
+int
+SYSVSema_Test::fini (void)
+{
+ delete SYSVSema_Test::sema;
+ return 0;
+}
+
+int
+SYSVSema_Test::svc (void)
+{
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ while (!this->done ())
+ {
+ SYSVSema_Test::sema->acquire ();
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ SYSVSema_Test::sema->release ();
+ }
+
+ SYSVSema_Test::sema->remove ();
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (SYSVSema_Test)
+ACE_SVC_FACTORY_DEFINE (SYSVSema_Test)
+
+// ACE_Service_Object_Type st (&sysvsema_test, "SYSVSema_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Perf_Test/token_test.cpp b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/token_test.cpp
new file mode 100644
index 00000000000..fe66740feca
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Perf_Test/token_test.cpp
@@ -0,0 +1,46 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+#include "ace/Token.h"
+#include "Performance_Test_Options.h"
+#include "Benchmark_Performance.h"
+
+ACE_RCSID(Synch_Benchmarks, token_test, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+class ACE_Svc_Export Token_Test : public Benchmark_Performance
+{
+public:
+ virtual int svc (void);
+
+private:
+ static ACE_Token token;
+};
+
+ACE_Token Token_Test::token;
+
+int
+Token_Test::svc (void)
+{
+ // Extract out the unique thread-specific value to be used as an
+ // index...
+ int ni = this->thr_id ();
+ synch_count = 2;
+
+ while (!this->done ())
+ {
+ token.acquire ();
+ performance_test_options.thr_work_count[ni]++;
+ buffer++;
+ token.release ();
+ }
+ /* NOTREACHED */
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Token_Test)
+ACE_SVC_FACTORY_DEFINE (Token_Test)
+
+// ACE_Service_Object_Type tok (&token_test, "Token_Test");
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/README b/ACE/performance-tests/Synch-Benchmarks/README
new file mode 100644
index 00000000000..c902ecab244
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/README
@@ -0,0 +1,46 @@
+This directory contains a program for benchmarking various
+synchronization and concurrent programming mechanisms in ACE.
+
+To build the program, do a make on the top level Makefile (or,
+on NT, open Synch_Tests.dsw and build evey project in it.)
+There are several modules which perform different benchmarking
+measurements in subdirectories. Here is a short description of all
+the subdirectories:
+
+ Synch_lib: This directory contains interface definitions required
+ by both main program (synch_driver) and other modules.
+ Base_Test: This directory contains a set of baseline tests. They
+ measure the time to obtain a lock without contension,
+ or trying to objtain a lock with contension.
+ Perf_Test: This directory contains a set of performance tests.
+ They measure the opeation performed by spawning a
+ bunch of threads and let these threads compete with
+ each other in obtaining a lock.
+
+There'll always be a "Method" object in each module subdirectory.
+They defines the method used in benchmarking and usually takes some
+options which can be defined in the 'svc.conf' file. Beside from this
+"Method" object, there are also a lot of "Test" objects that define
+the mechanism to be tested.
+
+Executing the program: the synch_driver performs various benchmarking
+according to the "script" defined in 'svc.conf' file. All command
+line options applicable to ACE's Service_Config class can be used.
+
+The entries in svc.conf file are always in groups. Each group
+consists of several svc.conf entries. The first entry in each group
+is the "Method" entry which defines the methodology used in the test.
+The rest of the entries are "Test" entries which define the mechanism
+to be test using the "Method".
+
+At this moment, you can not have entries with the same object (either
+"Method" object or "Test" object) in one svc.conf file. Therefore, at
+this moment, there can only be two groups in the svc.conf. Of them,
+each "Test" can only be performed once. Therefore, there's no way to
+benchmark using the same method with differnt configurations within
+the same svc.conf file. However, this can be easily overcome by
+defining multiple svc.conf files and invoking the synch_driver with
+different svc.conf file.
+
+There'll be more detailed description about how a "Method" object can
+be configured in respective subdirectory. \ No newline at end of file
diff --git a/ACE/performance-tests/Synch-Benchmarks/Synch_Benchmarks.mpc b/ACE/performance-tests/Synch-Benchmarks/Synch_Benchmarks.mpc
new file mode 100644
index 00000000000..92ad3685637
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Synch_Benchmarks.mpc
@@ -0,0 +1,12 @@
+// -*- MPC -*-
+// $Id$
+
+project : aceexe {
+ exename = synch_driver
+ after += Synch_Lib
+ libs += Synch_Lib
+ libpaths += Synch_Lib
+ source_files {
+ synch_driver.cpp
+ }
+}
diff --git a/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp
new file mode 100644
index 00000000000..48c2ec20cd0
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp
@@ -0,0 +1,95 @@
+// $Id$
+
+#if !defined (SYNCHLIB_BUILD_DLL)
+#define SYNCHLIB_BUILD_DLL
+#endif /* SYNCHLIB_BUILD_DLL */
+
+#include "ace/Log_Msg.h"
+#include "Benchmark_Base.h"
+
+ACE_RCSID(Synch_Benchmarks, Benchmark_Base, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+
+// Initialize the static variables.
+/* static */
+
+Benchmark_Base::Benchmark_Base (int type)
+ : benchmark_type_ (type)
+{
+}
+
+int
+Benchmark_Base::benchmark_type (void)
+{
+ return this->benchmark_type_;
+}
+
+int
+Benchmark_Base::thr_id (void)
+{
+#if defined (ACE_HAS_PTHREADS) || defined (ACE_HAS_DCETHREADS) || defined (VXWORKS)
+ // This invokes the thread-specific storage smart pointer.
+ return this->id_->thr_id ();
+#else
+ return ACE_Thread::self ();
+#endif /* ACE_HAS_PTHREADS || ACE_HAS_DCETHREADS || VXWORKS */
+}
+
+Benchmark_Method_Base::Benchmark_Method_Base (void)
+ : Benchmark_Base (Benchmark_Base::METHOD)
+{
+}
+
+int
+Benchmark_Method_Base::exec (ACE_Service_Repository_Iterator *sri)
+{
+ sri->advance ();
+ for (const ACE_Service_Type *sr;
+ sri->next (sr) != 0;
+ sri->advance ())
+ {
+ // This would greatly benefit from RTTI typesafe downcasting...
+ const ACE_Service_Type_Impl *type = sr->type ();
+ const void *obj = type->object ();
+ ACE_Service_Object *so = (ACE_Service_Object *) obj;
+ Benchmark_Base *bp = (Benchmark_Base *) so;
+
+ if (this->valid_test_object (bp))
+ {
+
+ ACE_DEBUG ((LM_DEBUG, "\nstarting up %s\n", sr->name ()));
+
+ int notused = this->pre_run_test (bp) == 0 && this->run_test () == 0 &&
+ this->post_run_test () == 0;
+ notused = notused;
+ }
+ else
+ return 0;
+ }
+ return 0;
+}
+
+#if defined (ACE_HAS_PTHREADS) || defined (ACE_HAS_DCETHREADS) || defined (VXWORKS)
+/* static */
+MT_INT Thr_ID::thread_id_ (0);
+
+Thr_ID::Thr_ID (void)
+ : thr_id_ (++Thr_ID::thread_id_)
+{
+}
+
+int
+Thr_ID::thr_id (void)
+{
+ return this->thr_id_;
+}
+
+void
+Thr_ID::thr_id (int i)
+{
+ this->thr_id_ = i;
+}
+
+#endif /* ACE_HAS_PTHREADS || ACE_HAS_DCETHREADS || VXWORKS */
+#endif /* ACE_HAS_THREADS */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.h b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.h
new file mode 100644
index 00000000000..1737d45b36f
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.h
@@ -0,0 +1,114 @@
+/* -*- C++ -*- */
+// $Id$
+
+/* Defines the base class used to dynamically link in the benchmark tests */
+
+#ifndef ACE_BENCHMARK_BASE_H
+# define ACE_BENCHMARK_BASE_H
+
+# include "ace/Service_Config.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+# include "ace/Service_Repository.h"
+# include "ace/Service_Types.h"
+# include "ace/Atomic_Op.h"
+# include "export_mac.h"
+# include "ace/TSS_T.h"
+
+# if defined (ACE_HAS_THREADS)
+
+# if defined (ACE_HAS_PTHREADS) || defined (ACE_HAS_DCETHREADS) || defined (VXWORKS)
+
+typedef ACE_Atomic_Op<ACE_Thread_Mutex, int> MT_INT;
+
+class Thr_ID
+ // TITLE
+ // A simple class that provides a thread-specific value in order
+ // to compensate for POSIX Pthreads.
+ //
+ // DESCRIPTION
+ // Pthreads are too lame to have a sensible scalar values for the
+ // thread id (unlike Solaris threads). Therefore, we have to
+ // emulate this ourselves with this class (gag).
+{
+public:
+ Thr_ID (void);
+ int thr_id (void);
+ void thr_id (int);
+
+private:
+ int thr_id_;
+ static MT_INT thread_id_;
+};
+# endif /* ACE_HAS_PTHREADS || ACE_HAS_DCETHREADS || VXWORKS */
+
+class SYNCHLIB_Export Benchmark_Base : public ACE_Service_Object
+{
+ // = TITLE
+ // Base class for all benchmarking objects.
+ //
+ // = DESCRIPTION
+ // This class is the base class for all benchmarking
+ // classes. Its major functionalities are to privide RTTI
+ // information and to define other common methods all
+ // benchmarking classes should support.
+public:
+ enum {
+ BENCHMARK_BASE,
+ METHOD,
+ BASELINE,
+ PERFORMANCE
+ };
+
+ int benchmark_type (void);
+ // RTTI information of this module.
+
+ int thr_id (void);
+ // Returns our thread id;
+
+protected:
+ Benchmark_Base (int type = BENCHMARK_BASE);
+ // Default ctor.
+
+ int benchmark_type_;
+ // Store the RTTI info of this module.
+
+# if defined (ACE_HAS_PTHREADS) || defined (ACE_HAS_DCETHREADS) || defined (VXWORKS)
+ ACE_TSS <Thr_ID> id_;
+ // Keeps track of our "virtual" thread id...
+# endif /* ACE_HAS_PTHREADS || ACE_HAS_DCETHREADS || VXWORKS */
+};
+
+class SYNCHLIB_Export Benchmark_Method_Base : public Benchmark_Base
+{
+ // = TITLE
+ // This class identifies itself as Benmarking Method class.
+ // It defines a method as of how the test is setup and measured.
+public:
+ int exec (ACE_Service_Repository_Iterator *sri);
+ // Run the test and advanced the service repository iterator
+
+ virtual int pre_run_test (Benchmark_Base *bp) = 0;
+ // Before running the real test. Subclasses implement this method
+ // to dictate how the test is performed.
+
+ virtual int run_test (void) = 0;
+ // Run the real test. Subclasses implement this method to
+ // dictate how the test is performed.
+
+ virtual int post_run_test (void) = 0;
+ // After running the real test. Subclasses implement this method to
+ // dictate how the test is performed.
+
+ virtual int valid_test_object (Benchmark_Base *) = 0;
+ // Check if we got a valid test to perform.
+
+protected:
+ Benchmark_Method_Base (void);
+};
+
+# endif /* ACE_HAS_THREADS */
+#endif /* ACE_BENCHMARK_BASE_H */
diff --git a/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Makefile.am b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Makefile.am
new file mode 100644
index 00000000000..673ec4a0155
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Makefile.am
@@ -0,0 +1,36 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
+
+ACE_BUILDDIR = $(top_builddir)
+ACE_ROOT = $(top_srcdir)
+
+## Makefile.Synch_Lib.am
+
+noinst_LTLIBRARIES = libSynch_Lib.la
+
+libSynch_Lib_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -DSYNCHLIB_BUILD_DLL
+
+libSynch_Lib_la_SOURCES = \
+ Benchmark_Base.cpp
+
+noinst_HEADERS = \
+ Benchmark_Base.h \
+ export_mac.h
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/README b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/README
new file mode 100644
index 00000000000..f17fe39234a
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/README
@@ -0,0 +1,4 @@
+This subdirectory contains a library that defines the interface used
+by all benchmarking modules. The library is required by all modules
+and the synch_driver. If you want to develop your own benchmarking
+module, this directory provides a starting point.
diff --git a/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Synch_Benchmarks_Synch_Lib.mpc b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Synch_Benchmarks_Synch_Lib.mpc
new file mode 100644
index 00000000000..34f382f3faa
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/Synch_Benchmarks_Synch_Lib.mpc
@@ -0,0 +1,7 @@
+// -*- MPC -*-
+// $Id$
+
+project(Synch_Lib) : acelib {
+ sharedname = Synch_Lib
+ dynamicflags += SYNCHLIB_BUILD_DLL
+}
diff --git a/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/export_mac.h b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/export_mac.h
new file mode 100644
index 00000000000..e4e6be63334
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/Synch_Lib/export_mac.h
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by
+// ${ACE_ROOT}/GenExportH.BAT
+// ------------------------------
+#if !defined (SYNCHLIB_EXPORT_H)
+#define SYNCHLIB_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (SYNCHLIB_HAS_DLL)
+# define SYNCHLIB_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && ! TEST_HAS_DLL */
+
+#if !defined (SYNCHLIB_HAS_DLL)
+#define SYNCHLIB_HAS_DLL 1
+#endif /* !SYNCHLIB_HAS_DLL */
+
+#if defined (SYNCHLIB_HAS_DLL)
+# if (SYNCHLIB_HAS_DLL == 1)
+# if defined (SYNCHLIB_BUILD_DLL)
+# define SYNCHLIB_Export ACE_Proper_Export_Flag
+# define SYNCHLIB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# else
+# define SYNCHLIB_Export ACE_Proper_Import_Flag
+# define SYNCHLIB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# endif /* SYNCHLIB_BUILD_DLL */
+# else
+# define SYNCHLIB_Export
+# define SYNCHLIB_SINGLETON_DECLARATION(T)
+# endif /* ! SYNCHLIB_HAS_DLL == 1 */
+#else
+# define SYNCHLIB_Export
+# define SYNCHLIB_SINGLETON_DECLARATION(T)
+#endif /* SYNCHLIB_HAS_DLL */
+
+#endif /* SYNCHLIB_EXPORT_H */
+// End of auto generated file.
+
diff --git a/ACE/performance-tests/Synch-Benchmarks/benchmarks b/ACE/performance-tests/Synch-Benchmarks/benchmarks
new file mode 100644
index 00000000000..5b3a6644bc5
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/benchmarks
@@ -0,0 +1,19 @@
+#!/bin/csh -f
+
+echo "Memory test = 512, 40M"
+./memory_test -i 80000 -M 512
+echo "Memory test = 1024, 40M"
+./memory_test -i 40000 -M 1024
+echo "Memory test = 2048, 40M"
+./memory_test -i 20000 -M 2048
+echo "Memory test = 4096, 40M"
+./memory_test -i 10000 -M 4096
+
+echo "Pipe test = 512, 40M"
+./pipe_test -i 80000 -M 512
+echo "Pipe test = 1024, 40M"
+./pipe_test -i 40000 -M 1024
+echo "Pipe test = 2048, 40M"
+./pipe_test -i 20000 -M 2048
+echo "Pipe test = 4096, 40M"
+./pipe_test -i 10000 -M 4096
diff --git a/ACE/performance-tests/Synch-Benchmarks/context.c b/ACE/performance-tests/Synch-Benchmarks/context.c
new file mode 100644
index 00000000000..74ace9522aa
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/context.c
@@ -0,0 +1,76 @@
+/* $Id$ */
+
+/* FUZZ: disable check_for_improper_main_declaration */
+
+#include <stdio.h>
+// @(#)context.c 1.1 10/18/96
+
+#include <stdlib.h>
+#include <thread.h>
+
+#define NSLEEP 100
+#define TMAX 2
+int count[TMAX];
+
+void *
+work (void *n)
+{
+ int ni = (int) n;
+
+ while (1)
+ {
+ thr_yield ();
+ count[ni]++;
+ }
+ return 0;
+}
+
+main (int argc, char *argv[])
+{
+ int ncorr, t1arg, t0arg, orig_ncorr;
+ thread_t tid1, tid0;
+ float rate;
+
+ if (argc != 6)
+ {
+ printf ("usage: %s t0_bound t0_new_lwp t1_bound t1_new_lwp ncorr\n", argv[0]);
+ exit (1);
+ }
+ t0arg = THR_DETACHED;
+ if (atoi (argv[1]))
+ t0arg |= THR_BOUND;
+ if (atoi (argv[2]))
+ t0arg |= THR_NEW_LWP;
+
+ t1arg = THR_DETACHED;
+ if (atoi (argv[3]))
+ t1arg |= THR_BOUND;
+ if (atoi (argv[4]))
+ t1arg |= THR_NEW_LWP;
+
+ ncorr = atoi (argv[5]);
+
+ if (thr_create (0, 0, work, 0, t0arg, &tid0) != 0)
+ perror ("couldn't create thread 0");
+ if (thr_create (0, 0, work, (void *) 1, t1arg, &tid1) != 0)
+ perror ("couldn't create thread 1");
+
+ orig_ncorr = thr_getconcurrency ();
+ if (ncorr)
+ thr_setconcurrency (ncorr);
+ sleep (NSLEEP);
+ rate = (count[0] + count[1]) / ((float) NSLEEP);
+ printf ("\n------------------------------------------------------------------------\n");
+ printf ("t0arg 0x%x (%s, %s, %s)\nt1arg 0x%x (%s, %s, %s)\ncount[0] %d count[1] %d\n\
+ ncorr_orig %d ncorr_set %d ncorr_end %d rate %.3f per_cxt %.2f usec\n",
+ t0arg,
+ (t0arg & THR_DETACHED) ? "THR_DETACHED" : "Not Detached",
+ (t0arg & THR_BOUND) ? "THR_BOUND" : "Not Bound",
+ (t0arg & THR_NEW_LWP) ? "THR_NEW_LWP" : "No New_LWP",
+ t1arg,
+ (t1arg & THR_DETACHED) ? "THR_DETACHED" : "Not Detached",
+ (t1arg & THR_BOUND) ? "THR_BOUND" : "Not Bound",
+ (t1arg & THR_NEW_LWP) ? "THR_NEW_LWP" : "No New_LWP",
+ count[0], count[1],
+ orig_ncorr, ncorr, thr_getconcurrency (), rate, 1.0e6 / rate);
+}
diff --git a/ACE/performance-tests/Synch-Benchmarks/context.csh b/ACE/performance-tests/Synch-Benchmarks/context.csh
new file mode 100644
index 00000000000..867611f07e1
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/context.csh
@@ -0,0 +1,16 @@
+#/bin/csh -f
+time ./context 0 0 0 0 0
+time ./context 0 0 0 0 2
+time ./context 0 0 0 0 3
+
+time ./context 1 0 1 0 0
+time ./context 1 0 1 0 2
+time ./context 1 0 1 0 3
+
+time ./context 0 1 0 1 0
+time ./context 0 1 0 1 2
+time ./context 0 1 0 1 3
+
+time ./context 1 1 1 1 0
+time ./context 1 1 1 1 2
+time ./context 1 1 1 1 3
diff --git a/ACE/performance-tests/Synch-Benchmarks/orig-results b/ACE/performance-tests/Synch-Benchmarks/orig-results
new file mode 100644
index 00000000000..9d4389005f1
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/orig-results
@@ -0,0 +1,73 @@
+/*
+ --------------------- results -------------------------------------
+ t0arg 0x40 (THR_DETACHED, Not Bound, No New_LWP)
+ t1arg 0x40 (THR_DETACHED, Not Bound, No New_LWP)
+ count[0] 2222061 count[1] 2222061
+ ncorr_orig 1 ncorr_set 0 ncorr_end 2 rate 22070.520 per_cxt 45.31 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x40 (THR_DETACHED, Not Bound, No New_LWP)
+ t1arg 0x40 (THR_DETACHED, Not Bound, No New_LWP)
+ count[0] 3979311 count[1] 3824273
+ ncorr_orig 1 ncorr_set 2 ncorr_end 2 rate 38975.535 per_cxt 25.66 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x40 (THR_DETACHED, Not Bound, No New_LWP)
+ t1arg 0x40 (THR_DETACHED, Not Bound, No New_LWP)
+ count[0] 4173290 count[1] 3690153
+ ncorr_orig 1 ncorr_set 3 ncorr_end 3 rate 39134.219 per_cxt 25.55 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x41 (THR_DETACHED, THR_BOUND, No New_LWP)
+ t1arg 0x41 (THR_DETACHED, THR_BOUND, No New_LWP)
+ count[0] 1376594 count[1] 1404050
+ ncorr_orig 1 ncorr_set 0 ncorr_end 1 rate 13902.920 per_cxt 71.93 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x41 (THR_DETACHED, THR_BOUND, No New_LWP)
+ t1arg 0x41 (THR_DETACHED, THR_BOUND, No New_LWP)
+ count[0] 1522495 count[1] 1550889
+ ncorr_orig 1 ncorr_set 2 ncorr_end 2 rate 15366.580 per_cxt 65.08 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x41 (THR_DETACHED, THR_BOUND, No New_LWP)
+ t1arg 0x41 (THR_DETACHED, THR_BOUND, No New_LWP)
+ count[0] 1282030 count[1] 1265453
+ ncorr_orig 1 ncorr_set 3 ncorr_end 3 rate 12737.125 per_cxt 78.51 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x42 (THR_DETACHED, Not Bound, THR_NEW_LWP)
+ t1arg 0x42 (THR_DETACHED, Not Bound, THR_NEW_LWP)
+ count[0] 3892994 count[1] 3981143
+ ncorr_orig 3 ncorr_set 0 ncorr_end 3 rate 39273.352 per_cxt 25.46 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x42 (THR_DETACHED, Not Bound, THR_NEW_LWP)
+ t1arg 0x42 (THR_DETACHED, Not Bound, THR_NEW_LWP)
+ count[0] 4008638 count[1] 3882986
+ ncorr_orig 3 ncorr_set 2 ncorr_end 2 rate 39415.660 per_cxt 25.37 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x42 (THR_DETACHED, Not Bound, THR_NEW_LWP)
+ t1arg 0x42 (THR_DETACHED, Not Bound, THR_NEW_LWP)
+ count[0] 3859767 count[1] 3998157
+ ncorr_orig 3 ncorr_set 3 ncorr_end 3 rate 39145.160 per_cxt 25.55 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x43 (THR_DETACHED, THR_BOUND, THR_NEW_LWP)
+ t1arg 0x43 (THR_DETACHED, THR_BOUND, THR_NEW_LWP)
+ count[0] 1557142 count[1] 1588775
+ ncorr_orig 3 ncorr_set 0 ncorr_end 3 rate 15729.235 per_cxt 63.58 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x43 (THR_DETACHED, THR_BOUND, THR_NEW_LWP)
+ t1arg 0x43 (THR_DETACHED, THR_BOUND, THR_NEW_LWP)
+ count[0] 1570636 count[1] 1579111
+ ncorr_orig 3 ncorr_set 2 ncorr_end 3 rate 15748.395 per_cxt 63.50 usec
+
+ ------------------------------------------------------------------------
+ t0arg 0x43 (THR_DETACHED, THR_BOUND, THR_NEW_LWP)
+ t1arg 0x43 (THR_DETACHED, THR_BOUND, THR_NEW_LWP)
+ count[0] 1414198 count[1] 1371431
+ ncorr_orig 3 ncorr_set 3 ncorr_end 3 rate 13927.800 per_cxt 71.80 usec
+ */
diff --git a/ACE/performance-tests/Synch-Benchmarks/results/.no_prune b/ACE/performance-tests/Synch-Benchmarks/results/.no_prune
new file mode 100644
index 00000000000..b5bcdc481b9
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/results/.no_prune
@@ -0,0 +1 @@
+"Do not prune me."
diff --git a/ACE/performance-tests/Synch-Benchmarks/run_tests.pl b/ACE/performance-tests/Synch-Benchmarks/run_tests.pl
new file mode 100755
index 00000000000..92bc3b787fd
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/run_tests.pl
@@ -0,0 +1,131 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+
+$EXE = "synch_driver";
+$Win32 = 0;
+if ($^O eq "MSWin32")
+{
+ $Win32 = 1;
+}
+
+$debug = 0;
+$name = "release";
+$result_dir = "results";
+$svcconf_dir = "svcconf";
+$conf_ext = ".conf";
+
+@Null_List = ();
+
+# This is called "baseline"
+@Baseline_List = ("base_acquire",
+ "base_tryacquire",
+ "base_acquire_read",
+ "base_tryacquire_read",
+ "base_acquire_write",
+ "base_tryacquire_write");
+
+# this is called "perf_thrno"
+@Perf_Thr_Number_List = ("perf_t1",
+ "perf_t2",
+ "perf_t4",
+ "perf_t8",
+ "perf_t16",
+ "perf_t32",
+ "perf_t64");
+
+@Target = @Null_List;
+
+while ( $#ARGV >= 0 && $ARGV[0] =~ /^-/ )
+{
+ if ($ARGV[0] eq '-d') # Run debug mode
+ {
+ $name = "debug";
+ }
+ elsif ($ARGV[0] eq '-p') # Debug perl script
+ {
+ $debug = 1;
+ print "debug perl scirpt\n";
+ }
+ elsif ($ARGV[0] eq '-D') # Subdir name to put the result
+ {
+ shift;
+ $result_dir = $ARGV[0];
+ }
+ elsif ($ARGV[0] eq '-S') # Subdir to svc.conf files.
+ {
+ shift;
+ $svcconf_dir = $ARGV[0];
+ }
+ elsif ($ARGV[0] eq '-N') # Specify test name.
+ {
+ shift;
+ if ($ARGV[0] eq "baseline")
+ {
+ @Target = @Baseline_List;
+ }
+ elsif ($ARGV[0] eq "perf_thrno")
+ {
+ @Target = @Perf_Thr_Number_List;
+ }
+ else
+ {
+ die "Unknown test \"$ARGV[0]\"\n";
+ }
+ }
+ else
+ {
+ warn "$0: unknown option $ARGV[0]\n";
+ die $usage;
+ }
+ shift;
+}
+
+die "You must specify a test to run\n" if (scalar (@Target) == 0);
+
+if ($Win32 != 0)
+{
+ $execname = "$name\\$EXE";
+ $DIR_SEPARATOR = '\\';
+}
+else
+{
+ $execname = "./$EXE"; # Notice that on UNIX, you much build
+ # Debug/Release program explicitly
+ # before running the script.
+ $DIR_SEPARATOR = '/';
+}
+
+for ($Cntr = 0; $Cntr < scalar (@Target); $Cntr++)
+{
+ $Redirect_Output = "$result_dir$DIR_SEPARATOR$Target[$Cntr].$name";
+ if ($debug != 0) # Only redirect output in actual run
+ {
+ print "Redirecting output to $Redirect_Output\n";
+ }
+ else
+ {
+ open STDOUT, "> $Redirect_Output";
+ open STDERR, ">&STDOUT";
+ }
+
+ @args = ("$execname",
+ "-f",
+ "$svcconf_dir$DIR_SEPARATOR$Target[$Cntr]$conf_ext");
+
+ if ($debug != 0)
+ {
+ print "Debug mode: Executing -- ";
+ for ($args_c = 0; $args_c < scalar (@args); $args_c ++)
+ {
+ print "$args[$args_c] ";
+ }
+ print "\n";
+ }
+ else
+ {
+ system (@args);
+ }
+}
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire.conf
new file mode 100644
index 00000000000..2727bac4e73
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire.conf
@@ -0,0 +1,20 @@
+# $Id$
+# Benchmark baseline acquire operation.
+
+dynamic Baseline_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Test() ""
+dynamic Baseline_Base_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Base_Test() "-i 10000000"
+dynamic Baseline_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Mutex_Test() "-i 10000000"
+dynamic Baseline_Adaptive_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Null_Mutex_Test() "-i 10000000"
+dynamic Baseline_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Mutex_Test() "-i 10000000"
+dynamic Baseline_RW_Thread_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Thread_Mutex_Test() "-i 10000000"
+dynamic Baseline_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Mutex_Test() "-i 10000000"
+dynamic Baseline_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Mutex_Test() "-i 10000000"
+dynamic Baseline_RW_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Process_Mutex_Test() "-i 10000000"
+dynamic Baseline_Adaptive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Mutex_Test() "-i 10000000"
+dynamic Baseline_Adaptive_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_RW_Mutex_Test() "-i 10000000"
+dynamic Baseline_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Recursive_Mutex_Test() "-i 10000000"
+dynamic Baseline_Adaptive_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Recursive_Mutex_Test() "-i 10000000"
+dynamic Baseline_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Semaphore_Test() "-i 10000000"
+dynamic Baseline_Process_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Semaphore_Test() "-i 10000000"
+dynamic Baseline_Null_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Semaphore_Test() "-i 10000000"
+dynamic Baseline_Token_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Token_Test() "-i 10000000"
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire_read.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire_read.conf
new file mode 100644
index 00000000000..9e25160b8d8
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire_read.conf
@@ -0,0 +1,20 @@
+# $Id$
+# Benchmark baseline acquire operation.
+
+dynamic Baseline_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Test() ""
+dynamic Baseline_Base_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Base_Test() "-i 10000000 -r"
+dynamic Baseline_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Adaptive_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Null_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_RW_Thread_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Thread_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_RW_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Process_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Adaptive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Adaptive_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_RW_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Recursive_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Adaptive_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Recursive_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Semaphore_Test() "-i 10000000 -r"
+dynamic Baseline_Process_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Semaphore_Test() "-i 10000000 -r"
+dynamic Baseline_Null_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Semaphore_Test() "-i 10000000 -r"
+dynamic Baseline_Token_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Token_Test() "-i 10000000 -r"
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire_write.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire_write.conf
new file mode 100644
index 00000000000..147e04574ca
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_acquire_write.conf
@@ -0,0 +1,20 @@
+# $Id$
+# Benchmark baseline acquire operation.
+
+dynamic Baseline_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Test() ""
+dynamic Baseline_Base_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Base_Test() "-i 10000000 -w"
+dynamic Baseline_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Adaptive_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Null_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_RW_Thread_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Thread_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_RW_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Process_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Adaptive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Adaptive_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_RW_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Recursive_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Adaptive_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Recursive_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Semaphore_Test() "-i 10000000 -w"
+dynamic Baseline_Process_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Semaphore_Test() "-i 10000000 -w"
+dynamic Baseline_Null_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Semaphore_Test() "-i 10000000 -w"
+dynamic Baseline_Token_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Token_Test() "-i 10000000 -w"
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire.conf
new file mode 100644
index 00000000000..91f78275ffa
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire.conf
@@ -0,0 +1,20 @@
+# $Id$
+# Benchmark baseline tryacquire operation.
+
+dynamic Baseline_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Test() "-t -v"
+dynamic Baseline_Base_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Base_Test() "-i 10000000"
+dynamic Baseline_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Mutex_Test() "-i 10000000"
+dynamic Baseline_Adaptive_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Null_Mutex_Test() "-i 10000000"
+dynamic Baseline_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Mutex_Test() "-i 10000000"
+dynamic Baseline_RW_Thread_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Thread_Mutex_Test() "-i 10000000"
+dynamic Baseline_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Mutex_Test() "-i 10000000"
+dynamic Baseline_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Mutex_Test() "-i 10000000"
+dynamic Baseline_RW_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Process_Mutex_Test() "-i 10000000"
+dynamic Baseline_Adaptive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Mutex_Test() "-i 10000000"
+dynamic Baseline_Adaptive_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_RW_Mutex_Test() "-i 10000000"
+dynamic Baseline_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Recursive_Mutex_Test() "-i 10000000"
+dynamic Baseline_Adaptive_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Recursive_Mutex_Test() "-i 10000000"
+dynamic Baseline_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Semaphore_Test() "-i 10000000"
+dynamic Baseline_Process_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Semaphore_Test() "-i 10000000"
+dynamic Baseline_Null_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Semaphore_Test() "-i 10000000"
+dynamic Baseline_Token_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Token_Test() "-i 10000000"
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire_read.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire_read.conf
new file mode 100644
index 00000000000..d300b3b462f
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire_read.conf
@@ -0,0 +1,20 @@
+# $Id$
+# Benchmark baseline tryacquire operation.
+
+dynamic Baseline_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Test() "-t -v"
+dynamic Baseline_Base_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Base_Test() "-i 10000000 -r"
+dynamic Baseline_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Adaptive_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Null_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_RW_Thread_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Thread_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_RW_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Process_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Adaptive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Adaptive_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_RW_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Recursive_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Adaptive_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Recursive_Mutex_Test() "-i 10000000 -r"
+dynamic Baseline_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Semaphore_Test() "-i 10000000 -r"
+dynamic Baseline_Process_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Semaphore_Test() "-i 10000000 -r"
+dynamic Baseline_Null_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Semaphore_Test() "-i 10000000 -r"
+dynamic Baseline_Token_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Token_Test() "-i 10000000 -r"
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire_write.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire_write.conf
new file mode 100644
index 00000000000..d220d4ecbd5
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/base_tryacquire_write.conf
@@ -0,0 +1,20 @@
+# $Id$
+# Benchmark baseline tryacquire operation.
+
+dynamic Baseline_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Test() "-t -v"
+dynamic Baseline_Base_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Base_Test() "-i 10000000 -w"
+dynamic Baseline_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Adaptive_Null_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Null_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_RW_Thread_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Thread_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_RW_Process_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_RW_Process_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Adaptive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Adaptive_RW_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_RW_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Recursive_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Adaptive_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Recursive_Mutex_Test() "-i 10000000 -w"
+dynamic Baseline_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Semaphore_Test() "-i 10000000 -w"
+dynamic Baseline_Process_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Process_Semaphore_Test() "-i 10000000 -w"
+dynamic Baseline_Null_Semaphore_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Null_Semaphore_Test() "-i 10000000 -w"
+dynamic Baseline_Token_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Token_Test() "-i 10000000 -w"
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t1.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t1.conf
new file mode 100644
index 00000000000..1c4c2ad2f01
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t1.conf
@@ -0,0 +1,32 @@
+# Dynamically configure all the tests
+
+dynamic Performance_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Performance_Test() "-s 60 -N -B -t 1"
+dynamic Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Mutex_Test()
+dynamic Adaptive_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Mutex_Test()
+dynamic Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Recursive_Lock_Test()
+dynamic Adaptive_Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Recursive_Lock_Test()
+dynamic Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Sema_Test()
+dynamic Adaptive_Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Sema_Test()
+dynamic RWRD_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWRD_Test()
+dynamic RWWR_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWWR_Test()
+dynamic Token_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Token_Test()
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t16.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t16.conf
new file mode 100644
index 00000000000..f50ae6f4544
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t16.conf
@@ -0,0 +1,32 @@
+# Dynamically configure all the tests
+
+dynamic Performance_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Performance_Test() "-s 60 -N -B -t 16"
+dynamic Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Mutex_Test()
+dynamic Adaptive_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Mutex_Test()
+dynamic Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Recursive_Lock_Test()
+dynamic Adaptive_Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Recursive_Lock_Test()
+dynamic Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Sema_Test()
+dynamic Adaptive_Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Sema_Test()
+dynamic RWRD_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWRD_Test()
+dynamic RWWR_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWWR_Test()
+dynamic Token_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Token_Test()
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t2.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t2.conf
new file mode 100644
index 00000000000..cc08f483a73
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t2.conf
@@ -0,0 +1,32 @@
+# Dynamically configure all the tests
+
+dynamic Performance_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Performance_Test() "-s 60 -N -B -t 2"
+dynamic Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Mutex_Test()
+dynamic Adaptive_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Mutex_Test()
+dynamic Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Recursive_Lock_Test()
+dynamic Adaptive_Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Recursive_Lock_Test()
+dynamic Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Sema_Test()
+dynamic Adaptive_Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Sema_Test()
+dynamic RWRD_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWRD_Test()
+dynamic RWWR_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWWR_Test()
+dynamic Token_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Token_Test()
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t32.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t32.conf
new file mode 100644
index 00000000000..c12d3dc752b
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t32.conf
@@ -0,0 +1,32 @@
+# Dynamically configure all the tests
+
+dynamic Performance_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Performance_Test() "-s 60 -N -B -t 32"
+dynamic Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Mutex_Test()
+dynamic Adaptive_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Mutex_Test()
+dynamic Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Recursive_Lock_Test()
+dynamic Adaptive_Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Recursive_Lock_Test()
+dynamic Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Sema_Test()
+dynamic Adaptive_Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Sema_Test()
+dynamic RWRD_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWRD_Test()
+dynamic RWWR_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWWR_Test()
+dynamic Token_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Token_Test()
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t4.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t4.conf
new file mode 100644
index 00000000000..2d6661d36e1
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t4.conf
@@ -0,0 +1,32 @@
+# Dynamically configure all the tests
+
+dynamic Performance_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Performance_Test() "-s 60 -N -B -t 4"
+dynamic Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Mutex_Test()
+dynamic Adaptive_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Mutex_Test()
+dynamic Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Recursive_Lock_Test()
+dynamic Adaptive_Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Recursive_Lock_Test()
+dynamic Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Sema_Test()
+dynamic Adaptive_Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Sema_Test()
+dynamic RWRD_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWRD_Test()
+dynamic RWWR_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWWR_Test()
+dynamic Token_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Token_Test()
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t64.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t64.conf
new file mode 100644
index 00000000000..0bf358d0191
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t64.conf
@@ -0,0 +1,32 @@
+# Dynamically configure all the tests
+
+dynamic Performance_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Performance_Test() "-s 60 -N -B -t 64"
+dynamic Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Mutex_Test()
+dynamic Adaptive_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Mutex_Test()
+dynamic Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Recursive_Lock_Test()
+dynamic Adaptive_Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Recursive_Lock_Test()
+dynamic Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Sema_Test()
+dynamic Adaptive_Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Sema_Test()
+dynamic RWRD_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWRD_Test()
+dynamic RWWR_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWWR_Test()
+dynamic Token_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Token_Test()
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t8.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t8.conf
new file mode 100644
index 00000000000..cbfe7062fa8
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/perf_t8.conf
@@ -0,0 +1,32 @@
+# Dynamically configure all the tests
+
+dynamic Performance_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Performance_Test() "-s 60 -N -B -t 8"
+dynamic Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Mutex_Test()
+dynamic Adaptive_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Mutex_Test()
+dynamic Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Recursive_Lock_Test()
+dynamic Adaptive_Recursive_Lock_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Recursive_Lock_Test()
+dynamic Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Sema_Test()
+dynamic Adaptive_Semaphore_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Adaptive_Sema_Test()
+dynamic RWRD_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWRD_Test()
+dynamic RWWR_Mutex_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_RWWR_Test()
+dynamic Token_Test
+ Service_Object *
+ Perf_Test/Perf_Test:_make_Token_Test()
diff --git a/ACE/performance-tests/Synch-Benchmarks/svcconf/svc.conf b/ACE/performance-tests/Synch-Benchmarks/svcconf/svc.conf
new file mode 100644
index 00000000000..ec2d85fbcbf
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/svcconf/svc.conf
@@ -0,0 +1,29 @@
+# Dynamically configure all the tests
+
+dynamic Performance_Test
+ Service_Object
+ *
+ Perf_Test/Perf_Test:_make_Performance_Test()
+ "-s 3 -t 4"
+dynamic Mutex_Test Service_Object
+ *
+ Perf_Test/Perf_Test:_make_Mutex_Test()
+#dynamic Guard_Test Service_Object * Perf_Test/Perf_Test:_make_Guard_Test() "-g"
+#dynamic SYSVSema_Test Service_Object * Perf_Test/Perf_Test:_make_SYSVSema_Test()
+#dynamic Adaptive_Mutex_Test Service_Object * Perf_Test/Perf_Test:_make_Adaptive_Mutex_Test()
+#dynamic Recursive_Lock_Test Service_Object * Perf_Test/Perf_Test:_make_Recursive_Lock_Test()
+#dynamic Adaptive_Recursive_Lock_Test Service_Object *
+# Perf_Test/Perf_Test:_make_Adaptive_Recursive_Lock_Test()
+#dynamic Semaphore_Test Service_Object * Perf_Test/Perf_Test:_make_Sema_Test()
+#dynamic Adaptive_Semaphore_Test Service_Object * Perf_Test/Perf_Test:_make_Adaptive_Sema_Test()
+#dynamic RWRD_Mutex_Test Service_Object * Perf_Test/Perf_Test:_make_RWRD_Test()
+#dynamic RWWR_Mutex_Test Service_Object * Perf_Test/Perf_Test:_make_RWWR_Test()
+#dynamic Token_Test Service_Object * Perf_Test/Perf_Test:_make_Token_Test()
+#dynamic SYSVSema_Test Service_Object * Perf_Test/Perf_Test:_make_SYSVSema_Test()
+#dynamic Context_Test Service_Object * Perf_Test/Perf_Test:_make_Context_Test()
+# dynamic Memory_Test Service_Object * Perf_Test/Perf_Test:_make_Memory_Test()
+#dynamic Pipe_Thr_Test Service_Object * Perf_Test/Perf_Test:_make_Pipe_Thr_Test()
+# dynamic Pipe_Proc_Test Service_Object * Perf_Test/Perf_Test:_make_Pipe_Proc_Test()
+# The following two tests don't work correctly yet...
+#dynamic Condition_Broadcast_Test Service_Object * Perf_Test/Perf_Test:_make_Cond_Brdcast_Test()
+#dynamic Condition_Signal_Test Service_Object * Perf_Test/Perf_Test:_make_Cond_Signal_Test()
diff --git a/ACE/performance-tests/Synch-Benchmarks/synch_driver.cpp b/ACE/performance-tests/Synch-Benchmarks/synch_driver.cpp
new file mode 100644
index 00000000000..4fb02007eb0
--- /dev/null
+++ b/ACE/performance-tests/Synch-Benchmarks/synch_driver.cpp
@@ -0,0 +1,52 @@
+// $Id$
+
+// Driver program that measures the performance of synchronization
+// mechanisms provided by ACE and the underlying OS.
+
+#include "ace/Log_Msg.h"
+#include "ace/Service_Config.h"
+#include "ace/Service_Repository.h"
+#include "Synch_Lib/Benchmark_Base.h"
+
+ACE_RCSID(Synch_Benchmarks, synch_driver, "$Id$")
+
+#if defined (ACE_HAS_THREADS)
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Service_Config::open (argc, argv);
+ ACE_Service_Repository_Iterator sri (*ACE_Service_Repository::instance ());
+
+ // Iteratively execute each service loaded in from the svc.conf
+ // file.
+
+ for (const ACE_Service_Type *sr;
+ sri.next (sr) != 0; )
+ {
+ // This would greatly benefit from RTTI typesafe downcasting...
+ const ACE_Service_Type_Impl *type = sr->type ();
+ const void *obj = type->object ();
+ ACE_Service_Object *so = (ACE_Service_Object *) obj;
+ Benchmark_Base *bb = (Benchmark_Base *) so;
+
+ if (bb->benchmark_type () == Benchmark_Base::METHOD)
+ {
+ Benchmark_Method_Base *bm = (Benchmark_Method_Base *) bb;
+
+ ACE_DEBUG ((LM_DEBUG, "\n\nExecuting %s\n", sr->name ()));
+
+ bm->exec (&sri);
+ }
+ else
+ sri.advance ();
+ }
+ return 0;
+}
+#else
+int
+ACE_TMAIN (int, ACE_TCHAR *[])
+{
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "This test requires the platform to have threads\n"), -1);
+}
+#endif /* ACE_HAS_THREADS */