summaryrefslogtreecommitdiff
path: root/performance-tests
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-04-01 00:41:00 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-04-01 00:41:00 +0000
commit58b5106686e0884d0047a1dfec0d85b38d4f444b (patch)
treee77531d01a9cc35d08dd031a0b9a7abf458b9e60 /performance-tests
parent86ab6825e85ab28f3fcaf59ba1be7034b412b17e (diff)
downloadATCD-58b5106686e0884d0047a1dfec0d85b38d4f444b.tar.gz
*** empty log message ***
Diffstat (limited to 'performance-tests')
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp19
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h9
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp46
-rw-r--r--performance-tests/Synch-Benchmarks/Synch_Tests.dsw12
4 files changed, 78 insertions, 8 deletions
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
index 5dca208d27c..2c78efa19fe 100644
--- a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
+++ b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
@@ -20,7 +20,8 @@ Baseline_Test_Options baseline_options;
Baseline_Test_Base::Baseline_Test_Base (void)
: Benchmark_Base (Benchmark_Base::BASELINE),
yield_method_ (Baseline_Test_Options::USE_SLEEP_ZERO),
- iteration_ (DEFAULT_ITERATIONS)
+ iteration_ (DEFAULT_ITERATIONS),
+ what_(TEST_LOCK)
{
}
@@ -33,13 +34,13 @@ Baseline_Test_Base::init (int argc, char *argv[])
int
Baseline_Test_Base::parse_args (int argc, char *argv[])
{
- ACE_Get_Opt getopt (argc, argv, "i:y", 0);
+ ACE_Get_Opt getopt (argc, argv, "i:ylrw", 0);
int c;
while ((c = getopt ()) != -1)
switch (c)
{
- case 'i':
+ case 'i': // Total iterations
{
int tmp = ACE_OS::atoi (getopt.optarg);
if (tmp <= 0)
@@ -55,6 +56,18 @@ Baseline_Test_Base::parse_args (int argc, char *argv[])
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;
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
index bff290c8d49..31ea8a25ffa 100644
--- a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
+++ b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
@@ -15,6 +15,12 @@ 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, char *argv[]);
// Standard initializing method for Baseline Test.
@@ -46,6 +52,9 @@ protected:
size_t iteration_;
// Total number of operations. <iterations_>
+
+ int what_;
+ // What test should be performed?
};
class ACE_Svc_Export Baseline_Test_Options
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp b/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp
index 3c259500304..e8f12275e6d 100644
--- a/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp
+++ b/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp
@@ -25,7 +25,22 @@ private:
template<class LOCK> int
Baseline_Lock_Test<LOCK>::acquire ()
{
- return this->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
@@ -38,13 +53,34 @@ template<class LOCK> int
Baseline_Lock_Test<LOCK>::test_acquire_release ()
{
baseline_options.start_inc_timer ();
- for (; baseline_options.inc_loop_counter () ; )
+
+ switch (this->what_)
{
- this->lock_.acquire ();
- this->lock_.release ();
+ 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 ();
+ baseline_options.stop_inc_timer ();
return 0;
}
diff --git a/performance-tests/Synch-Benchmarks/Synch_Tests.dsw b/performance-tests/Synch-Benchmarks/Synch_Tests.dsw
index ed10093302a..b2f8c58d70f 100644
--- a/performance-tests/Synch-Benchmarks/Synch_Tests.dsw
+++ b/performance-tests/Synch-Benchmarks/Synch_Tests.dsw
@@ -11,6 +11,9 @@ Package=<5>
Package=<4>
{{{
+ Begin Project Dependency
+ Project_Dep_Name Synch_Lib
+ End Project Dependency
}}}
###############################################################################
@@ -23,6 +26,9 @@ Package=<5>
Package=<4>
{{{
+ Begin Project Dependency
+ Project_Dep_Name Synch_Lib
+ End Project Dependency
}}}
###############################################################################
@@ -47,6 +53,12 @@ Package=<5>
Package=<4>
{{{
+ Begin Project Dependency
+ Project_Dep_Name Base_Test
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name Perf_Test
+ End Project Dependency
}}}
###############################################################################