Adjusts sequential map test cases
authorPeizhao Ou <peizhaoo@uci.edu>
Thu, 18 Jan 2018 01:00:12 +0000 (17:00 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Thu, 18 Jan 2018 01:00:12 +0000 (17:00 -0800)
14 files changed:
test/stress/sequential/sequential-map/insdelfind/CMakeLists.txt
test/stress/sequential/sequential-map/insdelfind/map_insdelfind.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind.h
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_bronsonavltree.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_ellentree_hp.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_ellentree_rcu.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_feldman_hashset_hp.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_feldman_hashset_rcu.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_michael_hp.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_michael_rcu.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_skip_hp.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_skip_rcu.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_split_hp.cpp
test/stress/sequential/sequential-map/insdelfind/map_insdelfind_split_rcu.cpp

index 8176078874538ecbe8099589549a9447551ae085..033bec6497c0119fe40021df52969a7237d8c4a9 100644 (file)
@@ -4,14 +4,14 @@ set(MAP_INSDELFIND_RCU stress-sequential-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
 )
 
 set(CDSSTRESS_MAP_INSDELFIND_RCU_SOURCES
index ea0c970445da33f666c7196fa2ee1378706dafe1..63fe8762258a064df5b5d90d3de1cd127e5374a9 100644 (file)
@@ -34,6 +34,15 @@ 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 = 100;
+    size_t Map_InsDelFind::s_nFeldmanPassCount = 100;
+    size_t Map_InsDelFind::s_nBronsonAVLTreeMapPassCount = 100;
+    size_t Map_InsDelFind::s_nEllenBinTreeMapPassCount = 100;
+    size_t Map_InsDelFind::s_nMichaelMapPassCount = 100;
+    size_t Map_InsDelFind::s_nSkipListMapPassCount = 100;
+    size_t Map_InsDelFind::s_nSplitListMapPassCount = 100;
+
     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;
@@ -52,7 +61,7 @@ namespace map {
 
     void Map_InsDelFind::SetUpTestCase()
     {
 
     void Map_InsDelFind::SetUpTestCase()
     {
-        cds_test::config const& cfg = get_config( "map_insdelfind" );
+        cds_test::config const& cfg = get_config( "sequential_real_map_insdelfind" );
 
         s_nMapSize = cfg.get_size_t( "InitialMapSize", s_nMapSize );
         if ( s_nMapSize < 1000 )
 
         s_nMapSize = cfg.get_size_t( "InitialMapSize", s_nMapSize );
         if ( s_nMapSize < 1000 )
@@ -62,6 +71,41 @@ 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_nPassCount = 500;
+
+        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_nSplitListMapPassCount =
+            cfg.get_size_t("SplitListMapPassCount", s_nSplitListMapPassCount);
+        if (s_nSplitListMapPassCount == 0)
+          s_nSplitListMapPassCount = 500;
+
         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..f1b03bf8c784e3deb7274ec40f94c31a12c01718 100644 (file)
@@ -37,6 +37,15 @@ namespace map {
     {
     public:
         static size_t s_nMapSize;           // initial map size
     {
     public:
         static size_t s_nMapSize;           // initial map size
+
+        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_nSplitListMapPassCount;
+
         static size_t s_nThreadCount;       // thread count
         static size_t s_nMaxLoadFactor;     // maximum load factor
         static unsigned int s_nInsertPercentage;
         static size_t s_nThreadCount;       // thread count
         static size_t s_nMaxLoadFactor;     // maximum load factor
         static unsigned int s_nInsertPercentage;
@@ -122,12 +131,14 @@ namespace map {
             virtual void test()
             {
                 Map& rMap = m_Map;
             virtual void test()
             {
                 Map& rMap = m_Map;
+                Map_InsDelFind& fixture = pool().template fixture<Map_InsDelFind>();
+                size_t pass_count = fixture.s_nPassCount;
 
                 unsigned int i = 0;
                 size_t const nNormalize = size_t(-1) / ( s_nMapSize * 2 );
 
                 size_t nRand = 0;
 
                 unsigned int i = 0;
                 size_t const nNormalize = size_t(-1) / ( s_nMapSize * 2 );
 
                 size_t nRand = 0;
-                while ( !time_elapsed()) {
+                while ( pass_count-- ) {
                     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] ) {
@@ -183,56 +194,11 @@ namespace map {
             }
 
             cds_test::thread_pool& pool = get_pool();
             }
 
             cds_test::thread_pool& pool = get_pool();
-            pool.add( new worker( pool, testMap ), s_nThreadCount );
-
-            propout() << std::make_pair( "thread_count", s_nThreadCount )
-                << std::make_pair( "insert_percentage", s_nInsertPercentage )
-                << 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 ));
-
-            propout() << std::make_pair( "duration", duration );
-
-            size_t nInsertSuccess = 0;
-            size_t nInsertFailed = 0;
-            size_t nDeleteSuccess = 0;
-            size_t nDeleteFailed = 0;
-            size_t nFindSuccess = 0;
-            size_t nFindFailed = 0;
-            for ( size_t i = 0; i < pool.size(); ++i ) {
-                worker& thr = static_cast<worker&>( pool.get( i ));
-
-                nInsertSuccess += thr.m_nInsertSuccess;
-                nInsertFailed += thr.m_nInsertFailed;
-                nDeleteSuccess += thr.m_nDeleteSuccess;
-                nDeleteFailed += thr.m_nDeleteFailed;
-                nFindSuccess += thr.m_nFindSuccess;
-                nFindFailed += thr.m_nFindFailed;
-            }
-
-            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( "find_success", nFindSuccess )
-                << std::make_pair( "find_failed", nFindFailed )
-                << std::make_pair( "finish_map_size", testMap.size());
-
-            {
-                ASSERT_TRUE( std::chrono::duration_cast<std::chrono::seconds>(duration).count() > 0 );
-                size_t nTotalOps = nInsertSuccess + nInsertFailed + nDeleteSuccess + nDeleteFailed + nFindSuccess + nFindFailed;
-                propout() << std::make_pair( "avg_speed", nTotalOps / std::chrono::duration_cast<std::chrono::seconds>( duration ).count());
-            }
-
-            check_before_cleanup( testMap );
+            std::unique_ptr<worker> worker_thrd(new worker(pool, testMap));
+            worker_thrd->test();
 
             testMap.clear();
             EXPECT_TRUE( testMap.empty());
 
             testMap.clear();
             EXPECT_TRUE( testMap.empty());
-
-            additional_check( testMap );
-            print_stat( propout(), testMap );
             additional_cleanup( testMap );
         }
 
             additional_cleanup( testMap );
         }
 
@@ -242,6 +208,34 @@ namespace map {
             Map testMap( *this );
             do_test( testMap );
         }
             Map testMap( *this );
             do_test( testMap );
         }
+
+        template <class Map>
+        void run_bronson_avl_tree() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nBronsonAVLTreeMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_ellen_bin_tree() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nEllenBinTreeMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_skip_list() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nSkipListMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_feldman() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nFeldmanPassCount;
+          run_test<Map>();
+        }
     };
 
     class Map_InsDelFind_LF: public Map_InsDelFind
     };
 
     class Map_InsDelFind_LF: public Map_InsDelFind
@@ -256,6 +250,20 @@ namespace map {
             Map_InsDelFind::run_test<Map>();
         }
 
             Map_InsDelFind::run_test<Map>();
         }
 
+                               template <class Map>
+        void run_michael() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nMichaelMapPassCount;
+          Map_InsDelFind_LF::run_test<Map>();
+        }
+
+        template <class Map>
+        void run_split_list() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nSplitListMapPassCount;
+          Map_InsDelFind_LF::run_test<Map>();
+        }
+
         static std::vector<size_t> get_load_factors();
     };
 
         static std::vector<size_t> get_load_factors();
     };
 
index 410e944c5dfdf3a61e950511daac0837eda3b456..68071541a4219a7d2f7792407eac1ef8a7a50936 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_BronsonAVLTreeMap( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_BronsonAVLTreeMap( Map_InsDelFind, run_bronson_avl_tree, size_t, size_t )
 
 } // namespace map
 
 } // namespace map
index d4c07cedf775dd29b79df9c498e09c02a2a49c7c..7372eee5d5eb740030f18ada237c9b314bf9a159 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_EllenBinTreeMap_HP( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_EllenBinTreeMap_HP( Map_InsDelFind, run_ellen_bin_tree, size_t, size_t )
 
 } // namespace map
 
 } // namespace map
index 844c28ded1d8761da1729beb2386556448c81041..b5db47fec8ec8918cd02471e483e6c1f798adff2 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_EllenBinTreeMap_RCU( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_EllenBinTreeMap_RCU( Map_InsDelFind, run_ellen_bin_tree, size_t, size_t )
 
 } // namespace map
 
 } // namespace map
index b0978587c40e72b03b6871a0165cf11a6d0b7fe4..dce3ebbefc19a621ca754a057188696805f684c8 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_FeldmanHashMap_fixed_HP( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_FeldmanHashMap_fixed_HP( Map_InsDelFind, run_feldman, size_t, size_t )
 
 } // namespace map
 
 } // namespace map
index 67c8821ef08764e8673fef102b83bf06c829cb9c..0122f166e12e321ff9558a03c1e7137bc7513725 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_FeldmanHashMap_fixed_RCU( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_FeldmanHashMap_fixed_RCU( Map_InsDelFind, run_feldman, size_t, size_t )
 
 } // namespace map
 
 } // namespace map
index afa4106d2715cb3035086689dc45facd6df75a2e..4083ab6df2974b90759e9bc8dd2d0d2a86340d85 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_MichaelMap_HP( Map_InsDelFind_LF, run_test, size_t, size_t )
+    CDSSTRESS_MichaelMap_HP( Map_InsDelFind_LF, run_michael, size_t, size_t )
 
 } // namespace map
 
 } // namespace map
index 3d441773e302519c92e92ff6bffbe0f1954a448f..0874b0ab0aad3dd508e82492ffe86f27b221915d 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_MichaelMap_RCU( Map_InsDelFind_LF, run_test, size_t, size_t )
+    CDSSTRESS_MichaelMap_RCU( Map_InsDelFind_LF, run_michael, size_t, size_t )
 
 } // namespace map
 
 } // namespace map
index cbc76e363116fedf49ef085bc4e8de9631a1554b..a78c73f493c7f239e4f4fed9eaf7b3ed6b6f098b 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_SkipListMap_HP( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_SkipListMap_HP( Map_InsDelFind, run_skip_list, size_t, size_t )
 
 } // namespace map
 
 } // namespace map
index f70c5ee5044a4b0faf4f139c672639a302c5fdaf..d73fa79c14fdb630e3968df715d57db8bf3873ab 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_SkipListMap_RCU( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_SkipListMap_RCU( Map_InsDelFind, run_skip_list, size_t, size_t )
 
 } // namespace map
 
 } // namespace map
index ece864c755a707b283a22447bb924b8faed94432..625afca4c631791a79093f4264e5a0f959481000 100644 (file)
@@ -33,7 +33,7 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_SplitListMap_HP( Map_InsDelFind_LF, run_test, size_t, size_t )
-    CDSSTRESS_SplitListIterableMap( Map_InsDelFind_LF, run_test, size_t, size_t )
+    CDSSTRESS_SplitListMap_HP( Map_InsDelFind_LF, run_split_list, size_t, size_t )
+    CDSSTRESS_SplitListIterableMap( Map_InsDelFind_LF, run_split_list, size_t, size_t )
 
 } // namespace map
 
 } // namespace map
index a090fad78b5277659107275189aea36641915e4a..bfa4da841287f6e24cb3dcee4957b4a8b6e88522 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
 
 namespace map {
 
-    CDSSTRESS_SplitListMap_RCU( Map_InsDelFind_LF, run_test, size_t, size_t )
+    CDSSTRESS_SplitListMap_RCU( Map_InsDelFind_LF, run_split_list, size_t, size_t )
 
 } // namespace map
 
 } // namespace map