summaryrefslogtreecommitdiff
path: root/performance-tests/Synch-Benchmarks
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-24 05:31:23 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-24 05:31:23 +0000
commitcac37bc7e80344835c4e2c37c0623bae68029196 (patch)
tree8a75f5e9091515f1866e203d63e5c646ff71a4ac /performance-tests/Synch-Benchmarks
parentf337b1710d6c737411c85f0d2c43b42f96b1586f (diff)
downloadATCD-cac37bc7e80344835c4e2c37c0623bae68029196.tar.gz
*** empty log message ***
Diffstat (limited to 'performance-tests/Synch-Benchmarks')
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp28
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h9
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.i15
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp65
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp23
-rw-r--r--performance-tests/Synch-Benchmarks/svc.conf6
6 files changed, 110 insertions, 36 deletions
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
index 290b1d4d1b4..ecdc3fe12ac 100644
--- a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
+++ b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
@@ -123,10 +123,8 @@ Baseline_Test_Options::reset_params (size_t multiply,
size_t iteration,
int yield)
{
- this->total_iteration_ = 0;
- this->real_ = 0;
- this->system_ = 0;
- this->user_ = 0;
+ this->current_iteration_ = 0;
+ this->timer.reset ();
// Start a new test, reset statistic info.
this->current_yield_method_ = yield;
@@ -138,11 +136,19 @@ Baseline_Test_Options::reset_params (size_t multiply,
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,
- "Real Time: %f\n System Time: %f\nUser Time: %f\n",
- this->real_,
- this->system_,
- this->user_));
+ "Total Time: %d sec %d usec for a "
+ "total of %d iterations (%d iterations before yield)\n"
+ "Average time: %d nanoseconds.\n",
+ tv.sec (), tv.usec (),
+ this->current_iteration_,
+ this->current_multiply_factor_,
+ nsec / this->current_iteration_));
}
Baseline_Test::Baseline_Test (void)
@@ -167,7 +173,6 @@ Baseline_Test::pre_run_test (Benchmark_Base *bb)
baseline_options.reset_params (this->current_test_->multiply_factor (),
this->current_test_->iteration (),
this->current_test_->yield_method ());
-
if (baseline_options.test_try_lock ())
{
ACE_Thread_Manager::instance ()->spawn
@@ -178,6 +183,11 @@ Baseline_Test::pre_run_test (Benchmark_Base *bb)
// Wait until the lock is held by the spawning thread.
}
+ this->run_test ();
+ baseline_options.reset_params (this->current_test_->multiply_factor (),
+ this->current_test_->iteration (),
+ this->current_test_->yield_method ());
+
return 0;
}
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
index 23e2d3ff8f6..2206db2dbca 100644
--- a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
+++ b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
@@ -75,8 +75,9 @@ public:
int test_try_lock (void);
// Return test configuration.
- int add_time (ACE_Profile_Timer::ACE_Elapsed_Time &et);
- // Add the time spent in the current iterations.
+ void start_inc_timer (void);
+ void stop_inc_timer (void);
+ // Start/stop measuring time.
int inc_loop_counter (void);
// Added multiply_factor_ to total_iteration_.
@@ -111,9 +112,7 @@ private:
size_t total_iteration_;
// Total number of target iteration.
- ACE_timer_t real_;
- ACE_timer_t system_;
- ACE_timer_t user_;
+ ACE_High_Res_Timer timer;
// Profile timer result.
};
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.i b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.i
index 6e1aecbd50c..9516fce1aa5 100644
--- a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.i
+++ b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.i
@@ -36,13 +36,16 @@ Baseline_Test_Options::current_iteration (void)
return this->current_iteration_;
}
-ACE_INLINE int
-Baseline_Test_Options::add_time (ACE_Profile_Timer::ACE_Elapsed_Time &et)
+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->real_ += et.real_time;
- this->system_ += et.system_time;
- this->user_ += et.user_time;
- return 0;
+ this->timer.stop_incr ();
}
ACE_INLINE int
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp b/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp
new file mode 100644
index 00000000000..57a4c4170ac
--- /dev/null
+++ b/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp
@@ -0,0 +1,65 @@
+// $Id$
+
+#define ACE_BUILD_SVC_DLL
+
+#include "ace/Synch.h"
+#include "Baseline_Test.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 ()
+{
+ for (; baseline_options.inc_loop_counter () ; )
+ {
+ this->yield ();
+ baseline_options.start_inc_timer ();
+
+ for (size_t i=0; i < baseline_options.current_multiply_factor (); i++)
+ ;
+
+ baseline_options.stop_inc_timer ();
+ }
+ return 0;
+}
+
+int
+Baseline_Base_Test::test_try_lock ()
+{
+ for (; baseline_options.inc_loop_counter () ; )
+ {
+ this->yield ();
+ baseline_options.start_inc_timer ();
+
+ for (size_t i=0; i < baseline_options.current_multiply_factor (); i++)
+ ;
+
+ baseline_options.stop_inc_timer ();
+ }
+ return 0;
+}
+
+ACE_SVC_FACTORY_DECLARE (Baseline_Base_Test)
+ACE_SVC_FACTORY_DEFINE (Baseline_Base_Test)
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp b/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp
index a81d9e171c6..ff96eb43134 100644
--- a/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp
+++ b/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp
@@ -37,13 +37,10 @@ Baseline_Lock_Test<LOCK>::release ()
template<class LOCK> int
Baseline_Lock_Test<LOCK>::test_acquire_release ()
{
- ACE_Profile_Timer ptimer;
- ACE_Profile_Timer::ACE_Elapsed_Time et;
-
for (; baseline_options.inc_loop_counter () ; )
{
this->yield ();
- ptimer.start ();
+ baseline_options.start_inc_timer ();
for (size_t i=0; i < baseline_options.current_multiply_factor (); i++)
{
@@ -51,9 +48,7 @@ Baseline_Lock_Test<LOCK>::test_acquire_release ()
this->lock_.release ();
}
- ptimer.stop ();
- ptimer.elapsed_time (et);
- baseline_options.add_time (et);
+ baseline_options.stop_inc_timer ();
}
return 0;
}
@@ -61,20 +56,15 @@ Baseline_Lock_Test<LOCK>::test_acquire_release ()
template<class LOCK> int
Baseline_Lock_Test<LOCK>::test_try_lock ()
{
- ACE_Profile_Timer ptimer;
- ACE_Profile_Timer::ACE_Elapsed_Time et;
-
for (; baseline_options.inc_loop_counter () ; )
{
this->yield ();
- ptimer.start ();
+ baseline_options.start_inc_timer ();
for (size_t i=0; i < baseline_options.current_multiply_factor (); i++)
this->lock_.tryacquire (); // This should always fail.
- ptimer.stop ();
- ptimer.elapsed_time (et);
- baseline_options.add_time (et);
+ baseline_options.stop_inc_timer ();
}
return 0;
}
@@ -89,6 +79,11 @@ typedef Baseline_Lock_Test<ACE_Recursive_Thread_Mutex> Baseline_Recursive_Mutex_
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)
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class Baseline_Lock_Test<ACE_Thread_Mutex>;
template class Baseline_Lock_Test<ACE_Recursive_Thread_Mutex>;
diff --git a/performance-tests/Synch-Benchmarks/svc.conf b/performance-tests/Synch-Benchmarks/svc.conf
index 9a98cc4b958..ed597347f4c 100644
--- a/performance-tests/Synch-Benchmarks/svc.conf
+++ b/performance-tests/Synch-Benchmarks/svc.conf
@@ -1,8 +1,10 @@
# Dynamically configure all the tests
dynamic Baseline_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Test() ""
-dynamic Baseline_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Mutex_Test() "-m 300 -i 300000"
-dynamic Baseline_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Recursive_Mutex_Test() "-m 8000 -i 3000000"
+dynamic Baseline_Base_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Base_Test() "-m 1 -i 30000"
+dynamic Baseline_Adaptive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Mutex_Test() "-m 30000 -i 30000000"
+dynamic Baseline_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Mutex_Test() "-m 30000 -i 30000000"
+#dynamic Baseline_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Recursive_Mutex_Test() "-m 3000 -i 30000000"
#dynamic Performance_Test Service_Object * Perf_Test/Perf_Test:_make_Performance_Test() "-s 3"