diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-10 08:33:25 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-10 08:33:25 +0000 |
commit | 4d18bc20d58a0a7f8c438fdddfde1070f22ff02f (patch) | |
tree | 799e8224fd805a7d2775eabdf5c96e4a0823582a /performance-tests | |
parent | 465134e5c80b72037c8aa300844249b0a9073c2e (diff) | |
download | ATCD-4d18bc20d58a0a7f8c438fdddfde1070f22ff02f.tar.gz |
Changed Baseline test method.
Diffstat (limited to 'performance-tests')
7 files changed, 62 insertions, 103 deletions
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp index 88e6676a24d..5dca208d27c 100644 --- a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp +++ b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp @@ -20,8 +20,7 @@ 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), - multiply_factor_ (100), - iteration_ (10000) + iteration_ (DEFAULT_ITERATIONS) { } @@ -34,24 +33,12 @@ Baseline_Test_Base::init (int argc, char *argv[]) int Baseline_Test_Base::parse_args (int argc, char *argv[]) { - ACE_Get_Opt getopt (argc, argv, "m:i:y", 0); + ACE_Get_Opt getopt (argc, argv, "i:y", 0); int c; while ((c = getopt ()) != -1) switch (c) { - case 'm': - { - int tmp = ACE_OS::atoi (getopt.optarg); - if (tmp <= 0) - ACE_ERROR_RETURN ((LM_ERROR, - "%d is not a valid value for multiply_factor\n", - tmp), -1); - else - this->multiply_factor_ = ACE_static_cast (size_t, tmp); - } - break; - case 'i': { int tmp = ACE_OS::atoi (getopt.optarg); @@ -88,9 +75,8 @@ Baseline_Test_Options::Baseline_Test_Options (void) : test_try_lock_ (0), verbose_ (0), current_yield_method_ (0), - current_multiply_factor_ (10), current_iteration_ (0), - total_iteration_ (10000) + total_iteration_ (DEFAULT_ITERATIONS) { } @@ -119,16 +105,13 @@ Baseline_Test_Options::parse_args (int argc, char *argv[]) } int -Baseline_Test_Options::reset_params (size_t multiply, - size_t iteration, +Baseline_Test_Options::reset_params (size_t iteration, int yield) { this->current_iteration_ = 0; this->timer.reset (); - // Start a new test, reset statistic info. this->current_yield_method_ = yield; - this->current_multiply_factor_ = multiply; this->total_iteration_ = iteration; return 0; } @@ -143,11 +126,10 @@ Baseline_Test_Options::print_result (void) this->timer.elapsed_time_incr (nsec); ACE_DEBUG ((LM_DEBUG, "Total Time: %d sec %d usec for a " - "total of %d iterations (%d iterations before yield)\n" + "total of %d iterations\n" "Average time: %d nanoseconds.\n", tv.sec (), tv.usec (), this->current_iteration_, - this->current_multiply_factor_, nsec / this->current_iteration_)); } @@ -170,8 +152,7 @@ int Baseline_Test::pre_run_test (Benchmark_Base *bb) { this->current_test_ = (Baseline_Test_Base *) bb; - baseline_options.reset_params (this->current_test_->multiply_factor (), - this->current_test_->iteration (), + baseline_options.reset_params (this->current_test_->iteration (), this->current_test_->yield_method ()); if (baseline_options.test_try_lock ()) { @@ -183,11 +164,6 @@ 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 2206db2dbca..bff290c8d49 100644 --- a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h +++ b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h @@ -8,6 +8,8 @@ #include "Synch_Lib/Benchmark_Base.h" +const unsigned long DEFAULT_ITERATIONS = 1000000; + class ACE_Svc_Export Baseline_Test_Base : public Benchmark_Base { // = TITLE @@ -33,7 +35,6 @@ public: virtual void yield (); // Yield to other thread. - size_t multiply_factor (void); size_t iteration (void); // Access methods. @@ -43,11 +44,8 @@ protected: int yield_method_; // Should we your thr_yield or sleep (0). - size_t multiply_factor_; - // Number of operations before yielding to other threads. - size_t iteration_; - // Total number of operations. <iterations_> <= <multiply_factor_> * n + // Total number of operations. <iterations_> }; class ACE_Svc_Export Baseline_Test_Options @@ -69,7 +67,7 @@ public: int parse_args (int argc, char *argv[]); // Parse and set the Baseline_Test options and flags. - int reset_params (size_t mulply_factor, size_t iteration, int yield); + int reset_params (size_t iteration, int yield); // Reset test parameters for next round. int test_try_lock (void); @@ -80,12 +78,8 @@ public: // Start/stop measuring time. int inc_loop_counter (void); - // Added multiply_factor_ to total_iteration_. // Returns - size_t current_multiply_factor (void); - // Return <multiply_factor_>. - size_t current_iteration (void); // Return <iteration_>. @@ -103,9 +97,6 @@ private: int current_yield_method_; // yield or sleep. - size_t current_multiply_factor_; - // Number loop before performing thread yield. - size_t current_iteration_; // Number of iteration. diff --git a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.i b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.i index 9516fce1aa5..05aa007478d 100644 --- a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.i +++ b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.i @@ -1,12 +1,6 @@ // $Id$ ACE_INLINE size_t -Baseline_Test_Base::multiply_factor (void) -{ - return this->multiply_factor_; -} - -ACE_INLINE size_t Baseline_Test_Base::iteration (void) { return this->iteration_; @@ -25,12 +19,6 @@ Baseline_Test_Options::test_try_lock (void) } ACE_INLINE size_t -Baseline_Test_Options::current_multiply_factor (void) -{ - return this->current_multiply_factor_; -} - -ACE_INLINE size_t Baseline_Test_Options::current_iteration (void) { return this->current_iteration_; @@ -51,6 +39,5 @@ Baseline_Test_Options::stop_inc_timer (void) ACE_INLINE int Baseline_Test_Options::inc_loop_counter (void) { - this->current_iteration_ += this->current_multiply_factor_; - return (this->current_iteration_ < this->total_iteration_); + return (++this->current_iteration_ < this->total_iteration_); } diff --git a/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp b/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp index 57a4c4170ac..2f82c87f56f 100644 --- a/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp +++ b/performance-tests/Synch-Benchmarks/Base_Test/base_test.cpp @@ -32,32 +32,24 @@ Baseline_Base_Test::release () int Baseline_Base_Test::test_acquire_release () { - for (; baseline_options.inc_loop_counter () ; ) - { - this->yield (); - baseline_options.start_inc_timer (); + baseline_options.start_inc_timer (); - for (size_t i=0; i < baseline_options.current_multiply_factor (); i++) - ; + for (; baseline_options.inc_loop_counter () ; ) + ; - baseline_options.stop_inc_timer (); - } + 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 (); + baseline_options.start_inc_timer (); - for (size_t i=0; i < baseline_options.current_multiply_factor (); i++) - ; + for (; baseline_options.inc_loop_counter () ; ) + ; - baseline_options.stop_inc_timer (); - } + baseline_options.stop_inc_timer (); return 0; } diff --git a/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp b/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp index ff96eb43134..3c259500304 100644 --- a/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp +++ b/performance-tests/Synch-Benchmarks/Base_Test/mutex_test.cpp @@ -37,35 +37,26 @@ Baseline_Lock_Test<LOCK>::release () template<class LOCK> int Baseline_Lock_Test<LOCK>::test_acquire_release () { + baseline_options.start_inc_timer (); 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++) - { - this->lock_.acquire (); - this->lock_.release (); - } + this->lock_.acquire (); + this->lock_.release (); + } baseline_options.stop_inc_timer (); - } + return 0; } template<class LOCK> int Baseline_Lock_Test<LOCK>::test_try_lock () { + baseline_options.start_inc_timer (); for (; baseline_options.inc_loop_counter () ; ) - { - this->yield (); - baseline_options.start_inc_timer (); + this->lock_.tryacquire (); // This should always fail. - for (size_t i=0; i < baseline_options.current_multiply_factor (); i++) - this->lock_.tryacquire (); // This should always fail. - - baseline_options.stop_inc_timer (); - } + baseline_options.stop_inc_timer (); return 0; } @@ -84,10 +75,23 @@ typedef Baseline_Lock_Test< ACE_Lock_Adapter<ACE_Thread_Mutex> > Baseline_Adapti ACE_SVC_FACTORY_DECLARE (Baseline_Adaptive_Mutex_Test) ACE_SVC_FACTORY_DEFINE (Baseline_Adaptive_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) + #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class Baseline_Lock_Test<ACE_Thread_Mutex>; template class Baseline_Lock_Test<ACE_Recursive_Thread_Mutex>; +template class ACE_Lock_Adapter<ACE_Thread_Mutex>; +template class Baseline_Lock_Test< ACE_Lock_Adapter<ACE_Thread_Mutex> >; +template class ACE_Lock_Adapter<ACE_Recursive_Thread_Mutex>; +template class Baseline_Lock_Test< ACE_Lock_Adapter<ACE_Recursive_Thread_Mutex> >; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate Baseline_Lock_Test<ACE_Thread_Mutex> #pragma instantiate Baseline_Lock_Test<ACE_Recursive_Thread_Mutex> +#pragma instantiate ACE_Lock_Adapter<ACE_Thread_Mutex> +#pragma instantiate Baseline_Lock_Test< ACE_Lock_Adapter<ACE_Thread_Mutex> > +#pragma instantiate ACE_Lock_Adapter<ACE_Recursive_Thread_Mutex> +#pragma instantiate Baseline_Lock_Test< ACE_Lock_Adapter<ACE_Recursive_Thread_Mutex> > #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/performance-tests/Synch-Benchmarks/Perf_Test/guard_test.cpp b/performance-tests/Synch-Benchmarks/Perf_Test/guard_test.cpp index 8c7b93551b5..8db023236a1 100644 --- a/performance-tests/Synch-Benchmarks/Perf_Test/guard_test.cpp +++ b/performance-tests/Synch-Benchmarks/Perf_Test/guard_test.cpp @@ -88,23 +88,31 @@ Guard_Test::test_guard (int ni) { while (!this->done ()) { - ACE_GUARD (ACE_Thread_Mutex, _ace_mon, Guard_Test::mutex_); + { + ACE_GUARD (ACE_Thread_Mutex, _ace_mon, Guard_Test::mutex_); - performance_test_options.thr_work_count[ni]++; - buffer++; + 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_Mutex_Guard _ace_mon (Guard_Test::mutex_); + { + ACE_THREAD_GUARD (_ace_mon, Guard_Test::mutex_); - performance_test_options.thr_work_count[ni]++; - buffer++; + performance_test_options.thr_work_count[ni]++; + buffer++; + } } } #endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */ diff --git a/performance-tests/Synch-Benchmarks/svc.conf b/performance-tests/Synch-Benchmarks/svc.conf index b5f29d89732..48484b64beb 100644 --- a/performance-tests/Synch-Benchmarks/svc.conf +++ b/performance-tests/Synch-Benchmarks/svc.conf @@ -1,14 +1,15 @@ # Dynamically configure all the tests -#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() "-m 1 -i 30000" -#dynamic Baseline_Adaptive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_Mutex_Test() "-m 3000 -i 3000000" -#dynamic Baseline_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Mutex_Test() "-m 3000 -i 3000000" -#dynamic Baseline_Recursive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Recursive_Mutex_Test() "-m 3000 -i 30000000" +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() "-m 1 -i 30000" +dynamic Baseline_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Mutex_Test() "-i 10000000" +dynamic Baseline_Adaptive_Mutex_Test Service_Object * Base_Test/Base_Test:_make_Baseline_Adaptive_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 Performance_Test Service_Object * Perf_Test/Perf_Test:_make_Performance_Test() "-s 3" -dynamic Guard_Test Service_Object * Perf_Test/Perf_Test:_make_Guard_Test() "" +#dynamic Performance_Test Service_Object * Perf_Test/Perf_Test:_make_Performance_Test() "-s 3" +#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 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() |