Refactored Set_InsDel_func MT-test
authorkhizmax <libcds.dev@gmail.com>
Thu, 10 Sep 2015 17:52:29 +0000 (20:52 +0300)
committerkhizmax <libcds.dev@gmail.com>
Thu, 10 Sep 2015 17:52:29 +0000 (20:52 +0300)
20 files changed:
cds/container/striped_set.h
cds/container/striped_set/adapter.h
cds/container/striped_set/std_hash_set.h
cds/container/striped_set/std_set.h
projects/Win/vc12/unit-set-insdel.vcxproj
projects/Win/vc12/unit-set-insdel.vcxproj.filters
projects/source.unit.set.mk
tests/unit/set2/CMakeLists.txt
tests/unit/set2/set_defs.h
tests/unit/set2/set_delodd.h
tests/unit/set2/set_insdel_func.cpp
tests/unit/set2/set_insdel_func.h
tests/unit/set2/set_insdel_func_cuckoo.cpp
tests/unit/set2/set_insdel_func_ellentree.cpp
tests/unit/set2/set_insdel_func_michael.cpp [new file with mode: 0644]
tests/unit/set2/set_insdel_func_refinable.cpp [deleted file]
tests/unit/set2/set_insdel_func_skip.cpp
tests/unit/set2/set_insdel_func_split.cpp
tests/unit/set2/set_insdel_func_striped.cpp
tests/unit/set2/set_type_striped.h

index 8396e0424cd4edd79f1927dd939880865529eb7a..509407530dc0b11ba54df873182b0c0b185a8e3f 100644 (file)
@@ -492,13 +492,14 @@ namespace cds { namespace container {
     public:
         /// Default ctor. The initial capacity is 16.
         StripedSet()
-        : base_class()
+            : base_class()
         {}
 
         /// Ctor with initial capacity specified
         StripedSet(
             size_t nCapacity    ///< Initial size of bucket table and lock array. Must be power of two, the minimum is 16.
-        ) : base_class( nCapacity )
+        ) 
+            : base_class( nCapacity )
         {}
 
         /// Ctor with resizing policy (copy semantics)
@@ -508,7 +509,8 @@ namespace cds { namespace container {
         StripedSet(
             size_t nCapacity    ///< Initial size of bucket table and lock array. Must be power of two, the minimum is 16.
             ,resizing_policy const& resizingPolicy  ///< Resizing policy
-        ) : base_class( nCapacity, resizingPolicy )
+        ) 
+            : base_class( nCapacity, resizingPolicy )
         {}
 
         /// Ctor with resizing policy (move semantics)
@@ -519,7 +521,8 @@ namespace cds { namespace container {
         StripedSet(
             size_t nCapacity    ///< Initial size of bucket table and lock array. Must be power of two, the minimum is 16.
             ,resizing_policy&& resizingPolicy  ///< Resizing policy
-            ) : base_class( nCapacity, std::forward<resizing_policy>(resizingPolicy) )
+        ) 
+            : base_class( nCapacity, std::forward<resizing_policy>(resizingPolicy) )
         {}
 
         /// Destructor destroys internal data
index aeb4101efb365dc956a0dadb17e1545386b178a4..c0f130633f2271dc406f086db481d4751dbb9a23 100644 (file)
@@ -303,7 +303,7 @@ namespace cds { namespace container {
                         auto it = m_Set.find( val );
                         if ( it == m_Set.end() )
                             return std::make_pair( false, false );
-                        func( false, *it, val );
+                        func( false, const_cast<value_type&>(*it), val );
                         return std::make_pair( true, false );
                     }
                 }
index 3ab581b4a280c0b31384a8959c1156c9f4c668b4..52ed4abf9f1fb40783ac5f80548624d645b67051 100644 (file)
@@ -110,10 +110,10 @@ namespace cds { namespace intrusive { namespace striped_set {
                 }
                 else {
                     auto it = m_Set.find( value_type(val));
-                    if ( it = m_Set.end() )
+                    if ( it == m_Set.end() )
                         return std::make_pair( false, false );
 
-                    func( false, *it, val );
+                    func( false, const_cast<value_type&>(*it), val );
                     return std::make_pair( true, false );
                 }
             }
index 821c2471e96851dd6bc7223db54fdc44fdec9545..8bda976f8a8a6a503b8a8566d2e04be13cf162c3 100644 (file)
@@ -113,7 +113,7 @@ namespace cds { namespace intrusive { namespace striped_set {
                     auto it = m_Set.find(value_type(val));
                     if ( it == m_Set.end() )
                         return std::make_pair( false, false );
-                    func( false, *it, val );
+                    func( false, const_cast<value_type&>(*it), val );
                     return std::make_pair( true, false );
                 }
             }
index e275431d08a0e25617bf9b62557ddfec7dd1f9d7..3b1a81727ca0ea51dcd321923fb55d3a58e836d9 100644 (file)
@@ -46,7 +46,7 @@
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_cuckoo.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_ellentree.cpp" />\r
-    <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_refinable.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_michael.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_skip.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_split.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_striped.cpp" />\r
index f477a47ecae07336729eef2b7f88542823efed78..1e4acd1445fcfe1b4ff577171f79202440d77bf2 100644 (file)
@@ -10,9 +10,6 @@
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_ellentree.cpp">\r
       <Filter>set_insdel_func</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_refinable.cpp">\r
-      <Filter>set_insdel_func</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_skip.cpp">\r
       <Filter>set_insdel_func</Filter>\r
     </ClCompile>\r
@@ -49,6 +46,9 @@
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_striped.cpp">\r
       <Filter>set_insdel_string</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func_michael.cpp">\r
+      <Filter>set_insdel_func</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Filter Include="set_insdel_func">\r
index 2f286246ae224a346699965a76e236482d849896..e0980921bfe8ac8f00f79c4cb8c02266a2bc6dec 100644 (file)
@@ -3,7 +3,7 @@ CDSUNIT_SET_SOURCES := \
        tests/unit/set2/set_insdel_func.cpp \
        tests/unit/set2/set_insdel_func_cuckoo.cpp \
        tests/unit/set2/set_insdel_func_ellentree.cpp \
-       tests/unit/set2/set_insdel_func_refinable.cpp \
+       tests/unit/set2/set_insdel_func_michael.cpp \
        tests/unit/set2/set_insdel_func_skip.cpp \
        tests/unit/set2/set_insdel_func_split.cpp \
        tests/unit/set2/set_insdel_func_striped.cpp \
index aa26e05e04bc8924c7e97dd9b2e188afc6b9ab49..a72e69f7e8ca20be165cf39de86b0df1e7048cbf 100644 (file)
@@ -4,7 +4,7 @@ set(CDSUNIT_SET_SOURCES
     set_insdel_func.cpp
     set_insdel_func_cuckoo.cpp
     set_insdel_func_ellentree.cpp
-    set_insdel_func_refinable.cpp
+    set_insdel_func_michael.cpp
     set_insdel_func_skip.cpp
     set_insdel_func_split.cpp
     set_insdel_func_striped.cpp
index e893594f8f55925580a837f4334c04722d874b57..9df4c917fc2799641828fed94ccba14c501a9a14 100644 (file)
@@ -4,12 +4,8 @@
 #define CDSUNIT_SET_DEFS_H
 
 #define CDSUNIT_DECLARE_StdSet \
-    CDSUNIT_DECLARE_TEST(StdSet_Spin) \
-    CDSUNIT_DECLARE_TEST(StdHashSet_Spin)
-
-#define CDSUNIT_DEFINE_StdSet(IMPL, C) \
-    TEST_SET(IMPL, C, StdSet_Spin) \
-    TEST_SET(IMPL, C, StdHashSet_Spin)
+    TEST_CASE(StdSet_Spin) \
+    TEST_CASE(StdHashSet_Spin)
 
 #define CDSUNIT_TEST_StdSet \
     CPPUNIT_TEST(StdSet_Spin) \
 
 
 #define CDSUNIT_DECLARE_StripedSet_common \
-    CDSUNIT_DECLARE_TEST(StripedSet_list) \
-    CDSUNIT_DECLARE_TEST(StripedSet_vector) \
-    CDSUNIT_DECLARE_TEST(StripedSet_set) \
-    CDSUNIT_DECLARE_TEST(StripedSet_hashset) \
-    CDSUNIT_DECLARE_TEST(StripedSet_boost_unordered_set) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_list) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_vector) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_set) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_hashset) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_boost_unordered_set)
+    TEST_CASE( tag_StripedSet, StripedSet_list) \
+    TEST_CASE( tag_StripedSet, StripedSet_vector) \
+    TEST_CASE( tag_StripedSet, StripedSet_set) \
+    TEST_CASE( tag_StripedSet, StripedSet_hashset) \
+    TEST_CASE( tag_StripedSet, StripedSet_boost_unordered_set) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_list) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_vector) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_set) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_hashset) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_boost_unordered_set)
 
 #define CDSUNIT_TEST_StripedSet_common \
     CPPUNIT_TEST(StripedSet_list) \
 
 #if BOOST_VERSION >= 104800
 #   define CDSUNIT_DECLARE_StripedSet_boost_container \
-    CDSUNIT_DECLARE_TEST(StripedSet_boost_list) \
-    CDSUNIT_DECLARE_TEST(StripedSet_boost_slist) \
-    CDSUNIT_DECLARE_TEST(StripedSet_boost_vector) \
-    CDSUNIT_DECLARE_TEST(StripedSet_boost_stable_vector) \
-    CDSUNIT_DECLARE_TEST(StripedSet_boost_set) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_boost_list) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_boost_slist) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_boost_vector) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_boost_stable_vector) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_boost_set)
+    TEST_CASE( tag_StripedSet, StripedSet_boost_list) \
+    TEST_CASE( tag_StripedSet, StripedSet_boost_slist) \
+    TEST_CASE( tag_StripedSet, StripedSet_boost_vector) \
+    TEST_CASE( tag_StripedSet, StripedSet_boost_stable_vector) \
+    TEST_CASE( tag_StripedSet, StripedSet_boost_set) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_boost_list) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_boost_slist) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_boost_vector) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_boost_stable_vector) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_boost_set)
 
 #   define CDSUNIT_TEST_StripedSet_boost_container \
     CPPUNIT_TEST(StripedSet_boost_list) \
 
 #if BOOST_VERSION >= 104800 && defined(CDS_UNIT_SET_TYPES_ENABLE_BOOST_FLAT_CONTAINERS)
 #   define CDSUNIT_DECLARE_StripedSet_boost_flat_container \
-    CDSUNIT_DECLARE_TEST(StripedSet_boost_flat_set) \
-    CDSUNIT_DECLARE_TEST(StripedSet_rational_boost_flat_set)
+    TEST_CASE( tag_StripedSet, StripedSet_boost_flat_set) \
+    TEST_CASE( tag_StripedSet, StripedSet_rational_boost_flat_set)
 
 #   define CDSUNIT_TEST_StripedSet_boost_flat_container \
     CPPUNIT_TEST(StripedSet_boost_flat_set) \
 
 
 #define CDSUNIT_DECLARE_RefinableSet_common \
-    CDSUNIT_DECLARE_TEST(RefinableSet_list) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_vector) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_set) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_hashset) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_boost_unordered_set) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_list) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_vector) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_set) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_hashset) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_boost_unordered_set)
+    TEST_CASE( tag_StripedSet, RefinableSet_list) \
+    TEST_CASE( tag_StripedSet, RefinableSet_vector) \
+    TEST_CASE( tag_StripedSet, RefinableSet_set) \
+    TEST_CASE( tag_StripedSet, RefinableSet_hashset) \
+    TEST_CASE( tag_StripedSet, RefinableSet_boost_unordered_set) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_list) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_vector) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_set) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_hashset) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_boost_unordered_set)
 
 #define CDSUNIT_TEST_RefinableSet_common \
     CPPUNIT_TEST(RefinableSet_list) \
 
 #if BOOST_VERSION >= 104800
 #   define CDSUNIT_DECLARE_RefinableSet_boost_container \
-    CDSUNIT_DECLARE_TEST(RefinableSet_boost_list) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_boost_slist) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_boost_vector) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_boost_stable_vector) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_boost_set) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_boost_list) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_boost_slist) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_boost_vector) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_boost_stable_vector) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_boost_set)
+    TEST_CASE( tag_StripedSet, RefinableSet_boost_list) \
+    TEST_CASE( tag_StripedSet, RefinableSet_boost_slist) \
+    TEST_CASE( tag_StripedSet, RefinableSet_boost_vector) \
+    TEST_CASE( tag_StripedSet, RefinableSet_boost_stable_vector) \
+    TEST_CASE( tag_StripedSet, RefinableSet_boost_set) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_boost_list) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_boost_slist) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_boost_vector) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_boost_stable_vector) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_boost_set)
 
 #   define CDSUNIT_TEST_RefinableSet_boost_container \
     CPPUNIT_TEST(RefinableSet_boost_list) \
 
 #if BOOST_VERSION >= 104800 && defined(CDS_UNIT_SET_TYPES_ENABLE_BOOST_FLAT_CONTAINERS)
 #   define CDSUNIT_DECLARE_RefinableSet_boost_flat_container \
-    CDSUNIT_DECLARE_TEST(RefinableSet_boost_flat_set) \
-    CDSUNIT_DECLARE_TEST(RefinableSet_rational_boost_flat_set)
+    TEST_CASE( tag_StripedSet, RefinableSet_boost_flat_set) \
+    TEST_CASE( tag_StripedSet, RefinableSet_rational_boost_flat_set)
 
 #   define CDSUNIT_TEST_RefinableSet_boost_flat_container \
     CPPUNIT_TEST(RefinableSet_boost_flat_set) \
index 7ae8c857c4f2787390f5a98ed93f48b5f85b1b8c..0f14a6af2e13a16b2ea59ede607fe6eeac8374b1 100644 (file)
@@ -743,7 +743,7 @@ namespace set2 {
         CDSUNIT_DECLARE_EllenBinTreeSet
         CDSUNIT_DECLARE_CuckooSet
 
-        CPPUNIT_TEST_SUITE(Set_DelOdd)
+        CPPUNIT_TEST_SUITE_(Set_DelOdd, "Map_DelOdd")
             CDSUNIT_TEST_MichaelSet
             CDSUNIT_TEST_SplitList
             CDSUNIT_TEST_SkipListSet
index 4ec5714ce82d846adc799a901570e8bfa6fb98e0..3bb3286ea57ec1bd31bc899633e2a23d298e20e5 100644 (file)
@@ -1,24 +1,29 @@
 //$$CDS-header$$
 
 #include "set2/set_insdel_func.h"
-#include "set2/set_type_michael.h"
 
 namespace set2 {
-
     CPPUNIT_TEST_SUITE_REGISTRATION( Set_InsDel_func );
 
-    size_t  Set_InsDel_func::c_nMapSize = 1000000    ;  // map size
-    size_t  Set_InsDel_func::c_nInsertThreadCount = 4;  // count of insertion thread
-    size_t  Set_InsDel_func::c_nDeleteThreadCount = 4;  // count of deletion thread
-    size_t  Set_InsDel_func::c_nEnsureThreadCount = 4;  // count of ensure thread
-    size_t  Set_InsDel_func::c_nThreadPassCount = 4  ;  // pass count for each thread
-    size_t  Set_InsDel_func::c_nMaxLoadFactor = 8    ;  // maximum load factor
-    bool    Set_InsDel_func::c_bPrintGCState = true;
-
-    CDSUNIT_DEFINE_MichaelSet( cc::michael_set::implementation_tag, Set_InsDel_func )
+    void Set_InsDel_func::setUpParams( const CppUnitMini::TestCfg& cfg )
+    {
+        c_nSetSize = cfg.getSizeT("MapSize", c_nSetSize );
+        c_nInsertThreadCount = cfg.getSizeT("InsertThreadCount", c_nInsertThreadCount );
+        c_nDeleteThreadCount = cfg.getSizeT("DeleteThreadCount", c_nDeleteThreadCount );
+        c_nUpdateThreadCount = cfg.getSizeT("EnsureThreadCount", c_nUpdateThreadCount );
+        c_nThreadPassCount = cfg.getSizeT("ThreadPassCount", c_nThreadPassCount );
+        c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
+        c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
 
-    CPPUNIT_TEST_SUITE_PART( Set_InsDel_func, run_MichaelSet )
-        CDSUNIT_TEST_MichaelSet
-    CPPUNIT_TEST_SUITE_END_PART()
+        c_nCuckooInitialSize = cfg.getSizeT("CuckooInitialSize", c_nCuckooInitialSize );
+        c_nCuckooProbesetSize = cfg.getSizeT("CuckooProbesetSize", c_nCuckooProbesetSize );
+        c_nCuckooProbesetThreshold = cfg.getSizeT("CuckooProbesetThreshold", c_nCuckooProbesetThreshold );
 
+        if ( c_nInsertThreadCount == 0 )
+            c_nInsertThreadCount = std::thread::hardware_concurrency();
+        if ( c_nDeleteThreadCount == 0 )
+            c_nDeleteThreadCount = std::thread::hardware_concurrency();
+        if ( c_nUpdateThreadCount == 0 )
+            c_nUpdateThreadCount = std::thread::hardware_concurrency();
+    }
 } // namespace set2
index a0635453ebb1529b62bfb0f000b10a440f83d673..f20cbe7720cfc5c04fea027d909b94b7686ec326 100644 (file)
 
 namespace set2 {
 
-#   define TEST_SET(IMPL, C, X)          void C::X() { test<set_type<IMPL, key_type, value_type>::X >(); }
-#   define TEST_SET_EXTRACT(IMPL, C, X)  TEST_SET(IMPL, C, X)
-#   define TEST_SET_NOLF(IMPL, C, X)     void C::X() { test_nolf<set_type<IMPL, key_type, value_type>::X >(); }
-#   define TEST_SET_NOLF_EXTRACT(IMPL, C, X) TEST_SET_NOLF(IMPL, C, X)
+#define TEST_CASE(TAG, X)  void X();
 
     class Set_InsDel_func: public CppUnitMini::TestCase
     {
-        static size_t  c_nMapSize           ;  // map size
-        static size_t  c_nInsertThreadCount ;  // count of insertion thread
-        static size_t  c_nDeleteThreadCount ;  // count of deletion thread
-        static size_t  c_nEnsureThreadCount ;  // count of ensure thread
-        static size_t  c_nThreadPassCount   ;  // pass count for each thread
-        static size_t  c_nMaxLoadFactor     ;  // maximum load factor
-        static bool    c_bPrintGCState;
-
+    public:
+        size_t  c_nSetSize = 1000000;      // set size
+        size_t  c_nInsertThreadCount = 4;  // count of insertion thread
+        size_t  c_nDeleteThreadCount = 4;  // count of deletion thread
+        size_t  c_nUpdateThreadCount = 4;  // count of ensure thread
+        size_t  c_nThreadPassCount = 4;    // pass count for each thread
+        size_t  c_nMaxLoadFactor = 8;      // maximum load factor
+        bool    c_bPrintGCState;
+
+        size_t  c_nCuckooInitialSize = 1024;// initial size for CuckooSet
+        size_t  c_nCuckooProbesetSize = 16; // CuckooSet probeset size (only for list-based probeset)
+        size_t  c_nCuckooProbesetThreshold = 0; // CUckooSet probeset threshold (0 - use default)
+
+        size_t c_nLoadFactor = 2;
+
+    private:
         typedef size_t  key_type;
         struct value_type {
             size_t      nKey;
             size_t      nData;
-            atomics::atomic<size_t> nEnsureCall;
+            atomics::atomic<size_t> nUpdateCall;
             bool volatile   bInitialized;
             cds::OS::ThreadId          threadId     ;   // insert thread id
 
@@ -39,7 +44,7 @@ namespace set2 {
             value_type()
                 : nKey(0)
                 , nData(0)
-                , nEnsureCall(0)
+                , nUpdateCall(0)
                 , bInitialized( false )
                 , threadId( cds::OS::get_current_thread_id() )
             {}
@@ -47,7 +52,7 @@ namespace set2 {
             value_type( value_type const& s )
                 : nKey(s.nKey)
                 , nData(s.nData)
-                , nEnsureCall(s.nEnsureCall.load(atomics::memory_order_relaxed))
+                , nUpdateCall(s.nUpdateCall.load(atomics::memory_order_relaxed))
                 , bInitialized( s.bInitialized )
                 , threadId( cds::OS::get_current_thread_id() )
             {}
@@ -57,7 +62,7 @@ namespace set2 {
             {
                 nKey = v.nKey;
                 nData = v.nData;
-                nEnsureCall.store( v.nEnsureCall.load(atomics::memory_order_relaxed), atomics::memory_order_relaxed );
+                nUpdateCall.store( v.nUpdateCall.load(atomics::memory_order_relaxed), atomics::memory_order_relaxed );
                 bInitialized = v.bInitialized;
 
                 return *this;
@@ -134,12 +139,13 @@ namespace set2 {
 
                 size_t * pKeyFirst = getTest().m_pKeyFirst;
                 size_t * pKeyLast = getTest().m_pKeyLast;
+                size_t const nPassCount = getTest().c_nThreadPassCount;
 
                 // func is passed by reference
                 insert_functor  func;
 
                 if ( m_nThreadNo & 1 ) {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                    for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
                         for ( size_t * p = pKeyFirst; p < pKeyLast; ++p ) {
                             if ( rSet.insert( *p, std::ref(func) ) )
                                 ++m_nInsertSuccess;
@@ -149,7 +155,7 @@ namespace set2 {
                     }
                 }
                 else {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                    for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
                         for ( size_t * p = pKeyLast - 1; p >= pKeyFirst; --p ) {
                             if ( rSet.insert( *p, std::ref(func) ) )
                                 ++m_nInsertSuccess;
@@ -164,21 +170,21 @@ namespace set2 {
         };
 
         template <class Set>
-        class Ensurer: public CppUnitMini::TestThread
+        class Updater: public CppUnitMini::TestThread
         {
             Set&     m_Set;
             typedef typename Set::value_type keyval_type;
 
-            virtual Ensurer *    clone()
+            virtual Updater *    clone()
             {
-                return new Ensurer( *this );
+                return new Updater( *this );
             }
 
-            struct ensure_functor {
+            struct update_functor {
                 size_t  nCreated;
                 size_t  nModified;
 
-                ensure_functor()
+                update_functor()
                     : nCreated(0)
                     , nModified(0)
                 {}
@@ -197,27 +203,27 @@ namespace set2 {
                         ++nCreated;
                     }
                     else {
-                        val.val.nEnsureCall.fetch_add( 1, atomics::memory_order_relaxed );
+                        val.val.nUpdateCall.fetch_add( 1, atomics::memory_order_relaxed );
                         ++nModified;
                     }
                 }
             private:
-                ensure_functor(const ensure_functor& );
+                update_functor(const update_functor& );
             };
 
         public:
-            size_t  m_nEnsureFailed;
-            size_t  m_nEnsureCreated;
-            size_t  m_nEnsureExisted;
+            size_t  m_nUpdateFailed;
+            size_t  m_nUpdateCreated;
+            size_t  m_nUpdateExisted;
             size_t  m_nFunctorCreated;
             size_t  m_nFunctorModified;
 
         public:
-            Ensurer( CppUnitMini::ThreadPool& pool, Set& rSet )
+            Updater( CppUnitMini::ThreadPool& pool, Set& rSet )
                 : CppUnitMini::TestThread( pool )
                 , m_Set( rSet )
             {}
-            Ensurer( Ensurer& src )
+            Updater( Updater& src )
                 : CppUnitMini::TestThread( src )
                 , m_Set( src.m_Set )
             {}
@@ -234,42 +240,43 @@ namespace set2 {
             {
                 Set& rSet = m_Set;
 
-                m_nEnsureCreated =
-                    m_nEnsureExisted =
-                    m_nEnsureFailed = 0;
+                m_nUpdateCreated =
+                    m_nUpdateExisted =
+                    m_nUpdateFailed = 0;
 
                 size_t * pKeyFirst = getTest().m_pKeyFirst;
                 size_t * pKeyLast = getTest().m_pKeyLast;
+                size_t const nPassCount = getTest().c_nThreadPassCount;
 
-                ensure_functor func;
+                update_functor func;
 
                 if ( m_nThreadNo & 1 ) {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                    for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
                         for ( size_t * p = pKeyFirst; p < pKeyLast; ++p ) {
-                            std::pair<bool, bool> ret = rSet.ensure( *p, std::ref( func ) );
+                            std::pair<bool, bool> ret = rSet.update( *p, std::ref( func ), true );
                             if ( ret.first  ) {
                                 if ( ret.second )
-                                    ++m_nEnsureCreated;
+                                    ++m_nUpdateCreated;
                                 else
-                                    ++m_nEnsureExisted;
+                                    ++m_nUpdateExisted;
                             }
                             else
-                                ++m_nEnsureFailed;
+                                ++m_nUpdateFailed;
                         }
                     }
                 }
                 else {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                    for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
                         for ( size_t * p = pKeyLast - 1 ; p >= pKeyFirst; --p ) {
-                            std::pair<bool, bool> ret = rSet.ensure( *p, std::ref( func ) );
+                            std::pair<bool, bool> ret = rSet.update( *p, std::ref( func ), true );
                             if ( ret.first  ) {
                                 if ( ret.second )
-                                    ++m_nEnsureCreated;
+                                    ++m_nUpdateCreated;
                                 else
-                                    ++m_nEnsureExisted;
+                                    ++m_nUpdateExisted;
                             }
                             else
-                                ++m_nEnsureFailed;
+                                ++m_nUpdateFailed;
                         }
                     }
                 }
@@ -312,7 +319,7 @@ namespace set2 {
                     while ( true ) {
                         bool bBkoff = false;
                         {
-                            std::unique_lock< typename value_type::lock_type>    ac( item.val.m_access );
+                            std::unique_lock< typename value_type::lock_type> ac( item.val.m_access );
                             if ( item.val.bInitialized ) {
                                 if ( m_cnt.nKeyExpected == item.val.nKey && m_cnt.nKeyExpected * 8 == item.val.nData )
                                     ++m_cnt.nSuccessItem;
@@ -365,11 +372,12 @@ namespace set2 {
 
                 size_t * pKeyFirst = getTest().m_pKeyFirst;
                 size_t * pKeyLast = getTest().m_pKeyLast;
+                size_t const nPassCount = getTest().c_nThreadPassCount;
 
                 erase_functor   func;
 
                 if ( m_nThreadNo & 1 ) {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                    for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
                         for ( size_t * p = pKeyFirst; p < pKeyLast; ++p ) {
                             func.m_cnt.nKeyExpected = *p;
                             if ( rSet.erase( *p, std::ref(func) ))
@@ -380,7 +388,7 @@ namespace set2 {
                     }
                 }
                 else {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                    for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) {
                         for ( size_t * p = pKeyLast - 1; p >= pKeyFirst; --p ) {
                             func.m_cnt.nKeyExpected = *p;
                             if ( rSet.erase( *p, std::ref(func) ))
@@ -397,26 +405,18 @@ namespace set2 {
         };
 
     protected:
-        template <class Set>
-        void do_test( size_t nLoadFactor )
-        {
-            CPPUNIT_MSG( "Load factor=" << nLoadFactor );
-
-            Set  testSet( c_nMapSize, nLoadFactor );
-            do_test_with( testSet );
-        }
 
         template <class Set>
-        void do_test_with( Set& testSet )
+        void do_test( Set& testSet )
         {
             typedef Inserter<Set>       InserterThread;
             typedef Deleter<Set>        DeleterThread;
-            typedef Ensurer<Set>        EnsurerThread;
+            typedef Updater<Set>        UpdaterThread;
 
-            m_pKeyArr = new size_t[ c_nMapSize ];
+            m_pKeyArr = new size_t[ c_nSetSize ];
             m_pKeyFirst = m_pKeyArr;
-            m_pKeyLast = m_pKeyFirst + c_nMapSize;
-            for ( size_t i = 0; i < c_nMapSize; ++i )
+            m_pKeyLast = m_pKeyFirst + c_nSetSize;
+            for ( size_t i = 0; i < c_nSetSize; ++i )
                 m_pKeyArr[i] = i;
             shuffle( m_pKeyFirst, m_pKeyLast );
 
@@ -425,7 +425,7 @@ namespace set2 {
             CppUnitMini::ThreadPool pool( *this );
             pool.add( new InserterThread( pool, testSet ), c_nInsertThreadCount );
             pool.add( new DeleterThread( pool, testSet ), c_nDeleteThreadCount );
-            pool.add( new EnsurerThread( pool, testSet ), c_nEnsureThreadCount );
+            pool.add( new UpdaterThread( pool, testSet ), c_nUpdateThreadCount );
             pool.run();
             CPPUNIT_MSG( "   Duration=" << pool.avgDuration() );
 
@@ -437,9 +437,9 @@ namespace set2 {
             size_t nDeleteFailed = 0;
             size_t nDelValueSuccess = 0;
             size_t nDelValueFailed = 0;
-            size_t nEnsureFailed = 0;
-            size_t nEnsureCreated = 0;
-            size_t nEnsureModified = 0;
+            size_t nUpdateFailed = 0;
+            size_t nUpdateCreated = 0;
+            size_t nUpdateModified = 0;
             size_t nEnsFuncCreated = 0;
             size_t nEnsFuncModified = 0;
             size_t nTestFunctorRef = 0;
@@ -460,10 +460,10 @@ namespace set2 {
                         nDelValueFailed += p->m_nValueFailed;
                     }
                     else {
-                        EnsurerThread * pEns = static_cast<EnsurerThread *>( *it );
-                        nEnsureCreated += pEns->m_nEnsureCreated;
-                        nEnsureModified += pEns->m_nEnsureExisted;
-                        nEnsureFailed += pEns->m_nEnsureFailed;
+                        UpdaterThread * pEns = static_cast<UpdaterThread *>( *it );
+                        nUpdateCreated += pEns->m_nUpdateCreated;
+                        nUpdateModified += pEns->m_nUpdateExisted;
+                        nUpdateFailed += pEns->m_nUpdateFailed;
                         nEnsFuncCreated += pEns->m_nFunctorCreated;
                         nEnsFuncModified += pEns->m_nFunctorModified;
                     }
@@ -475,18 +475,18 @@ namespace set2 {
                 << " Del succ=" << nDeleteSuccess << "\n"
                 << "          : Ins fail=" << nInsertFailed
                 << " Del fail=" << nDeleteFailed << "\n"
-                << "          : Ensure succ=" << (nEnsureCreated + nEnsureModified) << " fail=" << nEnsureFailed
-                << " create=" << nEnsureCreated << " modify=" << nEnsureModified << "\n"
+                << "          : Update succ=" << (nUpdateCreated + nUpdateModified) << " fail=" << nUpdateFailed
+                << " create=" << nUpdateCreated << " modify=" << nUpdateModified << "\n"
                 << "          Set size=" << testSet.size()
                 );
 
             CPPUNIT_CHECK_EX( nDelValueFailed == 0, "Functor del failed=" << nDelValueFailed );
             CPPUNIT_CHECK_EX( nDelValueSuccess == nDeleteSuccess,  "Delete success=" << nDeleteSuccess << " functor=" << nDelValueSuccess );
 
-            CPPUNIT_CHECK( nEnsureFailed == 0 );
+            CPPUNIT_CHECK( nUpdateFailed == 0 );
 
-            CPPUNIT_CHECK_EX( nEnsureCreated == nEnsFuncCreated, "Ensure created=" << nEnsureCreated << " functor=" << nEnsFuncCreated );
-            CPPUNIT_CHECK_EX( nEnsureModified == nEnsFuncModified, "Ensure modified=" << nEnsureModified << " functor=" << nEnsFuncModified );
+            CPPUNIT_CHECK_EX( nUpdateCreated == nEnsFuncCreated, "Update created=" << nUpdateCreated << " functor=" << nEnsFuncCreated );
+            CPPUNIT_CHECK_EX( nUpdateModified == nEnsFuncModified, "Update modified=" << nUpdateModified << " functor=" << nEnsFuncModified );
 
             // nTestFunctorRef is call count of insert functor
             CPPUNIT_CHECK_EX( nTestFunctorRef == nInsertSuccess, "nInsertSuccess=" << nInsertSuccess << " functor nTestFunctorRef=" << nTestFunctorRef );
@@ -504,81 +504,53 @@ namespace set2 {
         }
 
         template <class Set>
-        void test()
+        void run_test()
         {
             CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount
                 << " delete=" << c_nDeleteThreadCount
-                << " ensure=" << c_nEnsureThreadCount
+                << " ensure=" << c_nUpdateThreadCount
                 << " pass count=" << c_nThreadPassCount
-                << " map size=" << c_nMapSize
+                << " set size=" << c_nSetSize
                 );
 
-            for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
-                do_test<Set>( nLoadFactor );
+            if ( Set::c_bLoadFactorDepended ) {
+                for ( c_nLoadFactor = 1; c_nLoadFactor <= c_nMaxLoadFactor; c_nLoadFactor *= 2 ) {
+                    Set s( *this );
+                    do_test( s );
+                    if ( c_bPrintGCState )
+                        print_gc_state();
+                }
+            }
+            else {
+                Set s( *this );
+                do_test( s );
                 if ( c_bPrintGCState )
                     print_gc_state();
             }
         }
 
-        template <class Set>
-        void test_nolf()
-        {
-            CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount
-                << " delete=" << c_nDeleteThreadCount
-                << " ensure=" << c_nEnsureThreadCount
-                << " pass count=" << c_nThreadPassCount
-                << " map size=" << c_nMapSize
-                );
-
-            Set s;
-            do_test_with( s );
-            if ( c_bPrintGCState )
-                print_gc_state();
-        }
-
-        void setUpParams( const CppUnitMini::TestCfg& cfg ) {
-            c_nInsertThreadCount = cfg.getULong("InsertThreadCount", 4 );
-            c_nDeleteThreadCount = cfg.getULong("DeleteThreadCount", 4 );
-            c_nEnsureThreadCount = cfg.getULong("EnsureThreadCount", 4 );
-            c_nThreadPassCount = cfg.getULong("ThreadPassCount", 4 );
-            c_nMapSize = cfg.getULong("MapSize", 1000000 );
-            c_nMaxLoadFactor = cfg.getULong("MaxLoadFactor", 8 );
-            c_bPrintGCState = cfg.getBool("PrintGCStateFlag", true );
-        }
-
-        void run_MichaelSet(const char *in_name, bool invert = false);
-        void run_SplitList(const char *in_name, bool invert = false);
-        void run_StripedSet(const char *in_name, bool invert = false);
-        void run_RefinableSet(const char *in_name, bool invert = false);
-        void run_CuckooSet(const char *in_name, bool invert = false);
-        void run_SkipListSet(const char *in_name, bool invert = false);
-        void run_EllenBinTreeSet(const char *in_name, bool invert = false);
-
-        typedef CppUnitMini::TestCase Base;
-        virtual void myRun(const char *in_name, bool invert = false)
-        {
-            setUpParams( m_Cfg.get( "Map_InsDel_func" ));
-
-            run_MichaelSet(in_name, invert);
-            run_SplitList(in_name, invert);
-            run_SkipListSet(in_name, invert);
-            run_EllenBinTreeSet(in_name, invert);
-            run_StripedSet(in_name, invert);
-            run_RefinableSet(in_name, invert);
-            run_CuckooSet(in_name, invert);
-
-            endTestCase();
-        }
-
+        void setUpParams( const CppUnitMini::TestCfg& cfg );
 
 #   include "set2/set_defs.h"
     CDSUNIT_DECLARE_MichaelSet
+    CDSUNIT_DECLARE_SkipListSet
     CDSUNIT_DECLARE_SplitList
     CDSUNIT_DECLARE_StripedSet
     CDSUNIT_DECLARE_RefinableSet
     CDSUNIT_DECLARE_CuckooSet
-    CDSUNIT_DECLARE_SkipListSet
     CDSUNIT_DECLARE_EllenBinTreeSet
 
+    CPPUNIT_TEST_SUITE_(Set_InsDel_func, "Map_InsDel_func")
+        CDSUNIT_TEST_MichaelSet
+        CDSUNIT_TEST_SplitList
+        CDSUNIT_TEST_SkipListSet
+        CDSUNIT_TEST_EllenBinTreeSet
+        CDSUNIT_TEST_StripedSet
+        CDSUNIT_TEST_RefinableSet
+        CDSUNIT_TEST_CuckooSet
+
+        //CDSUNIT_TEST_MultiLevelHashSet // the test is not suitable
+    CPPUNIT_TEST_SUITE_END();
+
     };
 } // namespace set2
index ce87451bc39496b6f287523c9389bc8f34dbd202..146cb8e80ee4f10be854ab9fbef3ab40a88bf2f6 100644 (file)
@@ -3,11 +3,10 @@
 #include "set2/set_insdel_func.h"
 #include "set2/set_type_cuckoo.h"
 
-namespace set2 {
-    CDSUNIT_DEFINE_CuckooSet( cc::cuckoo::implementation_tag, Set_InsDel_func )
-
-    CPPUNIT_TEST_SUITE_PART( Set_InsDel_func, run_CuckooSet )
-        CDSUNIT_TEST_CuckooSet
-    CPPUNIT_TEST_SUITE_END_PART()
+#undef TEST_CASE
+#define TEST_CASE(TAG, X)  void Set_InsDel_func::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
 
+namespace set2 {
+    CDSUNIT_DECLARE_CuckooSet
 } // namespace set2
index 58028ca6008d6ae340f91a47ed4ed0a7d0282ed5..c113bc17c0b0d2eecde0dccd9fb615bcacffec1c 100644 (file)
@@ -3,11 +3,10 @@
 #include "set2/set_insdel_func.h"
 #include "set2/set_type_ellen_bintree.h"
 
-namespace set2 {
-    CDSUNIT_DEFINE_EllenBinTreeSet( cc::ellen_bintree::implementation_tag, Set_InsDel_func )
-
-    CPPUNIT_TEST_SUITE_PART( Set_InsDel_func, run_EllenBinTreeSet )
-        CDSUNIT_TEST_EllenBinTreeSet
-    CPPUNIT_TEST_SUITE_END_PART()
+#undef TEST_CASE
+#define TEST_CASE(TAG, X)  void Set_InsDel_func::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
 
+namespace set2 {
+    CDSUNIT_DECLARE_EllenBinTreeSet
 } // namespace set2
diff --git a/tests/unit/set2/set_insdel_func_michael.cpp b/tests/unit/set2/set_insdel_func_michael.cpp
new file mode 100644 (file)
index 0000000..928fb2b
--- /dev/null
@@ -0,0 +1,12 @@
+//$$CDS-header$$
+
+#include "set2/set_insdel_func.h"
+#include "set2/set_type_michael.h"
+
+#undef TEST_CASE
+#define TEST_CASE(TAG, X)  void Set_InsDel_func::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
+
+namespace set2 {
+    CDSUNIT_DECLARE_MichaelSet
+} // namespace set2
diff --git a/tests/unit/set2/set_insdel_func_refinable.cpp b/tests/unit/set2/set_insdel_func_refinable.cpp
deleted file mode 100644 (file)
index c990bfd..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-//$$CDS-header$$
-
-#include "set2/set_insdel_func.h"
-#include "set2/set_type_striped.h"
-
-namespace set2 {
-    CDSUNIT_DEFINE_RefinableSet( cc::striped_set::implementation_tag, Set_InsDel_func )
-
-    CPPUNIT_TEST_SUITE_PART( Set_InsDel_func, run_RefinableSet )
-        CDSUNIT_TEST_RefinableSet
-    CPPUNIT_TEST_SUITE_END_PART()
-
-} // namespace set2
index cc77d2a75eb9510f7ee7c2da48807bb127184d16..5f97ae8a9c2272a23f66d48f17a020df6279d077 100644 (file)
@@ -3,10 +3,10 @@
 #include "set2/set_insdel_func.h"
 #include "set2/set_type_skip_list.h"
 
-namespace set2 {
-    CDSUNIT_DEFINE_SkipListSet(cc::skip_list::implementation_tag, Set_InsDel_func)
+#undef TEST_CASE
+#define TEST_CASE(TAG, X)  void Set_InsDel_func::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
 
-    CPPUNIT_TEST_SUITE_PART( Set_InsDel_func, run_SkipListSet )
-        CDSUNIT_TEST_SkipListSet
-    CPPUNIT_TEST_SUITE_END_PART()
+namespace set2 {
+    CDSUNIT_DECLARE_SkipListSet
 } // namespace set2
index c80a878a19c18399fd24d7a3ce01e4ec5e4c05c9..5508f0f09499b6b400d85adc80374449600a0908 100644 (file)
@@ -3,11 +3,10 @@
 #include "set2/set_insdel_func.h"
 #include "set2/set_type_split_list.h"
 
-namespace set2 {
-    CDSUNIT_DEFINE_SplitList(cc::split_list::implementation_tag, Set_InsDel_func)
-
-    CPPUNIT_TEST_SUITE_PART( Set_InsDel_func, run_SplitList )
-        CDSUNIT_TEST_SplitList
-    CPPUNIT_TEST_SUITE_END_PART()
+#undef TEST_CASE
+#define TEST_CASE(TAG, X)  void Set_InsDel_func::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
 
+namespace set2 {
+    CDSUNIT_DECLARE_SplitList
 } // namespace set2
index 492492f2c3c3fee3718d91cad90c935e1a160b62..e86d12fdc00642c1d6d58391fd7738a10dc2d664 100644 (file)
@@ -3,11 +3,11 @@
 #include "set2/set_insdel_func.h"
 #include "set2/set_type_striped.h"
 
-namespace set2 {
-    CDSUNIT_DEFINE_StripedSet( cc::striped_set::implementation_tag, Set_InsDel_func )
-
-    CPPUNIT_TEST_SUITE_PART( Set_InsDel_func, run_StripedSet )
-        CDSUNIT_TEST_StripedSet
-    CPPUNIT_TEST_SUITE_END_PART()
+#undef TEST_CASE
+#define TEST_CASE(TAG, X)  void Set_InsDel_func::X() { run_test<typename set_type< TAG, key_type, value_type>::X>(); }
+#include "set2/set_defs.h"
 
+namespace set2 {
+    CDSUNIT_DECLARE_StripedSet
+    CDSUNIT_DECLARE_RefinableSet
 } // namespace set2
index 7bf31aee4d402af5a4ef675b6fd537d640cde2e0..15be6176a339dedc7908a11c693a58bd1c208990 100644 (file)
 
 namespace set2 {
 
+    struct tag_StripedSet;
+
     template <typename Key, typename Val>
-    struct set_type< cc::striped_set::implementation_tag, Key, Val >: public set_type_base< Key, Val >
+    struct set_type< tag_StripedSet, Key, Val >: public set_type_base< Key, Val >
     {
         typedef set_type_base< Key, Val > base_class;
         typedef typename base_class::key_val key_val;
@@ -57,15 +59,22 @@ namespace set2 {
 
             resizing_policy_t   m_placeHolder;
         public:
-            StripedHashSet_seq( size_t nCapacity, size_t nLoadFactor )
-                : base_class( nCapacity / nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( nLoadFactor )) )
+            template <class Config>
+            StripedHashSet_seq( Config const& cfg )
+                : base_class( cfg.c_nSetSize / cfg.c_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nLoadFactor )) )
             {}
 
+            /*
             template <typename Q, typename Less>
-            bool erase_with( Q const& v, Less /*pred*/ )
+            bool erase_with( Q const& v, Less pred )
             {
                 return base_class::erase( v );
             }
+            */
+
+            // for testing
+            static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+            static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
         };
 
         template <class BucketEntry, typename... Options>
@@ -85,15 +94,22 @@ namespace set2 {
 
             resizing_policy_t   m_placeHolder;
         public:
-            StripedHashSet_seq_rational( size_t nCapacity, size_t nDenominator ) // LoadFactor = 1 / nDenominator
-                : base_class( nCapacity * nDenominator / 16, *(new(&m_placeHolder) resizing_policy_t( 1, nDenominator )) )
+            template <class Config>
+            StripedHashSet_seq_rational( Config const& cfg ) // LoadFactor = 1 / nDenominator
+                : base_class( cfg.c_nSetSize / cfg.c_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( 1, cfg.c_nLoadFactor )) )
             {}
 
+            /*
             template <typename Q, typename Less>
-            bool erase_with( Q const& v, Less /*pred*/ )
+            bool erase_with( Q const& v, Less pred )
             {
                 return base_class::erase( v );
             }
+            */
+
+            // for testing
+            static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+            static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
         };
 
         // for non-sequential ordered containers
@@ -114,15 +130,22 @@ namespace set2 {
 
             resizing_policy_t   m_placeHolder;
         public:
-            StripedHashSet_ord( size_t /*nCapacity*/, size_t nLoadFactor )
-                : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( nLoadFactor * 1024 )) )
+            template <class Config>
+            StripedHashSet_ord( Config const& cfg )
+                : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nMaxLoadFactor * 1024 )) )
             {}
 
+            /*
             template <typename Q, typename Less>
-            bool erase_with( Q const& v, Less /*pred*/ )
+            bool erase_with( Q const& v, Less pred )
             {
                 return base_class::erase( v );
             }
+            */
+
+            // for testing
+            static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+            static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
         };
 
         template <class BucketEntry, typename... Options>
@@ -142,15 +165,22 @@ namespace set2 {
 
             resizing_policy_t   m_placeHolder;
         public:
-            StripedHashSet_ord_rational( size_t /*nCapacity*/, size_t nDenominator ) // LoadFactor = 1 / nDenominator
-                : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( 1024, nDenominator )) )
+            template <class Config>
+            StripedHashSet_ord_rational( Config const& cfg ) // LoadFactor = 1 / nDenominator
+                : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( 1024, cfg.c_nLoadFactor )))
             {}
 
+            /*
             template <typename Q, typename Less>
-            bool erase_with( Q const& v, Less /*pred*/ )
+            bool erase_with( Q const& v, Less pred )
             {
                 return base_class::erase( v );
             }
+            */
+
+            // for testing
+            static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+            static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
         };
 
         typedef StripedHashSet_seq<
@@ -301,15 +331,22 @@ namespace set2 {
 
             resizing_policy_t   m_placeHolder;
         public:
-            RefinableHashSet_seq( size_t nCapacity, size_t nLoadFactor )
-                : base_class( nCapacity / nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( nLoadFactor )) )
+            template <class Config>
+            RefinableHashSet_seq( Config const& cfg )
+                : base_class( cfg.c_nSetSize / cfg.c_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nLoadFactor )) )
             {}
 
+            /*
             template <typename Q, typename Less>
-            bool erase_with( Q const& v, Less /*pred*/ )
+            bool erase_with( Q const& v, Less pred )
             {
                 return base_class::erase( v );
             }
+            */
+
+            // for testing
+            static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+            static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
         };
 
         template <class BucketEntry, typename... Options>
@@ -329,15 +366,22 @@ namespace set2 {
 
             resizing_policy_t   m_placeHolder;
         public:
-            RefinableHashSet_seq_rational( size_t nCapacity, size_t nDenominator ) // LoadFactor = 1 / nDenominator
-                : base_class( nCapacity * nDenominator / 16, *(new(&m_placeHolder) resizing_policy_t( 1, nDenominator )) )
+            template <class Config>
+            RefinableHashSet_seq_rational( Config const& cfg ) // LoadFactor = 1 / nDenominator
+                : base_class( cfg.c_nSetSize / cfg.c_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( 1, cfg.c_nLoadFactor )))
             {}
 
+            /*
             template <typename Q, typename Less>
-            bool erase_with( Q const& v, Less /*pred*/ )
+            bool erase_with( Q const& v, Less pred )
             {
                 return base_class::erase( v );
             }
+            */
+
+            // for testing
+            static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+            static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
         };
 
         // for non-sequential ordered containers
@@ -358,15 +402,22 @@ namespace set2 {
 
             resizing_policy_t   m_placeHolder;
         public:
-            RefinableHashSet_ord( size_t /*nCapacity*/, size_t nLoadFactor )
-                : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( nLoadFactor * 1024 )) )
+            template <class Config>
+            RefinableHashSet_ord( Config const& cfg )
+                : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nMaxLoadFactor * 1024 )) )
             {}
 
+            /*
             template <typename Q, typename Less>
-            bool erase_with( Q const& v, Less /*pred*/ )
+            bool erase_with( Q const& v, Less pred )
             {
                 return base_class::erase( v );
             }
+            */
+
+            // for testing
+            static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+            static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
         };
 
         template <class BucketEntry, typename... Options>
@@ -386,15 +437,22 @@ namespace set2 {
 
             resizing_policy_t   m_placeHolder;
         public:
-            RefinableHashSet_ord_rational( size_t /*nCapacity*/, size_t nDenominator ) // LoadFactor = 1 / nDenominator
-                : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( 1024, nDenominator )) )
+            template <class Config>
+            RefinableHashSet_ord_rational( Config const& cfg ) // LoadFactor = 1 / nDenominator
+                : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( 1024, cfg.c_nLoadFactor )))
             {}
 
+            /*
             template <typename Q, typename Less>
-            bool erase_with( Q const& v, Less /*pred*/ )
+            bool erase_with( Q const& v, Less pred )
             {
                 return base_class::erase( v );
             }
+            */
+
+            // for testing
+            static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+            static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
         };
 
         typedef RefinableHashSet_seq<