summaryrefslogtreecommitdiff
path: root/performance-tests
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-03-18 20:04:31 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-03-18 20:04:31 +0000
commit02e487d0872edf6060a1c341ee2e48a07d49507b (patch)
tree318198ca405d49d65d6ac7bc4e7fa4f9090e1857 /performance-tests
parent1b0253bb15a356fca5859cc4788ef9e4c67e6b05 (diff)
downloadATCD-02e487d0872edf6060a1c341ee2e48a07d49507b.tar.gz
With MSVC 5.0, do something in the empty iteration because otherwise it gets completely optimized away
Diffstat (limited to 'performance-tests')
-rw-r--r--performance-tests/Misc/basic_func.cpp12
-rw-r--r--performance-tests/Misc/basic_func.h25
-rw-r--r--performance-tests/Misc/basic_perf.cpp5
3 files changed, 39 insertions, 3 deletions
diff --git a/performance-tests/Misc/basic_func.cpp b/performance-tests/Misc/basic_func.cpp
index c9943b8769e..1886a6dfbad 100644
--- a/performance-tests/Misc/basic_func.cpp
+++ b/performance-tests/Misc/basic_func.cpp
@@ -2,33 +2,45 @@
#include "basic_func.h"
+int A, B, C, D, E, F;
+
void
func ()
{
+ DO_SOMETHING
}
void
Foo::func ()
{
+ DO_SOMETHING
+}
+
+
+Foo_v::~Foo_v ()
+{
}
void
Foo_v::func ()
{
+ DO_SOMETHING
}
void
Foo_v::v_func ()
{
+ DO_SOMETHING
}
void
Foo_d_v::v_func ()
{
+ DO_SOMETHING
}
diff --git a/performance-tests/Misc/basic_func.h b/performance-tests/Misc/basic_func.h
index e687bb2cc76..84dba6d208f 100644
--- a/performance-tests/Misc/basic_func.h
+++ b/performance-tests/Misc/basic_func.h
@@ -16,6 +16,26 @@
//
// ============================================================================
+#include "ace/ACE.h"
+
+extern int A,B,C,D,E,F;
+
+// If your compiler optimizes away Empty_Iteration_Test::run (), then
+// #defining ACE_HAS_OPTIMIZED_NULL_FUNCTIONS may help produce more
+// reasonable numbers.
+#if defined (_MSC_VER)
+ // MSVC 5.0 needs it . . .
+# define ACE_HAS_OPTIMIZED_NULL_FUNCTIONS
+#endif /* _MSC_VER */
+
+#if defined (ACE_HAS_OPTIMIZED_NULL_FUNCTIONS)
+# define EXPR(R,A,B,C,D) (R=(A*B + C*D))
+# define DO_SOMETHING EXPR(A,B,EXPR(F,A,E,C,B),EXPR(B,F,A,D,E),EXPR(E,B,F,A,C));
+#else /* ACE_HAS_OPTIMIZED_NULL_FUNCTIONS */
+# define DO_SOMETHING
+#endif /* ACE_HAS_OPTIMIZED_NULL_FUNCTIONS */
+
+
// An external (global) function.
void func ();
@@ -24,7 +44,7 @@ void func ();
class Foo
{
public:
- void inline_func () {}
+ void inline_func () { DO_SOMETHING }
void func ();
};
@@ -33,7 +53,8 @@ class Foo
class Foo_v
{
public:
- void inline_func () {}
+ virtual ~Foo_v ();
+ void inline_func () { DO_SOMETHING }
void func ();
virtual void v_func ();
};
diff --git a/performance-tests/Misc/basic_perf.cpp b/performance-tests/Misc/basic_perf.cpp
index c789be3ce46..92e04621c84 100644
--- a/performance-tests/Misc/basic_perf.cpp
+++ b/performance-tests/Misc/basic_perf.cpp
@@ -37,6 +37,7 @@ inline
void
inline_func ()
{
+ DO_SOMETHING
}
@@ -169,7 +170,9 @@ Empty_Iteration_Test::run (void)
this->start_timing ();
for (u_int i = 0; i < iterations; ++i)
- continue;
+ {
+ DO_SOMETHING
+ }
this->stop_timing ();
}