diff options
4 files changed, 18 insertions, 4 deletions
diff --git a/performance-tests/Synch-Benchmarks/Benchmark_Base.cpp b/performance-tests/Synch-Benchmarks/Benchmark_Base.cpp index 7120c7824b3..2602b4553be 100644 --- a/performance-tests/Synch-Benchmarks/Benchmark_Base.cpp +++ b/performance-tests/Synch-Benchmarks/Benchmark_Base.cpp @@ -54,7 +54,7 @@ Benchmark_Method_Base::exec (ACE_Service_Repository_Iterator *sri) ACE_DEBUG ((LM_DEBUG, "\nstarting up %s\n", sr->name ())); - int notused = this->pre_run_test () == 0 && this->run_test () == 0 && + int notused = this->pre_run_test (bp) == 0 && this->run_test () == 0 && this->post_run_test () == 0; notused = notused; } diff --git a/performance-tests/Synch-Benchmarks/Benchmark_Base.h b/performance-tests/Synch-Benchmarks/Benchmark_Base.h index 21fe375e80a..7e10d2328ff 100644 --- a/performance-tests/Synch-Benchmarks/Benchmark_Base.h +++ b/performance-tests/Synch-Benchmarks/Benchmark_Base.h @@ -83,7 +83,7 @@ public: int exec (ACE_Service_Repository_Iterator *sri); // Run the test and advanced the service repository iterator - virtual int pre_run_test (void) = 0; + 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. diff --git a/performance-tests/Synch-Benchmarks/Performance_Test.cpp b/performance-tests/Synch-Benchmarks/Performance_Test.cpp index eb947f5a376..984db66b4ea 100644 --- a/performance-tests/Synch-Benchmarks/Performance_Test.cpp +++ b/performance-tests/Synch-Benchmarks/Performance_Test.cpp @@ -24,8 +24,22 @@ Performance_Test::init (int argc, char **argv) } int -Performance_Test::pre_run_test (void) +Performance_Test::pre_run_test (Benchmark_Base *bb) { + this->orig_n_lwps_ = ACE_Thread::getconcurrency (); + this->n_lwps_ = 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 + (options.thr_count (), ACE_THR_FUNC (bp->svc_run), + (void *) bp, options.t_flags () | THR_SUSPENDED) == -1) + ACE_ERROR ((LM_ERROR, "%p\n%a", "couldn't spawn threads", 1)); return 0; } diff --git a/performance-tests/Synch-Benchmarks/Performance_Test.h b/performance-tests/Synch-Benchmarks/Performance_Test.h index 641e7f4b12f..9e293ec43d6 100644 --- a/performance-tests/Synch-Benchmarks/Performance_Test.h +++ b/performance-tests/Synch-Benchmarks/Performance_Test.h @@ -11,7 +11,7 @@ class ACE_Svc_Export Performance_Test : public Benchmark_Method_Base public: Performance_Test (void); int init (int argc, char **argv); - virtual int pre_run_test (void); + 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 *); |