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 e297f16..b6a3a50 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 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)
index 743a64a..1038fde 100644 (file)
@@ -15,10 +15,13 @@ protected:
   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() {
@@ -27,8 +30,8 @@ protected:
     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;