Fixes RigtorpMPMC test case
authorPeizhao Ou <peizhaoo@uci.edu>
Fri, 26 Jan 2018 19:01:36 +0000 (11:01 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Fri, 26 Jan 2018 19:01:36 +0000 (11:01 -0800)
test/stress/sequential/sequential-misc/common.h
test/stress/sequential/sequential-misc/rigtorp_mpmc_driver.cpp

index e297f166c3729103f1eb3d50cbcdd69ba4dcaee4..b6a3a5059d47352ac074479b35e15bdd975be027 100644 (file)
@@ -7,6 +7,11 @@ typedef unsigned long long ullong;
 
 #define GetConfig(field) s_n##field = cfg.get_size_t(#field, s_n##field)
 
 
 #define GetConfig(field) s_n##field = cfg.get_size_t(#field, s_n##field)
 
+#define GetConfigExpected(field, expected)                                     \
+  s_n##field = cfg.get_size_t(#field, s_n##field);                             \
+  if (s_n##field < (expected)) {                                               \
+    s_n##field = expected;                                                     \
+  }
 
 #ifdef PERFORMANCE
 #define DEBUG(stmt)
 
 #ifdef PERFORMANCE
 #define DEBUG(stmt)
index 743a64aa8455dc54a2fa2b1ba0cfbf60be460052..1038fde8cacaf628d6b1ad173a1ac3e25b5b5c7b 100644 (file)
@@ -15,10 +15,13 @@ protected:
   static size_t s_nRigtorpMPMCQueueCapacity;
 
   static void SetUpTestCase() {
   static size_t s_nRigtorpMPMCQueueCapacity;
 
   static void SetUpTestCase() {
-    cds_test::config const &cfg = get_config("Misc");
-    GetConfig(RigtorpMPMCQueuePassCount);
-    GetConfig(RigtorpMPMCQueueEnqueueStride);
-    GetConfig(RigtorpMPMCQueueCapacity);
+    cds_test::config const &cfg = get_config("SequentialMisc");
+    GetConfigExpected(RigtorpMPMCQueuePassCount, 10000);
+    GetConfigExpected(RigtorpMPMCQueueEnqueueStride, 1024);
+    GetConfigExpected(RigtorpMPMCQueueCapacity, 2048);
+    if (s_nRigtorpMPMCQueueCapacity <= s_nRigtorpMPMCQueueEnqueueStride) {
+      s_nRigtorpMPMCQueueCapacity = 2 * s_nRigtorpMPMCQueueEnqueueStride;
+    }
   }
 
   void test() {
   }
 
   void test() {
@@ -27,8 +30,8 @@ protected:
     size_t pop_sum = 0;
 
     while (nNo < s_nRigtorpMPMCQueuePassCount) {
     size_t pop_sum = 0;
 
     while (nNo < s_nRigtorpMPMCQueuePassCount) {
-      size_t curr_push_count =
-          std::min(s_nRigtorpMPMCQueuePassCount - nNo, s_nRigtorpMPMCQueueEnqueueStride);
+      size_t curr_push_count = std::min(s_nRigtorpMPMCQueuePassCount - nNo,
+                                        s_nRigtorpMPMCQueueEnqueueStride);
       for (size_t i = 0; i < curr_push_count; i++) {
         q.push(nNo);
         ++nNo;
       for (size_t i = 0; i < curr_push_count; i++) {
         q.push(nNo);
         ++nNo;