Blob Blame History Raw
From 6aacbbcbb67cbc45eee780eb9765bd066e299f19 Mon Sep 17 00:00:00 2001
Message-Id: <6aacbbcbb67cbc45eee780eb9765bd066e299f19.1454769807.git.aquini@redhat.com>
From: Grzegorz Ozanski <grzegorz.ozanski@intel.com>
Date: Sat, 26 Sep 2015 18:47:35 +0200
Subject: [PATCH 1/3] Treshold calculation fixed. Use #pragma once instead of
 #ifdef #define #endif Added TC_Memkind_ prefix to
 many_ops_many_iters_many_kinds test Metrics display reformatted. Show
 negative calculated delta if results are actually better than reference
 Increase threads to 144

---
 test/performance/framework.hpp  |  3 ++-
 test/performance/operations.hpp |  4 +++-
 test/performance/perf_tests.cpp | 14 ++++++++------
 test/performance/perf_tests.hpp |  7 ++-----
 4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/test/performance/framework.hpp b/test/performance/framework.hpp
index f306ea0..109c6e6 100644
--- a/test/performance/framework.hpp
+++ b/test/performance/framework.hpp
@@ -22,6 +22,8 @@
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#pragma once
+
 #include <thread>
 #include <vector>
 #include <algorithm> // log2
@@ -33,7 +35,6 @@
 // Malloc, jemalloc, memkind jemalloc and memkind memory operations definitions
 #include "operations.hpp"
 
-#pragma once
 /* Framework for testing memory allocators pefromance */
 namespace performance_tests
 {
diff --git a/test/performance/operations.hpp b/test/performance/operations.hpp
index 8a3c321..dc70b73 100644
--- a/test/performance/operations.hpp
+++ b/test/performance/operations.hpp
@@ -21,12 +21,14 @@
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
+
+#pragma once
+
 #include <malloc.h>
 #include <memkind.h>
 #include "jemalloc/jemalloc.h"
 
 // Malloc, jemalloc, memkind jemalloc and memkind memory operations definitions
-#pragma once
 namespace performance_tests
 {
     using std::vector;
diff --git a/test/performance/perf_tests.cpp b/test/performance/perf_tests.cpp
index cf07177..10fe80b 100644
--- a/test/performance/perf_tests.cpp
+++ b/test/performance/perf_tests.cpp
@@ -24,11 +24,13 @@
 
 #include "perf_tests.hpp"
 #include <iostream>
+#include <cmath>
 #include <gtest/gtest.h>
 
 // Memkind performance tests
 using std::cout;
 using std::endl;
+using std::abs;
 
 // Memkind tests
 class PerformanceTest : public testing::Test
@@ -55,15 +57,15 @@ protected:
         double treshold;
         if (notLessThan)
         {
-            treshold = reference / (1 + Delta);
+            treshold = reference * (1 - delta);
         }
         else
         {
-            treshold = reference * (1 + Delta);
+            treshold = reference * (1 + delta);
         }
-        cout << "Value of '" << info << "' expected to be at " << (notLessThan ? "least '" : "most '")
-             << treshold << "'. Actual='" << value << "', reference='"
-             << reference << "', delta='" << delta << "'." << endl;
+        cout << "Metric: " << info << ". Reference value: " << reference << ". "
+            "Expected: " << (notLessThan ? ">= " : "<= ") << treshold << " (delta = " << delta << ")."
+            "Actual: " << value << " (delta = " << (value - reference) * (notLessThan ? -1.0 : 1.0) / reference << ")." << endl;
         if (notLessThan ? (value >= treshold) : (value <= treshold))
         {
             return true;
@@ -136,7 +138,7 @@ PERF_TEST(PerformanceTest, many_ops_many_iters)
     EXPECT_TRUE(compareMetrics(performanceMetrics, referenceMetrics, Delta));
 }
 
-TEST_F(PerformanceTest, many_ops_many_iters_many_kinds)
+PERF_TEST(PerformanceTest, many_ops_many_iters_many_kinds)
 {
     referenceTest.setupTest_manyOpsManyIters();
     referenceMetrics = referenceTest.runTest({ MEMKIND_DEFAULT, MEMKIND_HBW_PREFERRED });
diff --git a/test/performance/perf_tests.hpp b/test/performance/perf_tests.hpp
index 4e16b7e..30b196f 100644
--- a/test/performance/perf_tests.hpp
+++ b/test/performance/perf_tests.hpp
@@ -22,8 +22,7 @@
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#ifndef  __PERF_TESTS_HPP
-#define  __PERF_TESTS_HPP
+#pragma once
 
 #include "framework.hpp"
 #include "operations.hpp"
@@ -50,7 +49,7 @@ private:
     performance_tests::PerformanceTest *m_test;
     const unsigned m_seed = 1297654;
     const unsigned m_repeats = 5;
-    const unsigned m_threads = 72;
+    const unsigned m_threads = 144;
     const unsigned m_iterations = 100;
 
 public:
@@ -188,5 +187,3 @@ public:
         m_test->setExecutionMode(ExecutionMode::ManyIterations);
     }
 };
-
-#endif // __PERF_TESTS_HPP
-- 
2.5.0