Refactors some of existing cds multi-threaded stress test cases
authorPeizhao Ou <peizhaoo@uci.edu>
Thu, 8 Feb 2018 22:25:33 +0000 (14:25 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Thu, 8 Feb 2018 22:25:33 +0000 (14:25 -0800)
17 files changed:
test/stress/CMakeLists.txt
test/stress/map/CMakeLists.txt
test/stress/map/insdelfind/CMakeLists.txt
test/stress/map/insdelfind/map_insdelfind.cpp
test/stress/map/insdelfind/map_insdelfind.h
test/stress/misc/barrier_driver.cpp
test/stress/misc/deque_driver.cpp
test/stress/misc/mcslock_driver.cpp
test/stress/misc/rwlock_driver.cpp
test/stress/misc/rwqueue_driver.cpp [deleted file]
test/stress/misc/seqlock_driver.cpp
test/stress/misc/spinlock_driver.cpp
test/stress/parallel/parallel_freelist_put_get.cpp
test/stress/parallel/parallel_freelist_put_get_single.cpp
test/stress/queue/CMakeLists.txt
test/stress/sequential/sequential-map/insdelfind/.CMakeLists.txt.swp [new file with mode: 0644]
test/stress/stack/CMakeLists.txt

index a11751daf9d222987acd8466c7ca7dec6cac2500..18398ddfe42c922ee5ce60e2675a522b6129121e 100644 (file)
@@ -22,25 +22,25 @@ include_directories(
 )
 
 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/sequential)
 )
 
 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/sequential)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/parallel)
-#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/misc)
-#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/freelist)
-#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/map)
-#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pqueue)
-#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/queue)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/freelist)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/queue)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stack)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/map)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/misc)
+#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/parallel)
 #add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/set)
 #add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/set)
-#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stack)
+#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pqueue)
 
 add_custom_target( stress-all
     DEPENDS
         stress-sequential-all
 
 add_custom_target( stress-all
     DEPENDS
         stress-sequential-all
-        stress-parallel-all
-        #stress-misc
-        #stress-freelist
-        #stress-map
+        stress-freelist
+        stress-queue
+        stress-stack
+        stress-map
+        stress-misc
+        #stress-parallel-all
         #stress-pqueue
         #stress-pqueue
-        #stress-queue
-        #stress-stack
         #stress-set
 )
 
         #stress-set
 )
 
index 90f8011167b3b3fb10ef96f1443903c7a43cd621..6c0c5ee22857975499eefd34648e09bd98a4e34e 100644 (file)
@@ -1,25 +1,25 @@
 
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCDSUNIT_USE_URCU")
 
 
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCDSUNIT_USE_URCU")
 
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/delodd)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/del3)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/find_string)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdel_func)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdel_string)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdel_item_int)
+#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/delodd)
+#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/del3)
+#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/find_string)
+#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdel_func)
+#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdel_string)
+#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdel_item_int)
 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdelfind)
 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdelfind)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/minmax)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/iter_erase)
+#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/minmax)
+#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/iter_erase)
 
 add_custom_target( stress-map
     DEPENDS
 
 add_custom_target( stress-map
     DEPENDS
-        stress-map-delodd
-        stress-map-del3
-        stress-map-find-string
-        stress-map-insdel-func
-        stress-map-insdel-string
-        stress-map-insdel-item-int
+        #stress-map-delodd
+        #stress-map-del3
+        #stress-map-find-string
+        #stress-map-insdel-func
+        #stress-map-insdel-string
+        #stress-map-insdel-item-int
         stress-map-insdelfind
         stress-map-insdelfind
-        stress-map-minmax
-        stress-map-iter-erase
+        #stress-map-minmax
+        #stress-map-iter-erase
 )
 )
index 31683852091c3c7af60cd729b53bd2dab8374ea3..cb81f9585181d5eaba3ddf5742a799bfe70ac6b4 100644 (file)
@@ -4,20 +4,20 @@ set(MAP_INSDELFIND_RCU stress-map-insdelfind-rcu)
 set(CDSSTRESS_MAP_INSDELFIND_HP_SOURCES
     ../../main.cpp
     map_insdelfind.cpp
 set(CDSSTRESS_MAP_INSDELFIND_HP_SOURCES
     ../../main.cpp
     map_insdelfind.cpp
-    map_insdelfind_cuckoo.cpp
+    #map_insdelfind_cuckoo.cpp
     map_insdelfind_ellentree_hp.cpp
     map_insdelfind_feldman_hashset_hp.cpp
     map_insdelfind_michael_hp.cpp
     map_insdelfind_skip_hp.cpp
     map_insdelfind_split_hp.cpp
     map_insdelfind_ellentree_hp.cpp
     map_insdelfind_feldman_hashset_hp.cpp
     map_insdelfind_michael_hp.cpp
     map_insdelfind_skip_hp.cpp
     map_insdelfind_split_hp.cpp
-    map_insdelfind_std.cpp
-    map_insdelfind_striped.cpp
+    #map_insdelfind_std.cpp
+    #map_insdelfind_striped.cpp
 )
 
 set(CDSSTRESS_MAP_INSDELFIND_RCU_SOURCES
     ../../main.cpp
     map_insdelfind.cpp
 )
 
 set(CDSSTRESS_MAP_INSDELFIND_RCU_SOURCES
     ../../main.cpp
     map_insdelfind.cpp
-    map_insdelfind_bronsonavltree.cpp
+    #map_insdelfind_bronsonavltree.cpp
     map_insdelfind_ellentree_rcu.cpp
     map_insdelfind_feldman_hashset_rcu.cpp
     map_insdelfind_michael_rcu.cpp
     map_insdelfind_ellentree_rcu.cpp
     map_insdelfind_feldman_hashset_rcu.cpp
     map_insdelfind_michael_rcu.cpp
index ea0c970445da33f666c7196fa2ee1378706dafe1..830356e898311db3ec831f00b5ffd462555f8996 100644 (file)
@@ -34,6 +34,7 @@ namespace map {
 
     size_t Map_InsDelFind::s_nMapSize = 500000;
     size_t Map_InsDelFind::s_nThreadCount = 8;
 
     size_t Map_InsDelFind::s_nMapSize = 500000;
     size_t Map_InsDelFind::s_nThreadCount = 8;
+    size_t Map_InsDelFind::s_nPassCount = 100000;
     size_t Map_InsDelFind::s_nMaxLoadFactor = 8;
     unsigned int Map_InsDelFind::s_nInsertPercentage = 5;
     unsigned int Map_InsDelFind::s_nDeletePercentage = 5;
     size_t Map_InsDelFind::s_nMaxLoadFactor = 8;
     unsigned int Map_InsDelFind::s_nInsertPercentage = 5;
     unsigned int Map_InsDelFind::s_nDeletePercentage = 5;
@@ -62,6 +63,10 @@ namespace map {
         if ( s_nThreadCount == 0 )
             s_nThreadCount = std::min( 16u, std::thread::hardware_concurrency() * 2 );
 
         if ( s_nThreadCount == 0 )
             s_nThreadCount = std::min( 16u, std::thread::hardware_concurrency() * 2 );
 
+        s_nPassCount = cfg.get_size_t( "PassCount", s_nPassCount );
+        if ( s_nPassCount == 0 )
+            s_nThreadCount = 1000;
+
         s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor );
         if ( s_nMaxLoadFactor == 0 )
             s_nMaxLoadFactor = 1;
         s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor );
         if ( s_nMaxLoadFactor == 0 )
             s_nMaxLoadFactor = 1;
index dd909dc94f80c72a06527ba44a37b56fd0674b7d..d11b835794bf0739129e221a043f5b9578401610 100644 (file)
@@ -38,6 +38,7 @@ namespace map {
     public:
         static size_t s_nMapSize;           // initial map size
         static size_t s_nThreadCount;       // thread count
     public:
         static size_t s_nMapSize;           // initial map size
         static size_t s_nThreadCount;       // thread count
+        static size_t s_nPassCount;         // pass count
         static size_t s_nMaxLoadFactor;     // maximum load factor
         static unsigned int s_nInsertPercentage;
         static unsigned int s_nDeletePercentage;
         static size_t s_nMaxLoadFactor;     // maximum load factor
         static unsigned int s_nInsertPercentage;
         static unsigned int s_nDeletePercentage;
@@ -127,7 +128,7 @@ namespace map {
                 size_t const nNormalize = size_t(-1) / ( s_nMapSize * 2 );
 
                 size_t nRand = 0;
                 size_t const nNormalize = size_t(-1) / ( s_nMapSize * 2 );
 
                 size_t nRand = 0;
-                while ( !time_elapsed()) {
+                for (size_t pCount; pCount < s_nPassCount; pCount++) {
                     nRand = cds::bitop::RandXorShift( nRand );
                     size_t n = nRand / nNormalize;
                     switch ( s_arrShuffle[i] ) {
                     nRand = cds::bitop::RandXorShift( nRand );
                     size_t n = nRand / nNormalize;
                     switch ( s_arrShuffle[i] ) {
@@ -190,7 +191,7 @@ namespace map {
                 << std::make_pair( "delete_percentage", s_nDeletePercentage )
                 << std::make_pair( "map_size", s_nMapSize );
 
                 << std::make_pair( "delete_percentage", s_nDeletePercentage )
                 << std::make_pair( "map_size", s_nMapSize );
 
-            std::chrono::milliseconds duration = pool.run( std::chrono::seconds( s_nDuration ));
+            std::chrono::milliseconds duration = pool.run();
 
             propout() << std::make_pair( "duration", duration );
 
 
             propout() << std::make_pair( "duration", duration );
 
index 90ca2399489311fe3651d915d7ede2fd74f9c579..e7878fdc3d734d859aa784c27ee20bcc8e60f490 100644 (file)
@@ -14,7 +14,7 @@ namespace {
 
 typedef cds_others::SpinBarrier Barrier;
 
 
 typedef cds_others::SpinBarrier Barrier;
 
-static size_t s_nBarrierThreadCount = 6;
+static size_t s_nBarrierThreadCount = 4;
 static size_t s_nBarrierPassCount = 100000000;
 
 class BarrierTest : public cds_test::stress_fixture {
 static size_t s_nBarrierPassCount = 100000000;
 
 class BarrierTest : public cds_test::stress_fixture {
index 8976c3cdc3eed9a5992b7a5e9012d4f491ea8ad9..7d933ad3f67f7808b8824a81b478f2dabb6e3a5d 100644 (file)
@@ -12,7 +12,7 @@ using namespace std;
 namespace {
 
 typedef cds_others::ChaseLevDeque Deque;
 namespace {
 
 typedef cds_others::ChaseLevDeque Deque;
-static size_t s_nDequeStealerThreadCount = 5;
+static size_t s_nDequeStealerThreadCount = 3;
 static size_t s_nDequeMainPassCount = 100000000;
 
 class ChaseLevDequeTest : public cds_test::stress_fixture {
 static size_t s_nDequeMainPassCount = 100000000;
 
 class ChaseLevDequeTest : public cds_test::stress_fixture {
@@ -32,10 +32,14 @@ protected:
 
   static void StealerThread(int index) {
     while (!terminate_stealer.load(memory_order_relaxed)) {
 
   static void StealerThread(int index) {
     while (!terminate_stealer.load(memory_order_relaxed)) {
-      int res = deque->steal();
-      if (res != EMPTY && res != ABORT) {
-        sums[index] += res;
-        succ_counts[index]++;
+      while (true) {
+        int res = deque->steal();
+        if (res != EMPTY && res != ABORT) {
+          sums[index] += res;
+          succ_counts[index]++;
+        } else {
+          break;
+        }
       }
     }
   }
       }
     }
   }
index ea3370ae611d230f6de7fc95f38b1f0ea8666d8f..9a51077ae6c6df9c9445995adf1f31ed5131e5af 100644 (file)
@@ -12,7 +12,7 @@ using namespace std;
 
 namespace {
 
 
 namespace {
 
-static size_t s_nMCSLockThreadCount = 6;
+static size_t s_nMCSLockThreadCount = 4;
 static size_t s_nMCSLockPassCount = 3000000;
 
 class MCSLockTest : public cds_test::stress_fixture {
 static size_t s_nMCSLockPassCount = 3000000;
 
 class MCSLockTest : public cds_test::stress_fixture {
index fa425c9ed3073f7564bdfd72d64385b4ecafcf5b..71581e4311449927bc77df0acd94fdb99d3af45e 100644 (file)
@@ -12,7 +12,7 @@ using namespace std;
 
 namespace {
 
 
 namespace {
 
-static size_t s_nRWLockThreadCount = 6;
+static size_t s_nRWLockThreadCount = 4;
 static size_t s_nRWLockPassCount = 200000;
 
 typedef cds_others::RWLock RWLock;
 static size_t s_nRWLockPassCount = 200000;
 
 typedef cds_others::RWLock RWLock;
diff --git a/test/stress/misc/rwqueue_driver.cpp b/test/stress/misc/rwqueue_driver.cpp
deleted file mode 100644 (file)
index 4acb50e..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#include <cds/container/rwqueue.h>
-#include <cstdlib>
-#include <ctime>
-#include <iostream>
-#include <string>
-
-using namespace std;
-
-cds::container::RWQueue<int> queue;
-
-void InitQueue() {
-  for (int i = 0; i < 2000000; i++) {
-    queue.enqueue(rand() % 100);
-  }
-}
-
-void ProducerThread() {
-  for (int i = 0; i < 1000000; i++) {
-    for (int j = 0; j < 50; j++) {
-      queue.enqueue(rand() % 100);
-    }
-  }
-}
-
-void ProducerConsumerThread() {
-  unsigned long long sum = 0;
-  int element;
-  for (int i = 0; i < 1000000; i++) {
-    for (int j = 0; j < 50; j++) {
-      if (!queue.empty() && queue.dequeue(element)) {
-        sum += element;
-      }
-      if (j % 2 == 0) {
-        queue.enqueue(rand() % 100);
-      }
-    }
-  }
-}
-
-void ConsumerThread() {
-  int element;
-  unsigned long long sum = 0;
-  int yield_times = 3;
-  while (yield_times > 0) {
-    while (queue.dequeue(element)) {
-      sum += element;
-      yield_times = 3;
-    }
-    std::this_thread::yield();
-    yield_times--;
-  }
-}
-
-int main() {
-  srand(time(NULL));
-  const int kThreads = 6;
-  // Initialize the queue with some elements.
-  InitQueue();
-  cout << "Starting " << kThreads << " threads for RWQueue...\n";
-
-  struct timespec start, finish;
-  double elapsed = 0.0;
-  clock_gettime(CLOCK_MONOTONIC, &start);
-
-  std::thread threads[kThreads];
-  // Producer thread
-  threads[0] = std::thread(ProducerThread);
-  // ProducerConsumer threads
-  for (int i = 1; i < kThreads; i++) {
-    threads[i] = std::thread(ProducerConsumerThread);
-  }
-
-  for (int i = 0; i < kThreads; i++) {
-    threads[i].join();
-  }
-
-  clock_gettime(CLOCK_MONOTONIC, &finish);
-  elapsed = (finish.tv_sec - start.tv_sec);
-  elapsed += (finish.tv_nsec - start.tv_nsec) / 1000000000.0;
-  cout << "All threads finished.\n";
-  cout << "Time: " << elapsed << " seconds\n";
-  return 0;
-}
index c3ee487a286fda5e450803d63135a8576e6b29db..cbe54e1fe21d1422a1247a372e56f7074cda87b7 100644 (file)
@@ -14,7 +14,7 @@ namespace {
 
 typedef cds_others::SeqLock SeqLock;
 
 
 typedef cds_others::SeqLock SeqLock;
 
-static size_t s_nSeqLockReaderWriterThreadCount = 6;
+static size_t s_nSeqLockReaderWriterThreadCount = 4;
 static size_t s_nSeqLockPassCount = 2000000;
 
 class SeqLockTest : public cds_test::stress_fixture {
 static size_t s_nSeqLockPassCount = 2000000;
 
 class SeqLockTest : public cds_test::stress_fixture {
index 94c6c7ce67c636208ee08f1013d7c01548b64643..4a8eb35bbabdea6fd61976dda9da1d4747ccfcb9 100644 (file)
@@ -18,7 +18,7 @@ typedef cds_others::TicketLock TicketLock;
 typedef cds::sync::spin SpinLock;
 typedef cds::sync::reentrant_spin32 Reentrant32;
 typedef cds::sync::reentrant_spin64 Reentrant64;
 typedef cds::sync::spin SpinLock;
 typedef cds::sync::reentrant_spin32 Reentrant32;
 typedef cds::sync::reentrant_spin64 Reentrant64;
-static size_t s_nSpinLockThreadCount = 6;
+static size_t s_nSpinLockThreadCount = 4;
 static size_t s_nSpinLockPassCount = 2500000000;
 static size_t s_nTicketLockPassCount = 4000000;
 
 static size_t s_nSpinLockPassCount = 2500000000;
 static size_t s_nTicketLockPassCount = 4000000;
 
index 04308c996882875432b1bee731bce8c01ee41a53..8e7a5461cdbb09ecfd8ed0623e35bbf2902eea47 100644 (file)
@@ -105,11 +105,13 @@ namespace {
     public:
         static void SetUpTestCase()
         {
     public:
         static void SetUpTestCase()
         {
-            cds_test::config const& cfg = get_config( "SequentialFreeList" );
+            cds_test::config const& cfg = get_config( "ParallelFreeList" );
 
 
+            s_nThreadCount = cfg.get_size_t( "ThreadCount", s_nThreadCount );
             s_nPassCount = cfg.get_size_t( "PassCount", s_nPassCount );
 
             s_nPassCount = cfg.get_size_t( "PassCount", s_nPassCount );
 
-            s_nThreadCount = 1;
+            if ( s_nThreadCount == 0 )
+                s_nThreadCount = 1;
             if ( s_nPassCount == 0 )
                 s_nPassCount = 1000;
         }
             if ( s_nPassCount == 0 )
                 s_nPassCount = 1000;
         }
@@ -127,29 +129,39 @@ namespace {
             for ( auto& i : arr )
                 list.put( &i );
 
             for ( auto& i : arr )
                 list.put( &i );
 
-            std::unique_ptr<Worker<FreeList>> worker(
-                new Worker<FreeList>(pool, list));
-            worker->test();
+            pool.add( new Worker<FreeList>( pool, list ), s_nThreadCount );
+
+            propout() << std::make_pair( "work_thread", s_nThreadCount )
+                      << std::make_pair( "pass_count", s_nPassCount );
+
+            std::chrono::milliseconds duration = pool.run();
+
+            propout() << std::make_pair( "duration", duration );
 
             // analyze result
             size_t nTotal = 0;
             for ( auto const& i : arr )
                 nTotal += i.counter;
 
 
             // analyze result
             size_t nTotal = 0;
             for ( auto const& i : arr )
                 nTotal += i.counter;
 
-            EXPECT_EQ( worker->m_nSuccess, nTotal );
+            size_t nSuccess = 0;
+            for ( size_t threadNo = 0; threadNo < pool.size(); ++threadNo )
+                nSuccess += static_cast<Worker<FreeList>&>( pool.get( threadNo )).m_nSuccess;
+
+            EXPECT_EQ( nSuccess, nTotal );
 
             list.clear( []( typename FreeList::node* ) {} );
         }
     };
 
 
             list.clear( []( typename FreeList::node* ) {} );
         }
     };
 
-    size_t put_get::s_nThreadCount = 1;
+    size_t put_get::s_nThreadCount = 4;
     size_t put_get::s_nPassCount = 100000;
 
     size_t put_get::s_nPassCount = 100000;
 
-#define CDSSTRESS_FREELIST_F(name, freelist_type)                              \
-  TEST_F(put_get, name) {                                                      \
-    std::unique_ptr<freelist_type> fl(new freelist_type());                    \
-    test(*fl);                                                                 \
-  }
+#define CDSSTRESS_FREELIST_F( name, freelist_type ) \
+    TEST_F( put_get, name ) \
+    { \
+        freelist_type fl; \
+        test( fl ); \
+    }
 
     CDSSTRESS_FREELIST_F( FreeList, cds::intrusive::FreeList )
 
 
     CDSSTRESS_FREELIST_F( FreeList, cds::intrusive::FreeList )
 
@@ -166,9 +178,8 @@ namespace {
 
         atomics::atomic<tagged_ptr> tp;
         if ( tp.is_lock_free()) {
 
         atomics::atomic<tagged_ptr> tp;
         if ( tp.is_lock_free()) {
-            using FL = cds::intrusive::TaggedFreeList;
-            std::unique_ptr<FL> fl(new FL());
-            test( *fl );
+            cds::intrusive::TaggedFreeList fl;
+            test( fl );
         }
         else
             std::cout << "Double-width CAS is not supported\n";
         }
         else
             std::cout << "Double-width CAS is not supported\n";
index b8a00e3135723e3da8593a241be056dccdefa40f..dfdc486849d50e52969a09410e4a26a5e21196fd 100644 (file)
@@ -84,6 +84,7 @@ namespace {
                 for ( size_t pass = 0; pass < s_nPassCount; ++pass ) {
                     item_type* p;
                     while ( (p = static_cast<item_type*>( m_FreeList.get())) == nullptr );
                 for ( size_t pass = 0; pass < s_nPassCount; ++pass ) {
                     item_type* p;
                     while ( (p = static_cast<item_type*>( m_FreeList.get())) == nullptr );
+                    p->counter.fetch_add( 1, atomics::memory_order_relaxed );
                     m_FreeList.put( p );
                 }
             }
                     m_FreeList.put( p );
                 }
             }
@@ -94,9 +95,11 @@ namespace {
         {
             cds_test::config const& cfg = get_config( "SequentialFreeList" );
 
         {
             cds_test::config const& cfg = get_config( "SequentialFreeList" );
 
-            s_nPassCount = cfg.get_size_t( "SinglePassCount", s_nPassCount );
+            s_nThreadCount = cfg.get_size_t( "ThreadCount", s_nThreadCount );
+            s_nPassCount = cfg.get_size_t( "PassCount", s_nPassCount );
 
 
-            s_nThreadCount = 1;
+            if ( s_nThreadCount == 0 )
+                s_nThreadCount = 1;
             if ( s_nPassCount == 0 )
                 s_nPassCount = 1000;
         }
             if ( s_nPassCount == 0 )
                 s_nPassCount = 1000;
         }
@@ -113,21 +116,30 @@ namespace {
             list.put( &item );
 
             pool.add( new Worker<FreeList>( pool, list ), s_nThreadCount );
             list.put( &item );
 
             pool.add( new Worker<FreeList>( pool, list ), s_nThreadCount );
-            std::unique_ptr<Worker<FreeList>> worker(
-                new Worker<FreeList>(pool, list));
-            worker->test();
+
+            propout() << std::make_pair( "work_thread", s_nThreadCount )
+                      << std::make_pair( "pass_count", s_nPassCount );
+
+            std::chrono::milliseconds duration = pool.run();
+
+            propout() << std::make_pair( "duration", duration );
+
+            // analyze result
+            EXPECT_EQ( item.counter.load( atomics::memory_order_relaxed ), s_nPassCount * s_nThreadCount );
+
             list.clear( []( typename FreeList::node* ) {} );
         }
     };
 
             list.clear( []( typename FreeList::node* ) {} );
         }
     };
 
-    size_t put_get_single::s_nThreadCount = 1;
+    size_t put_get_single::s_nThreadCount = 4;
     size_t put_get_single::s_nPassCount = 100000;
 
     size_t put_get_single::s_nPassCount = 100000;
 
-#define CDSSTRESS_FREELIST_F(name, freelist_type)                              \
-  TEST_F(put_get_single, name) {                                               \
-    std::unique_ptr<freelist_type> fl(new freelist_type());                    \
-    test(*fl);                                                                 \
-  }
+#define CDSSTRESS_FREELIST_F( name, freelist_type ) \
+    TEST_F( put_get_single, name ) \
+    { \
+        freelist_type fl; \
+        test( fl ); \
+    }
 
     CDSSTRESS_FREELIST_F( FreeList, cds::intrusive::FreeList )
 
 
     CDSSTRESS_FREELIST_F( FreeList, cds::intrusive::FreeList )
 
@@ -144,9 +156,8 @@ namespace {
 
         atomics::atomic<tagged_ptr> tp;
         if ( tp.is_lock_free()) {
 
         atomics::atomic<tagged_ptr> tp;
         if ( tp.is_lock_free()) {
-            using FL = cds::intrusive::TaggedFreeList;
-            std::unique_ptr<FL> fl(new FL());
-            test( *fl );
+            cds::intrusive::TaggedFreeList fl;
+            test( fl );
         }
         else
             std::cout << "Double-width CAS is not supported\n";
         }
         else
             std::cout << "Double-width CAS is not supported\n";
index d4618a46a3923e358c64ebd3539689646887c063..7de13597abb76a98a90438e7983c65d9d8da4d85 100644 (file)
@@ -8,9 +8,9 @@ set(CDSSTRESS_QUEUE_POP_SOURCES
     ../main.cpp
     pop.cpp
 )
     ../main.cpp
     pop.cpp
 )
-add_executable(${CDSSTRESS_QUEUE_POP} ${CDSSTRESS_QUEUE_POP_SOURCES})
-target_link_libraries(${CDSSTRESS_QUEUE_POP} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
-add_test(NAME ${CDSSTRESS_QUEUE_POP} COMMAND ${CDSSTRESS_QUEUE_POP} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    
+#add_executable(${CDSSTRESS_QUEUE_POP} ${CDSSTRESS_QUEUE_POP_SOURCES})
+#target_link_libraries(${CDSSTRESS_QUEUE_POP} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
+#add_test(NAME ${CDSSTRESS_QUEUE_POP} COMMAND ${CDSSTRESS_QUEUE_POP} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    
 
 # stress-queue-push
 set(CDSSTRESS_QUEUE_PUSH stress-queue-push)
 
 # stress-queue-push
 set(CDSSTRESS_QUEUE_PUSH stress-queue-push)
@@ -18,9 +18,9 @@ set(CDSSTRESS_QUEUE_PUSH_SOURCES
     ../main.cpp
     push.cpp
 )
     ../main.cpp
     push.cpp
 )
-add_executable(${CDSSTRESS_QUEUE_PUSH} ${CDSSTRESS_QUEUE_PUSH_SOURCES})
-target_link_libraries(${CDSSTRESS_QUEUE_PUSH} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
-add_test(NAME ${CDSSTRESS_QUEUE_PUSH} COMMAND ${CDSSTRESS_QUEUE_PUSH} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    
+#add_executable(${CDSSTRESS_QUEUE_PUSH} ${CDSSTRESS_QUEUE_PUSH_SOURCES})
+#target_link_libraries(${CDSSTRESS_QUEUE_PUSH} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
+#add_test(NAME ${CDSSTRESS_QUEUE_PUSH} COMMAND ${CDSSTRESS_QUEUE_PUSH} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    
 
 # stress-queue-push-pop
 set(CDSSTRESS_QUEUE_PUSHPOP stress-queue-push-pop)
 
 # stress-queue-push-pop
 set(CDSSTRESS_QUEUE_PUSHPOP stress-queue-push-pop)
@@ -29,9 +29,9 @@ set(CDSSTRESS_QUEUE_PUSHPOP_SOURCES
     push_pop.cpp
     #intrusive_push_pop.cpp    
 )
     push_pop.cpp
     #intrusive_push_pop.cpp    
 )
-add_executable(${CDSSTRESS_QUEUE_PUSHPOP} ${CDSSTRESS_QUEUE_PUSHPOP_SOURCES})
-target_link_libraries(${CDSSTRESS_QUEUE_PUSHPOP} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
-add_test(NAME ${CDSSTRESS_QUEUE_PUSHPOP} COMMAND ${CDSSTRESS_QUEUE_PUSHPOP} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    
+#add_executable(${CDSSTRESS_QUEUE_PUSHPOP} ${CDSSTRESS_QUEUE_PUSHPOP_SOURCES})
+#target_link_libraries(${CDSSTRESS_QUEUE_PUSHPOP} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
+#add_test(NAME ${CDSSTRESS_QUEUE_PUSHPOP} COMMAND ${CDSSTRESS_QUEUE_PUSHPOP} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    
 
 # stress-queue-random
 set(CDSSTRESS_QUEUE_RANDOM stress-queue-random)
 
 # stress-queue-random
 set(CDSSTRESS_QUEUE_RANDOM stress-queue-random)
@@ -60,9 +60,9 @@ set(CDSSTRESS_SPSC_QUEUE_SOURCES
     spsc_queue.cpp
     spsc_buffer.cpp
 )
     spsc_queue.cpp
     spsc_buffer.cpp
 )
-add_executable(${CDSSTRESS_SPSC_QUEUE} ${CDSSTRESS_SPSC_QUEUE_SOURCES})
-target_link_libraries(${CDSSTRESS_SPSC_QUEUE} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
-add_test(NAME ${CDSSTRESS_SPSC_QUEUE} COMMAND ${CDSSTRESS_SPSC_QUEUE} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
+#add_executable(${CDSSTRESS_SPSC_QUEUE} ${CDSSTRESS_SPSC_QUEUE_SOURCES})
+#target_link_libraries(${CDSSTRESS_SPSC_QUEUE} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
+#add_test(NAME ${CDSSTRESS_SPSC_QUEUE} COMMAND ${CDSSTRESS_SPSC_QUEUE} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
 
 
 # stress-queue
 
 
 # stress-queue
diff --git a/test/stress/sequential/sequential-map/insdelfind/.CMakeLists.txt.swp b/test/stress/sequential/sequential-map/insdelfind/.CMakeLists.txt.swp
new file mode 100644 (file)
index 0000000..eb83577
Binary files /dev/null and b/test/stress/sequential/sequential-map/insdelfind/.CMakeLists.txt.swp differ
index bcb46efc7a2b069687dd0d9d453f6743fdc9e15c..753c7f874ed61bf9e05f8849ea7fd4aaaaa326a7 100644 (file)
@@ -4,7 +4,7 @@ set(CDSSTRESS_STACK_SOURCES
     ../main.cpp
     #intrusive_push_pop.cpp
     #intrusive_push_pop_fcstack.cpp
     ../main.cpp
     #intrusive_push_pop.cpp
     #intrusive_push_pop_fcstack.cpp
-    push.cpp
+    #push.cpp
     push_pop.cpp
 )
 
     push_pop.cpp
 )