summaryrefslogtreecommitdiff
path: root/performance-tests/Synch-Benchmarks
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-18 21:53:59 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-18 21:53:59 +0000
commit2a91408863f872486e855dff4b1342386a8f1df5 (patch)
tree6d929b58335cc7cb15cdef2acc91b01eb276cf7e /performance-tests/Synch-Benchmarks
parentc99b1ef645a3720d5429123df25a01778fd733a7 (diff)
downloadATCD-2a91408863f872486e855dff4b1342386a8f1df5.tar.gz
*** empty log message ***
Diffstat (limited to 'performance-tests/Synch-Benchmarks')
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/Base_Test.dsp19
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp75
-rw-r--r--performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h17
3 files changed, 43 insertions, 68 deletions
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/Base_Test.dsp b/performance-tests/Synch-Benchmarks/Base_Test/Base_Test.dsp
index fdbded5e8c4..5a9e91df41e 100644
--- a/performance-tests/Synch-Benchmarks/Base_Test/Base_Test.dsp
+++ b/performance-tests/Synch-Benchmarks/Base_Test/Base_Test.dsp
@@ -17,13 +17,12 @@ CFG=Base_Test - Win32 Debug
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "Base_Test - Win32 Release" (based on\
- "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "Base_Test - Win32 Debug" (based on\
- "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "Base_Test - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "Base_Test - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
+# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
@@ -45,8 +44,8 @@ RSC=rc.exe
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /I "..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -54,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 ace.lib Synch_Lib.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 ace.lib Synch_Lib.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\ace" /libpath:"..\Synch_Lib"
!ELSEIF "$(CFG)" == "Base_Test - Win32 Debug"
@@ -71,8 +70,8 @@ LINK32=link.exe
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /I "..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -80,7 +79,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 aced.lib Synch_Libd.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Base_Testd.dll" /pdbtype:sept
+# ADD LINK32 aced.lib Synch_Libd.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Base_Testd.dll" /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\Synch_Lib"
!ENDIF
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
index e983d9ffe24..a8079fe061f 100644
--- a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
+++ b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp
@@ -4,13 +4,11 @@
#include "ace/Service_Repository.h"
#include "ace/Synch.h"
#include "ace/Get_Opt.h"
-
-#include "Performance_Test_Options.h"
-#include "Benchmark_Performance.h"
-#include "Performance_Test.h"
+#include "ace/Thread_Manager.h"
+#include "Baseline_Test.h"
#if !defined (__ACE_INLINE__)
-#include "ace/Baseline_Test.i"
+#include "Baseline_Test.i"
#endif /* __ACE_INLINE__ */
ACE_RCSID(Synch_Benchmarks, Benchmark_Baseline, "$Id$")
@@ -41,6 +39,7 @@ int
Baseline_Options::parse_method_args (int argc, char *argv[])
{
ACE_Get_Opt getopt (argc, argv, "t");
+ char c;
while ((c = getopt ()) != -1)
switch (c)
@@ -66,6 +65,7 @@ Baseline_Options::parse_test_args (int argc, char *argv[])
// Start a new test, reset statistic info.
ACE_Get_Opt getopt (argc, argv, "m:i:");
+ char c;
while ((c = getopt ()) != -1)
switch (c)
@@ -102,7 +102,8 @@ Baseline_Options::parse_test_args (int argc, char *argv[])
}
Benchmark_Baseline::Benchmark_Baseline (void)
- : get_lock_ (2),
+ : current_test_ (0),
+ get_lock_ (2),
let_go_lock_ (2)
{
}
@@ -118,13 +119,13 @@ Benchmark_Baseline::init (int argc, char **argv)
int
Benchmark_Baseline::pre_run_test (Benchmark_Base *bb)
{
- Benchmark_Baseline_Test_Base *bp = (Benchmark_Baseline_Test_Base *) bb;
+ this->current_test_ = (Benchmark_Baseline_Test_Base *) bb;
if (baseline_options.test_try_lock ())
{
- // @@ spawn a thread and acquire the lock.
- ACE_Thread_Manager::instance ()->
- spawn (ACE_static_cast (ACE_THR_FUNC, this->svc_run));
+ ACE_Thread_Manager::instance ()->spawn
+ (ACE_THR_FUNC (Benchmark_Baseline::hold_lock),
+ (void *) this);
this->get_lock_.wait ();
// Wait until the lock is held by the spawning thread.
@@ -135,46 +136,7 @@ Benchmark_Baseline::pre_run_test (Benchmark_Base *bb)
int
Benchmark_Baseline::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 (options.sleep_time ());
-
- ACE_DEBUG ((LM_DEBUG, "starting timer\n"));
- options.start_timer ();
-
- // Use Reactor as a timer (which can be interrupted by a signal).
- ACE_Reactor::run_event_loop (timeout);
-
- options.stop_timer ();
- ACE_DEBUG ((LM_DEBUG, "\nstopping timer\n"));
-
- // 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);
-
- int count = options.count ();
- float rate = count / (float (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));
- 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 ();
- options.init ();
- return 0;
+ return -1;
}
int
@@ -184,6 +146,8 @@ Benchmark_Baseline::post_run_test (void)
// Release the lock we hold.
this->let_go_lock_.wait ();
+ ACE_Thread_Manager::instance ()->wait ();
+
return 0;
}
@@ -193,4 +157,13 @@ Benchmark_Baseline::valid_test_object (Benchmark_Base *bb)
return (bb->benchmark_type () == Benchmark_Base::BASELINE);
}
-ACE_SVC_FACTORY_DEFINE (Performance_Test)
+void *
+Benchmark_Baseline::hold_lock (void *arg)
+{
+ Benchmark_Baseline *this_test = (Benchmark_Baseline *) arg;
+
+ ACE_UNUSED_ARG (this_test);
+ return 0;
+}
+
+ACE_SVC_FACTORY_DEFINE (Benchmark_Baseline)
diff --git a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
index 94f61ff3e44..5753646018c 100644
--- a/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
+++ b/performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.h
@@ -4,7 +4,9 @@
#ifndef ACE_BASELINE_TEST_H
#define ACE_BASELINE_TEST_H
-#include "Benchmark_Base.h"
+#include "ace/Profile_Timer.h"
+
+#include "Synch_Lib/Benchmark_Base.h"
class ACE_Svc_Export Benchmark_Baseline_Test_Base : public Benchmark_Base
{
@@ -41,7 +43,7 @@ public:
int test_try_lock (void);
// Return test configuration.
- int add_time (ACE_Profile_Timer::Elapsed_Time &et);
+ int add_time (ACE_Profile_Timer::ACE_Elapsed_Time &et);
// Add the time spent in the current iterations.
int inc_loop_counter (void);
@@ -89,19 +91,20 @@ public:
virtual int post_run_test (void);
virtual int valid_test_object (Benchmark_Base *);
- virtual int svc (void);
- // This method is responsible to hold the lock if we are
- // benchmarking for try_lock method.
+ 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:
+ Benchmark_Baseline_Test_Base *current_test_;
ACE_Barrier get_lock_;
ACE_Barrier let_go_lock_;
};
-ACE_SVC_FACTORY_DECLARE (Baseline_Test)
+ACE_SVC_FACTORY_DECLARE (Benchmark_Baseline)
#if defined (__ACE_INLINE__)
-#include "ace/Baseline_Test.i"
+#include "Baseline_Test.i"
#endif /* __ACE_INLINE__ */
#endif /* ACE_BASELINE_TEST_H */