Adjusts pass counts for some sequential map test cases
authorPeizhao Ou <peizhaoo@uci.edu>
Wed, 17 Jan 2018 01:00:57 +0000 (17:00 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Wed, 17 Jan 2018 01:00:57 +0000 (17:00 -0800)
14 files changed:
test/stress/sequential/sequential-map/find_string/map_find_string.cpp
test/stress/sequential/sequential-map/find_string/map_find_string.h
test/stress/sequential/sequential-map/find_string/map_find_string_bronsonavltree.cpp
test/stress/sequential/sequential-map/find_string/map_find_string_ellentree.cpp
test/stress/sequential/sequential-map/find_string/map_find_string_feldman_hashset.cpp
test/stress/sequential/sequential-map/find_string/map_find_string_michael.cpp
test/stress/sequential/sequential-map/find_string/map_find_string_skip.cpp
test/stress/sequential/sequential-map/insdel_string/map_insdel_string.cpp
test/stress/sequential/sequential-map/insdel_string/map_insdel_string.h
test/stress/sequential/sequential-map/insdel_string/map_insdel_string_bronsonavltree.cpp
test/stress/sequential/sequential-map/insdel_string/map_insdel_string_ellentree.cpp
test/stress/sequential/sequential-map/insdel_string/map_insdel_string_feldman_hashset.cpp
test/stress/sequential/sequential-map/insdel_string/map_insdel_string_michael.cpp
test/stress/sequential/sequential-map/insdel_string/map_insdel_string_skip.cpp

index 7da0e8dd335a1a65dc12738f93aa583d6839993b..b4c4c3753baa377af6c9816ee4a89144a5d230c5 100644 (file)
@@ -38,6 +38,11 @@ namespace map {
     size_t Map_find_string::s_nMaxLoadFactor = 8;
     size_t Map_find_string::s_nPercentExists = 50;
     size_t Map_find_string::s_nPassCount = 2;
+    size_t Map_find_string::s_nFeldmanPassCount = 100;
+    size_t Map_find_string::s_nBronsonAVLTreeMapPassCount = 100;
+    size_t Map_find_string::s_nEllenBinTreeMapPassCount = 100;
+    size_t Map_find_string::s_nMichaelMapPassCount = 100;
+    size_t Map_find_string::s_nSkipListMapPassCount = 100;
 
     size_t Map_find_string::s_nCuckooInitialSize = 1024;
     size_t Map_find_string::s_nCuckooProbesetSize = 16;
@@ -53,45 +58,80 @@ namespace map {
 
     void Map_find_string::setup_test_case()
     {
-        cds_test::config const& cfg = get_config( "map_find_string" );
-
-        s_nMapSize = cfg.get_size_t( "MapSize", s_nMapSize );
-        if ( s_nMapSize < 1000 )
-            s_nMapSize = 1000;
-
-        s_nThreadCount = cfg.get_size_t( "ThreadCount", s_nThreadCount );
-        if ( s_nThreadCount == 0 )
-            s_nThreadCount = 1;
-
-        s_nPercentExists = cfg.get_size_t( "PercentExists", s_nPercentExists );
-        if ( s_nPercentExists > 100 )
-            s_nPercentExists = 100;
-        else if ( s_nPercentExists < 1 )
-            s_nPercentExists = 1;
-
-        s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor );
-        if ( s_nMaxLoadFactor == 0 )
-            s_nMaxLoadFactor = 1;
-
-        s_nCuckooInitialSize = cfg.get_size_t( "CuckooInitialSize", s_nCuckooInitialSize );
-        if ( s_nCuckooInitialSize < 256 )
-            s_nCuckooInitialSize = 256;
-
-        s_nCuckooProbesetSize = cfg.get_size_t( "CuckooProbesetSize", s_nCuckooProbesetSize );
-        if ( s_nCuckooProbesetSize < 8 )
-            s_nCuckooProbesetSize = 8;
-
-        s_nCuckooProbesetThreshold = cfg.get_size_t( "CuckooProbesetThreshold", s_nCuckooProbesetThreshold );
-
-        s_nFeldmanMap_HeadBits = cfg.get_size_t( "FeldmanMapHeadBits", s_nFeldmanMap_HeadBits );
-        if ( s_nFeldmanMap_HeadBits == 0 )
-            s_nFeldmanMap_HeadBits = 2;
-
-        s_nFeldmanMap_ArrayBits = cfg.get_size_t( "FeldmanMapArrayBits", s_nFeldmanMap_ArrayBits );
-        if ( s_nFeldmanMap_ArrayBits == 0 )
-            s_nFeldmanMap_ArrayBits = 2;
-
-        s_arrString = load_dictionary();
+      cds_test::config const &cfg =
+          get_config("sequential_real_map_find_string");
+
+      s_nMapSize = cfg.get_size_t("MapSize", s_nMapSize);
+      if (s_nMapSize < 1000)
+        s_nMapSize = 1000;
+
+      s_nThreadCount = cfg.get_size_t("ThreadCount", s_nThreadCount);
+      if (s_nThreadCount == 0)
+        s_nThreadCount = 1;
+
+      s_nPassCount = cfg.get_size_t("PassCount", s_nPassCount);
+      if (s_nPassCount == 0)
+        s_nPassCount = 100;
+
+      s_nFeldmanPassCount =
+          cfg.get_size_t("FeldmanPassCount", s_nFeldmanPassCount);
+      if (s_nFeldmanPassCount == 0)
+        s_nFeldmanPassCount = 500;
+
+      s_nBronsonAVLTreeMapPassCount = cfg.get_size_t(
+          "BronsonAVLTreeMapPassCount", s_nBronsonAVLTreeMapPassCount);
+      if (s_nBronsonAVLTreeMapPassCount == 0)
+        s_nBronsonAVLTreeMapPassCount = 500;
+
+      s_nEllenBinTreeMapPassCount = cfg.get_size_t("EllenBinTreeMapPassCount",
+                                                   s_nEllenBinTreeMapPassCount);
+      if (s_nEllenBinTreeMapPassCount == 0)
+        s_nEllenBinTreeMapPassCount = 500;
+
+      s_nMichaelMapPassCount =
+          cfg.get_size_t("MichaelMapPassCount", s_nMichaelMapPassCount);
+      if (s_nMichaelMapPassCount == 0)
+        s_nMichaelMapPassCount = 500;
+
+      s_nSkipListMapPassCount =
+          cfg.get_size_t("SkipListMapPassCount", s_nSkipListMapPassCount);
+      if (s_nSkipListMapPassCount == 0)
+        s_nSkipListMapPassCount = 500;
+
+      s_nPercentExists = cfg.get_size_t("PercentExists", s_nPercentExists);
+      if (s_nPercentExists > 100)
+        s_nPercentExists = 100;
+      else if (s_nPercentExists < 1)
+        s_nPercentExists = 1;
+
+      s_nMaxLoadFactor = cfg.get_size_t("MaxLoadFactor", s_nMaxLoadFactor);
+      if (s_nMaxLoadFactor == 0)
+        s_nMaxLoadFactor = 1;
+
+      s_nCuckooInitialSize =
+          cfg.get_size_t("CuckooInitialSize", s_nCuckooInitialSize);
+      if (s_nCuckooInitialSize < 256)
+        s_nCuckooInitialSize = 256;
+
+      s_nCuckooProbesetSize =
+          cfg.get_size_t("CuckooProbesetSize", s_nCuckooProbesetSize);
+      if (s_nCuckooProbesetSize < 8)
+        s_nCuckooProbesetSize = 8;
+
+      s_nCuckooProbesetThreshold =
+          cfg.get_size_t("CuckooProbesetThreshold", s_nCuckooProbesetThreshold);
+
+      s_nFeldmanMap_HeadBits =
+          cfg.get_size_t("FeldmanMapHeadBits", s_nFeldmanMap_HeadBits);
+      if (s_nFeldmanMap_HeadBits == 0)
+        s_nFeldmanMap_HeadBits = 2;
+
+      s_nFeldmanMap_ArrayBits =
+          cfg.get_size_t("FeldmanMapArrayBits", s_nFeldmanMap_ArrayBits);
+      if (s_nFeldmanMap_ArrayBits == 0)
+        s_nFeldmanMap_ArrayBits = 2;
+
+      s_arrString = load_dictionary();
     }
 
     void Map_find_string::TearDownTestCase()
index 5479e3b854b541b4923a21251aefbf7cb3fc3cce..b6068a3b566034c2b1a5bf755a2c6fcaca042464 100644 (file)
@@ -39,6 +39,12 @@ namespace map {
         static size_t s_nMapSize;           // map size (count of searching item)
         static size_t s_nPercentExists;     // percent of existing keys in searching sequence
         static size_t s_nPassCount;
+        static size_t s_nBronsonAVLTreeMapPassCount;
+        static size_t s_nEllenBinTreeMapPassCount;
+        static size_t s_nFeldmanPassCount;
+        static size_t s_nMichaelMapPassCount;
+        static size_t s_nSkipListMapPassCount;
+
         static size_t s_nMaxLoadFactor;     // maximum load factor
 
         static size_t s_nCuckooInitialSize;         // initial size for CuckooMap
@@ -117,43 +123,22 @@ namespace map {
                 size_t const nPassCount = s_nPassCount;
 
                 Map& rMap = m_Map;
-                for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
-                    if ( id() & 1 ) {
-                        auto itEnd = s_Data.cend();
-                        for ( auto it = s_Data.cbegin(); it != itEnd; ++it ) {
-                            auto bFound = rMap.contains( *(it->pKey));
-                            if ( it->bExists ) {
-                                if ( check_result(bFound, rMap))
-                                    ++m_KeyExists.nSuccess;
-                                else
-                                    ++m_KeyExists.nFailed;
-                            }
-                            else {
-                                if ( check_result(bFound, rMap))
-                                    ++m_KeyNotExists.nFailed;
-                                else
-                                    ++m_KeyNotExists.nSuccess;
-                            }
-                        }
-                    }
-                    else {
-                        auto itEnd = s_Data.crend();
-                        for ( auto it = s_Data.crbegin(); it != itEnd; ++it ) {
-                            auto bFound = rMap.contains( *(it->pKey));
-                            if ( it->bExists ) {
-                                if ( check_result(bFound, rMap))
-                                    ++m_KeyExists.nSuccess;
-                                else
-                                    ++m_KeyExists.nFailed;
-                            }
-                            else {
-                                if ( check_result( bFound, rMap ))
-                                    ++m_KeyNotExists.nFailed;
-                                else
-                                    ++m_KeyNotExists.nSuccess;
-                            }
-                        }
+                for (size_t nPass = 0; nPass < nPassCount; ++nPass) {
+                  auto itEnd = s_Data.cend();
+                  for (auto it = s_Data.cbegin(); it != itEnd; ++it) {
+                    auto bFound = rMap.contains(*(it->pKey));
+                    if (it->bExists) {
+                      if (check_result(bFound, rMap))
+                        ++m_KeyExists.nSuccess;
+                      else
+                        ++m_KeyExists.nFailed;
+                    } else {
+                      if (check_result(bFound, rMap))
+                        ++m_KeyNotExists.nFailed;
+                      else
+                        ++m_KeyNotExists.nSuccess;
                     }
+                  }
                 }
             }
         };
@@ -175,49 +160,12 @@ namespace map {
                 }
             }
 
-            propout() << std::make_pair( "thread_count", s_nThreadCount )
-                << std::make_pair( "map_size", s_nMapSize )
-                << std::make_pair( "percent_exist", s_nPercentExists )
-                << std::make_pair( "pass_count", s_nPassCount );
-
-            cds_test::thread_pool& pool = get_pool();
-            pool.add( new worker( pool, testMap ), s_nThreadCount );
-
-            std::chrono::milliseconds duration = pool.run();
-
-            propout() << std::make_pair( "duration", duration );
-
-            size_t nExistSuccess = 0;
-            size_t nExistFailed = 0;
-            size_t nMissingSuccess = 0;
-            size_t nMissingFailed = 0;
-
-            // Postcondition: the number of success searching == the number of map item
-            for ( size_t i = 0; i < pool.size(); ++i ) {
-                worker& w = static_cast<worker&>(pool.get( i ));
-                nExistSuccess += w.m_KeyExists.nSuccess;
-                nExistFailed += w.m_KeyExists.nFailed;
-                nMissingSuccess += w.m_KeyNotExists.nSuccess;
-                nMissingFailed += w.m_KeyNotExists.nFailed;
-
-                EXPECT_EQ( w.m_KeyExists.nSuccess, s_nMapSize * s_nPassCount ) << "thread " << i;
-                EXPECT_EQ( w.m_KeyExists.nFailed, 0u ) << "thread " << i;
-                EXPECT_EQ( w.m_KeyNotExists.nSuccess, (s_Data.size() - s_nMapSize) * s_nPassCount ) << "thread " << i;
-                EXPECT_EQ( w.m_KeyNotExists.nFailed, 0u ) << "thread " << i;
-            }
-
-            propout()
-                << std::make_pair( "exist_found", nExistSuccess )
-                << std::make_pair( "exist_not_found", nExistFailed )  // must = 0
-                << std::make_pair( "missing_not_found", nMissingSuccess )
-                << std::make_pair( "missing_found", nMissingFailed );  // must = 0
-
-            check_before_cleanup( testMap );
+            cds_test::thread_pool &pool = get_pool();
+            std::unique_ptr<worker> worker_thread(new worker(pool, testMap));
+            worker_thread->test();
 
             testMap.clear();
-            additional_check( testMap );
-            print_stat( propout(), testMap );
-            additional_cleanup( testMap );
+            additional_cleanup(testMap);
         }
 
         template <class Map>
@@ -228,6 +176,42 @@ namespace map {
             Map testMap( *this );
             test( testMap );
         }
+
+        template <class Map>
+        void run_bronson_avl_tree() {
+          Map_find_string::s_nPassCount =
+              Map_find_string::s_nBronsonAVLTreeMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_ellen_bin_tree() {
+          Map_find_string::s_nPassCount =
+              Map_find_string::s_nEllenBinTreeMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_feldman() {
+          Map_find_string::s_nPassCount =
+              Map_find_string::s_nFeldmanPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_michael() {
+          Map_find_string::s_nPassCount =
+              Map_find_string::s_nMichaelMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_skip_list() {
+          Map_find_string::s_nPassCount =
+              Map_find_string::s_nSkipListMapPassCount;
+          run_test<Map>();
+        }
+
     };
 
     class Map_find_string_stdhash: public Map_find_string
index fe18050f9a81c1712e11a6cfadc6b1c4764ad5f8..4f97a46a591affdb86c3a66eab40c826667ab449 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_BronsonAVLTreeMap( Map_find_string, run_test, std::string, Map_find_string::value_type )
+    CDSSTRESS_BronsonAVLTreeMap( Map_find_string, run_bronson_avl_tree, std::string, Map_find_string::value_type )
 
 } // namespace map
index 9cd3da26fa15e49271ba8362deddb5eeefd0b347..7b1453d572fdf94891c54c2a16e4f6997c1bedf2 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_EllenBinTreeMap( Map_find_string, run_test, std::string, Map_find_string::value_type )
+    CDSSTRESS_EllenBinTreeMap( Map_find_string, run_ellen_bin_tree, std::string, Map_find_string::value_type )
 
 } // namespace map
index 84b370e38edc0ba9c04bb32b76fcdf14b269352e..dcb0c70e142602c2b35c6ef95b332b26d65e3648 100644 (file)
 
 namespace map {
 
-    CDSSTRESS_FeldmanHashMap_stdhash( Map_find_string_stdhash, run_test, std::string, Map_find_string::value_type )
+    CDSSTRESS_FeldmanHashMap_stdhash( Map_find_string_stdhash, run_feldman, std::string, Map_find_string::value_type )
 #if CDS_BUILD_BITS == 64
-    CDSSTRESS_FeldmanHashMap_city64(  Map_find_string_city64,  run_test, std::string, Map_find_string::value_type )
-    CDSSTRESS_FeldmanHashMap_city128( Map_find_string_city128, run_test, std::string, Map_find_string::value_type )
+    CDSSTRESS_FeldmanHashMap_city64(  Map_find_string_city64,  run_feldman, std::string, Map_find_string::value_type )
+    CDSSTRESS_FeldmanHashMap_city128( Map_find_string_city128, run_feldman, std::string, Map_find_string::value_type )
 #endif
 
 } // namespace map
index b649f374258d32a8f768f23462831066013d0b51..e6325c2a745ccdc6af3b4426be5b1889eca03806 100644 (file)
@@ -33,7 +33,7 @@
 
 namespace map {
 
-    CDSSTRESS_MichaelMap(      Map_find_string_LF, run_test, std::string, Map_find_string::value_type )
-    CDSSTRESS_MichaelMap_nogc( Map_find_string_LF, run_test, std::string, Map_find_string::value_type )
+    CDSSTRESS_MichaelMap(      Map_find_string_LF, run_michael, std::string, Map_find_string::value_type )
+    CDSSTRESS_MichaelMap_nogc( Map_find_string_LF, run_michael, std::string, Map_find_string::value_type )
 
 } // namespace map
index e790568a8096f643d595bd02978b8cb835997b22..0e947bf0f58786913919a08cdbd56b964f3788ce 100644 (file)
@@ -33,7 +33,7 @@
 
 namespace map {
 
-    CDSSTRESS_SkipListMap(      Map_find_string, run_test, std::string, Map_find_string::value_type )
-    CDSSTRESS_SkipListMap_nogc( Map_find_string, run_test, std::string, Map_find_string::value_type )
+    CDSSTRESS_SkipListMap(      Map_find_string, run_skip_list, std::string, Map_find_string::value_type )
+    CDSSTRESS_SkipListMap_nogc( Map_find_string, run_skip_list, std::string, Map_find_string::value_type )
 
 } // namespace map
index e1a422efebc248ed35b35d72133fa2386e0fc8e2..8b55be5ddf6e1d46065740ab8459865a89458ffa 100644 (file)
@@ -37,6 +37,12 @@ namespace map {
     size_t Map_InsDel_string::s_nInsertThreadCount = 4;  // count of insertion thread
     size_t Map_InsDel_string::s_nDeleteThreadCount = 4;  // count of deletion thread
     size_t Map_InsDel_string::s_nThreadPassCount = 4;    // pass count for each thread
+    size_t Map_InsDel_string::s_nFeldmanPassCount = 100;
+    size_t Map_InsDel_string::s_nBronsonAVLTreeMapPassCount = 100;
+    size_t Map_InsDel_string::s_nEllenBinTreeMapPassCount = 100;
+    size_t Map_InsDel_string::s_nMichaelMapPassCount = 100;
+    size_t Map_InsDel_string::s_nSkipListMapPassCount = 100;
+
     size_t Map_InsDel_string::s_nMaxLoadFactor = 8;      // maximum load factor
 
     size_t Map_InsDel_string::s_nCuckooInitialSize = 1024;// initial size for CuckooSet
@@ -51,7 +57,7 @@ namespace map {
 
     void Map_InsDel_string::setup_test_case()
     {
-        cds_test::config const& cfg = get_config( "map_insdel_string" );
+        cds_test::config const& cfg = get_config( "sequential_real_map_insdel_string" );
 
         s_nMapSize = cfg.get_size_t( "MapSize", s_nMapSize );
         if ( s_nMapSize < 1000 )
@@ -69,6 +75,31 @@ namespace map {
         if ( s_nThreadPassCount == 0 )
             s_nThreadPassCount = 4;
 
+        s_nFeldmanPassCount =
+            cfg.get_size_t("FeldmanPassCount", s_nFeldmanPassCount);
+        if (s_nFeldmanPassCount == 0)
+          s_nFeldmanPassCount = 500;
+
+        s_nBronsonAVLTreeMapPassCount = cfg.get_size_t(
+            "BronsonAVLTreeMapPassCount", s_nBronsonAVLTreeMapPassCount);
+        if (s_nBronsonAVLTreeMapPassCount == 0)
+          s_nBronsonAVLTreeMapPassCount = 500;
+
+        s_nEllenBinTreeMapPassCount = cfg.get_size_t(
+            "EllenBinTreeMapPassCount", s_nEllenBinTreeMapPassCount);
+        if (s_nEllenBinTreeMapPassCount == 0)
+          s_nEllenBinTreeMapPassCount = 500;
+
+        s_nMichaelMapPassCount =
+            cfg.get_size_t("MichaelMapPassCount", s_nMichaelMapPassCount);
+        if (s_nMichaelMapPassCount == 0)
+          s_nMichaelMapPassCount = 500;
+
+        s_nSkipListMapPassCount =
+            cfg.get_size_t("SkipListMapPassCount", s_nSkipListMapPassCount);
+        if (s_nSkipListMapPassCount == 0)
+          s_nSkipListMapPassCount = 500;
+
         s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor );
         if ( s_nMaxLoadFactor == 0 )
             s_nMaxLoadFactor = 1;
index 35cf825546270e213841caf05e65859b1c3a5831..dcd6d4ffb5ea48ca4a5aa66b5c110fa894601f1b 100644 (file)
@@ -41,6 +41,12 @@ namespace map {
         static size_t s_nInsertThreadCount; // count of insertion thread
         static size_t s_nDeleteThreadCount; // count of deletion thread
         static size_t s_nThreadPassCount;   // pass count for each thread
+        static size_t s_nBronsonAVLTreeMapPassCount;
+        static size_t s_nEllenBinTreeMapPassCount;
+        static size_t s_nFeldmanPassCount;
+        static size_t s_nMichaelMapPassCount;
+        static size_t s_nSkipListMapPassCount;
+
         static size_t s_nMaxLoadFactor;     // maximum load factor
 
         static size_t s_nCuckooInitialSize;         // initial size for CuckooMap
@@ -99,25 +105,12 @@ namespace map {
             {
                 Map& rMap = m_Map;
 
-                if ( id() & 1 ) {
-                    for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) {
-                        for ( auto it = s_arrKeys.cbegin(), itEnd = s_arrKeys.cend(); it != itEnd; ++it ) {
-                            if ( rMap.insert( *it, 0 ))
-                                ++m_nInsertSuccess;
-                            else
-                                ++m_nInsertFailed;
-                        }
-                    }
-                }
-                else {
-                    for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) {
-                        for ( auto it = s_arrKeys.crbegin(), itEnd = s_arrKeys.crend(); it != itEnd; ++it ) {
-                            if ( rMap.insert( *it, 1 ))
-                                ++m_nInsertSuccess;
-                            else
-                                ++m_nInsertFailed;
-                        }
-                    }
+                for (auto it = s_arrKeys.cbegin(), itEnd = s_arrKeys.cend();
+                     it != itEnd; ++it) {
+                  if (rMap.insert(*it, 0))
+                    ++m_nInsertSuccess;
+                  else
+                    ++m_nInsertFailed;
                 }
             }
         };
@@ -152,25 +145,12 @@ namespace map {
             {
                 Map& rMap = m_Map;
 
-                if ( id() & 1 ) {
-                    for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) {
-                        for ( auto it = s_arrKeys.cbegin(), itEnd = s_arrKeys.cend(); it != itEnd; ++it ) {
-                            if ( rMap.erase( *it ))
-                                ++m_nDeleteSuccess;
-                            else
-                                ++m_nDeleteFailed;
-                        }
-                    }
-                }
-                else {
-                    for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) {
-                        for ( auto it = s_arrKeys.crbegin(), itEnd = s_arrKeys.crend(); it != itEnd; ++it ) {
-                            if ( rMap.erase( *it ))
-                                ++m_nDeleteSuccess;
-                            else
-                                ++m_nDeleteFailed;
-                        }
-                    }
+                for (auto it = s_arrKeys.cbegin(), itEnd = s_arrKeys.cend();
+                     it != itEnd; ++it) {
+                  if (rMap.erase(*it))
+                    ++m_nDeleteSuccess;
+                  else
+                    ++m_nDeleteFailed;
                 }
             }
         };
@@ -186,62 +166,20 @@ namespace map {
             typedef Deleter<Map>        deleter;
 
             cds_test::thread_pool& pool = get_pool();
-            pool.add( new inserter( pool, testMap ), s_nInsertThreadCount );
-            pool.add( new deleter( pool, testMap ), s_nDeleteThreadCount );
-
-            propout() << std::make_pair( "insert_thread_count", s_nInsertThreadCount )
-                << std::make_pair( "delete_thread_count", s_nDeleteThreadCount )
-                << std::make_pair( "pass_count", s_nThreadPassCount )
-                << std::make_pair( "map_size", s_nMapSize );
-
-            std::chrono::milliseconds duration = pool.run();
-
-            propout() << std::make_pair( "duration", duration );
-
-            size_t nInsertSuccess = 0;
-            size_t nInsertFailed = 0;
-            size_t nDeleteSuccess = 0;
-            size_t nDeleteFailed = 0;
-
-            for ( size_t i = 0; i < pool.size(); ++i ) {
-                cds_test::thread& thr = pool.get( i );
-                switch ( thr.type()) {
-                case insert_thread:
-                {
-                    inserter& t = static_cast<inserter&>(thr);
-                    nInsertSuccess += t.m_nInsertSuccess;
-                    nInsertFailed += t.m_nInsertFailed;
-                }
-                break;
-                case delete_thread:
-                {
-                    deleter& t = static_cast<deleter&>(thr);
-                    nDeleteSuccess += t.m_nDeleteSuccess;
-                    nDeleteFailed += t.m_nDeleteFailed;
-                }
-                break;
-                default:
-                    assert( false );
-                }
+            std::unique_ptr<inserter> inserter_thrd(
+                new inserter(pool, testMap));
+            std::unique_ptr<deleter> deleter_thrd(
+                new deleter(pool, testMap));
+            for (size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass) {
+              inserter_thrd->test();
+              deleter_thrd->test();
             }
 
-            propout()
-                << std::make_pair( "insert_success", nInsertSuccess )
-                << std::make_pair( "insert_failed", nInsertFailed )
-                << std::make_pair( "delete_success", nDeleteSuccess )
-                << std::make_pair( "delete_failed", nDeleteFailed )
-                << std::make_pair( "finish_map_size", testMap.size());
-
-            check_before_cleanup( testMap );
-
-            //testMap.clear();
+            // testMap.clear();
             for ( auto const& str: s_arrKeys )
                 testMap.erase( str );
             EXPECT_TRUE( testMap.empty());
             EXPECT_EQ( testMap.size(), 0u );
-
-            additional_check( testMap );
-            print_stat( propout(), testMap );
             additional_cleanup( testMap );
         }
 
@@ -250,6 +188,41 @@ namespace map {
         {
             Map testMap( *this );
             do_test( testMap );
+        }
+
+                               template <class Map>
+        void run_bronson_avl_tree() {
+          Map_InsDel_string::s_nThreadPassCount =
+              Map_InsDel_string::s_nBronsonAVLTreeMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_ellen_bin_tree() {
+          Map_InsDel_string::s_nThreadPassCount =
+              Map_InsDel_string::s_nEllenBinTreeMapPassCount;
+          run_test<Map>();
+        }
+
+                               template <class Map>
+        void run_feldman() {
+          Map_InsDel_string::s_nThreadPassCount =
+              Map_InsDel_string::s_nFeldmanPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_michael() {
+          Map_InsDel_string::s_nThreadPassCount =
+              Map_InsDel_string::s_nMichaelMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_skip_list() {
+          Map_InsDel_string::s_nThreadPassCount =
+              Map_InsDel_string::s_nSkipListMapPassCount;
+          run_test<Map>();
         }
     };
 
index f7391f1d34d6fc2dcef8350b1b28f8a86635272f..737950e73de61e7a5102d58a2edf5b81ca79698c 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_BronsonAVLTreeMap( Map_InsDel_string, run_test, std::string, size_t )
+    CDSSTRESS_BronsonAVLTreeMap( Map_InsDel_string, run_bronson_avl_tree, std::string, size_t )
 
 } // namespace map
index 0946b66d95d52449024ea4eec748f32d725aaf05..4e7c8eed2c31b762ed746244ae2815f66e6e1a12 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_EllenBinTreeMap( Map_InsDel_string, run_test, std::string, size_t )
+    CDSSTRESS_EllenBinTreeMap( Map_InsDel_string, run_ellen_bin_tree, std::string, size_t )
 
 } // namespace map
index 792c68225749aa35d9f2b70fe8292c9328e4eabe..0c5666e922794dbb8f7c8bb1651d8632c0ba32fe 100644 (file)
 
 namespace map {
 
-    CDSSTRESS_FeldmanHashMap_stdhash( Map_InsDel_string_stdhash, run_test, std::string, size_t )
+    CDSSTRESS_FeldmanHashMap_stdhash( Map_InsDel_string_stdhash, run_feldman, std::string, size_t )
 #if CDS_BUILD_BITS == 64
-        CDSSTRESS_FeldmanHashMap_city64( Map_InsDel_string_city64, run_test, std::string, size_t )
-        CDSSTRESS_FeldmanHashMap_city128( Map_InsDel_string_city128, run_test, std::string, size_t )
+        CDSSTRESS_FeldmanHashMap_city64( Map_InsDel_string_city64, run_feldman, std::string, size_t )
+        CDSSTRESS_FeldmanHashMap_city128( Map_InsDel_string_city128, run_feldman, std::string, size_t )
 #endif
 
 } // namespace map
index 014e69f3e8c41911a4fcbfd92412671bdd84d551..3bcf39631175fe980d8529b96b84b68e044d10d6 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_MichaelMap( Map_InsDel_string_LF, run_test, std::string, size_t )
+    CDSSTRESS_MichaelMap( Map_InsDel_string_LF, run_michael, std::string, size_t )
 
 } // namespace map
index 9f1892745c49e2f4ab90cd620e79f02b5caffdbf..2006508193017e4c0b979792efe4df4b971ef59f 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_SkipListMap( Map_InsDel_string, run_test, std::string, size_t )
+    CDSSTRESS_SkipListMap( Map_InsDel_string, run_skip_list, std::string, size_t )
 
 } // namespace map