<ClCompile Include="..\..\..\tests\unit\map2\map_delodd_michael.cpp">\r
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">false</ExcludedFromBuild>\r
</ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_delodd_multilevelhashmap.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_delodd_skip.cpp">\r
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">false</ExcludedFromBuild>\r
</ClCompile>\r
<ClCompile Include="..\..\..\tests\unit\map2\map_delodd_michael.cpp">\r
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">false</ExcludedFromBuild>\r
</ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_delodd_multilevelhashmap.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_delodd_skip.cpp">\r
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">false</ExcludedFromBuild>\r
</ClCompile>\r
tests/unit/map2/map_insdelfind_striped.cpp \
tests/unit/map2/map_insdelfind_std.cpp \
tests/unit/map2/map_delodd.cpp \
- tests/unit/map2/map_delodd_michael.cpp \
tests/unit/map2/map_delodd_bronsonavltree.cpp \
+ tests/unit/map2/map_delodd_cuckoo.cpp \
tests/unit/map2/map_delodd_ellentree.cpp \
- tests/unit/map2/map_delodd_split.cpp \
+ tests/unit/map2/map_delodd_michael.cpp \
+ tests/unit/map2/map_delodd_multilevelhashmap.cpp \
tests/unit/map2/map_delodd_skip.cpp \
- tests/unit/map2/map_delodd_cuckoo.cpp \
+ tests/unit/map2/map_delodd_split.cpp \
CuckooProbesetSize=8\r
# 0 - use default\r
CuckooProbesetThreshold=0 \r
+# *** MultiLevelHashMap properties\r
+MultiLevelMapHeadBits=8\r
+MultiLevelMapArrayBits=4\r
CuckooProbesetSize=16\r
# 0 - use default\r
CuckooProbesetThreshold=0 \r
+# *** MultiLevelHashMap properties\r
+MultiLevelMapHeadBits=8\r
+MultiLevelMapArrayBits=4\r
CuckooProbesetSize=16\r
# 0 - use default\r
CuckooProbesetThreshold=0 \r
+# *** MultiLevelHashMap properties\r
+MultiLevelMapHeadBits=10\r
+MultiLevelMapArrayBits=4\r
map_insdelfind_striped.cpp
map_insdelfind_std.cpp
map_delodd.cpp
- map_delodd_michael.cpp
map_delodd_bronsonavltree.cpp
+ map_delodd_cuckoo.cpp
map_delodd_ellentree.cpp
+ map_delodd_michael.cpp
+ map_delodd_multilevelhashmap.cpp
map_delodd_split.cpp
map_delodd_skip.cpp
- map_delodd_cuckoo.cpp
)
add_executable(${PACKAGE_NAME} ${CDSUNIT_MAP_SOURCES} $<TARGET_OBJECTS:${TEST_COMMON}>)
// MultiLevelHashMap
#undef CDSUNIT_DECLARE_MultiLevelHashMap64
+#undef CDSUNIT_DECLARE_MultiLevelHashMap64_RCU_Signal
+
#if CDS_BUILD_BITS == 64
+# ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+# define CDSUNIT_DECLARE_MultiLevelHashMap64_RCU_Signal \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_shb_city64) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_shb_city64_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_sht_city64) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_sht_city64_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_shb_city128) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_shb_city128_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_sht_city128) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_sht_city128_stat) \
+
+# else
+# define CDSUNIT_DECLARE_MultiLevelHashMap64_RCU_Signal
+# endif
+
# define CDSUNIT_DECLARE_MultiLevelHashMap64 \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city64) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city64_stat) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city64) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city64_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpi_city64) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpi_city64_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpb_city64) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpb_city64_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpt_city64) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpt_city64_stat) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city128) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_city128_stat) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city128) \
- TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city128_stat)
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_city128_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpi_city128) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpi_city128_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpb_city128) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpb_city128_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpt_city128) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpt_city128_stat) \
+ CDSUNIT_DECLARE_MultiLevelHashMap64_RCU_Signal
+
#else
# define CDSUNIT_DECLARE_MultiLevelHashMap64
#endif
#undef CDSUNIT_DECLARE_MultiLevelHashMap
-#define CDSUNIT_DECLARE_MultiLevelHashMap \
+#undef CDSUNIT_DECLARE_MultiLevelHashMap_hash
+#undef CDSUNIT_DECLARE_MultiLevelHashMap_hash_RCU_Signal
+#undef CDSUNIT_DECLARE_MultiLevelHashMap_stdhash
+#undef CDSUNIT_DECLARE_MultiLevelHashMap_stdhash_RCU_Signal
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+# define CDSUNIT_DECLARE_MultiLevelHashMap_stdhash_RCU_Signal \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_shb_stdhash) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_shb_stdhash_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_sht_stdhash) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_sht_stdhash_stat) \
+
+# define CDSUNIT_DECLARE_MultiLevelHashMap_hash_RCU_Signal \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_shb_md5) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_shb_md5_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_sht_md5) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_sht_md5_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_shb_sha256) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_shb_sha256_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_sht_sha256) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_sht_sha256_stat) \
+
+#else
+# define CDSUNIT_DECLARE_MultiLevelHashMap_stdhash_RCU_Signal
+# define CDSUNIT_DECLARE_MultiLevelHashMap_hash_RCU_Signal
+#endif
+
+#define CDSUNIT_DECLARE_MultiLevelHashMap_stdhash \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_stdhash) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_stdhash_stat) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_stdhash) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_stdhash_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpi_stdhash) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpi_stdhash_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpb_stdhash) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpb_stdhash_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpt_stdhash) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpt_stdhash_stat) \
+ CDSUNIT_DECLARE_MultiLevelHashMap_stdhash_RCU_Signal
+
+#define CDSUNIT_DECLARE_MultiLevelHashMap_hash \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_md5) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_md5_stat) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_md5) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_md5_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpi_md5) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpi_md5_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpb_md5) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpb_md5_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpt_md5) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpt_md5_stat) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_sha256) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_hp_sha256_stat) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_sha256) \
TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_dhp_sha256_stat) \
- CDSUNIT_DECLARE_MultiLevelHashMap64
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpi_sha256) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpi_sha256_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpb_sha256) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpb_sha256_stat) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpt_sha256) \
+ TEST_CASE(tag_MultiLevelHashMap, MultiLevelHashMap_rcu_gpt_sha256_stat) \
+ CDSUNIT_DECLARE_MultiLevelHashMap_hash_RCU_Signal \
+ CDSUNIT_DECLARE_MultiLevelHashMap64 \
+
+#define CDSUNIT_DECLARE_MultiLevelHashMap \
+ CDSUNIT_DECLARE_MultiLevelHashMap_stdhash \
+ CDSUNIT_DECLARE_MultiLevelHashMap_hash \
#undef CDSUNIT_TEST_MultiLevelHashMap64
+#undef CDSUNIT_TEST_MultiLevelHashMap64_RCU_Signal
#if CDS_BUILD_BITS == 64
+# ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+# define CDSUNIT_TEST_MultiLevelHashMap64_RCU_Signal \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_shb_city64) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_shb_city64_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_sht_city64) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_sht_city64_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_shb_city128) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_shb_city128_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_sht_city128) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_sht_city128_stat) \
+
+# else
+# define CDSUNIT_TEST_MultiLevelHashMap64_RCU_Signal
+# endif
+
# define CDSUNIT_TEST_MultiLevelHashMap64 \
CPPUNIT_TEST(MultiLevelHashMap_hp_city64) \
CPPUNIT_TEST(MultiLevelHashMap_hp_city64_stat) \
CPPUNIT_TEST(MultiLevelHashMap_dhp_city64) \
CPPUNIT_TEST(MultiLevelHashMap_dhp_city64_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpi_city64) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpi_city64_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpb_city64) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpb_city64_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpt_city64) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpt_city64_stat) \
CPPUNIT_TEST(MultiLevelHashMap_hp_city128) \
CPPUNIT_TEST(MultiLevelHashMap_hp_city128_stat) \
CPPUNIT_TEST(MultiLevelHashMap_dhp_city128) \
- CPPUNIT_TEST(MultiLevelHashMap_dhp_city128_stat)
+ CPPUNIT_TEST(MultiLevelHashMap_dhp_city128_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpi_city128) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpi_city128_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpb_city128) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpb_city128_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpt_city128) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpt_city128_stat) \
+ CDSUNIT_TEST_MultiLevelHashMap64_RCU_Signal
+
#else
# define CDSUNIT_TEST_MultiLevelHashMap64
#endif
-#undef CDSUNIT_TEST_MultiLevelHashMap
-#define CDSUNIT_TEST_MultiLevelHashMap \
+#undef CDSUNIT_TEST_MultiLevelHashMap_hash
+#undef CDSUNIT_TEST_MultiLevelHashMap_hash_RCU_Signal
+#undef CDSUNIT_TEST_MultiLevelHashMap_stdhash
+#undef CDSUNIT_TEST_MultiLevelHashMap_stdhash_RCU_Signal
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+# define CDSUNIT_TEST_MultiLevelHashMap_stdhash_RCU_Signal \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_shb_stdhash) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_shb_stdhash_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_sht_stdhash) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_sht_stdhash_stat) \
+
+# define CDSUNIT_TEST_MultiLevelHashMap_hash_RCU_Signal \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_shb_md5) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_shb_md5_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_sht_md5) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_sht_md5_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_shb_sha256) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_shb_sha256_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_sht_sha256) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_sht_sha256_stat) \
+
+#else
+# define CDSUNIT_TEST_MultiLevelHashMap_hash_RCU_Signal
+# define CDSUNIT_TEST_MultiLevelHashMap_stdhash_RCU_Signal
+#endif
+
+#define CDSUNIT_TEST_MultiLevelHashMap_stdhash \
CPPUNIT_TEST(MultiLevelHashMap_hp_stdhash) \
CPPUNIT_TEST(MultiLevelHashMap_hp_stdhash_stat) \
CPPUNIT_TEST(MultiLevelHashMap_dhp_stdhash) \
CPPUNIT_TEST(MultiLevelHashMap_dhp_stdhash_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpi_stdhash) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpi_stdhash_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpb_stdhash) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpb_stdhash_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpt_stdhash) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpt_stdhash_stat) \
+ CDSUNIT_TEST_MultiLevelHashMap_stdhash_RCU_Signal
+
+#define CDSUNIT_TEST_MultiLevelHashMap_hash \
CPPUNIT_TEST(MultiLevelHashMap_hp_md5) \
CPPUNIT_TEST(MultiLevelHashMap_hp_md5_stat) \
CPPUNIT_TEST(MultiLevelHashMap_dhp_md5) \
CPPUNIT_TEST(MultiLevelHashMap_dhp_md5_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpi_md5) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpi_md5_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpb_md5) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpb_md5_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpt_md5) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpt_md5_stat) \
CPPUNIT_TEST(MultiLevelHashMap_hp_sha256) \
CPPUNIT_TEST(MultiLevelHashMap_hp_sha256_stat) \
CPPUNIT_TEST(MultiLevelHashMap_dhp_sha256) \
CPPUNIT_TEST(MultiLevelHashMap_dhp_sha256_stat) \
- CDSUNIT_TEST_MultiLevelHashMap64
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpi_sha256) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpi_sha256_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpb_sha256) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpb_sha256_stat) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpt_sha256) \
+ CPPUNIT_TEST(MultiLevelHashMap_rcu_gpt_sha256_stat) \
+ CDSUNIT_TEST_MultiLevelHashMap_hash_RCU_Signal \
+ CDSUNIT_TEST_MultiLevelHashMap64 \
+#define CDSUNIT_TEST_MultiLevelHashMap \
+ CDSUNIT_TEST_MultiLevelHashMap_stdhash \
+ CDSUNIT_TEST_MultiLevelHashMap_hash \
c_nCuckooProbesetSize = cfg.getSizeT("CuckooProbesetSize", c_nCuckooProbesetSize );
c_nCuckooProbesetThreshold = cfg.getSizeT("CuckooProbesetThreshold", c_nCuckooProbesetThreshold );
+ c_nMultiLevelMap_HeadBits = cfg.getSizeT("MultiLevelMapHeadBits", c_nMultiLevelMap_HeadBits);
+ c_nMultiLevelMap_ArrayBits = cfg.getSizeT("MultiLevelMapArrayBits", c_nMultiLevelMap_ArrayBits);
if ( c_nInsThreadCount == 0 )
c_nInsThreadCount = cds::OS::topology::processor_count();
size_t c_nExtractThreadCount = 4; // extract thread count
size_t c_nMapSize = 1000000; // max map size
size_t c_nMaxLoadFactor = 8; // maximum load factor
+
size_t c_nCuckooInitialSize = 1024;// initial size for CuckooMap
size_t c_nCuckooProbesetSize = 16; // CuckooMap probeset size (only for list-based probeset)
size_t c_nCuckooProbesetThreshold = 0; // CUckooMap probeset threshold (0 - use default)
+ size_t c_nMultiLevelMap_HeadBits = 10;
+ size_t c_nMultiLevelMap_ArrayBits = 4;
+
bool c_bPrintGCState = true;
size_t c_nLoadFactor; // current load factor
virtual void init() { cds::threading::Manager::attachThread() ; }
virtual void fini() { cds::threading::Manager::detachThread() ; }
+ template <bool>
+ struct eraser {
+ static bool erase(Map& map, size_t key, size_t /*insThread*/)
+ {
+ return map.erase_with(key, key_less());
+ }
+ };
+
+ template <>
+ struct eraser<true>
+ {
+ static bool erase(Map& map, size_t key, size_t insThread)
+ {
+ return map.erase(key_type(key, insThread));
+ }
+ };
+
virtual void test()
{
Map& rMap = m_Map;
for ( size_t k = 0; k < nInsThreadCount; ++k ) {
for ( size_t i = 0; i < arrData.size(); ++i ) {
if ( arrData[i] & 1 ) {
- if ( rMap.erase_with( arrData[i], key_less() ))
- ++m_nDeleteSuccess;
- else
- ++m_nDeleteFailed;
+ if ( Map::c_bEraseExactKey ) {
+ for (size_t key = 0; key < nInsThreadCount; ++key) {
+ if ( eraser<Map::c_bEraseExactKey>::erase( rMap, arrData[i], key ))
+ ++m_nDeleteSuccess;
+ else
+ ++m_nDeleteFailed;
+ }
+ }
+ else {
+ if ( eraser<Map::c_bEraseExactKey>::erase(rMap, arrData[i], 0) )
+ ++m_nDeleteSuccess;
+ else
+ ++m_nDeleteFailed;
+ }
}
}
if ( getTest().m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 )
for ( size_t k = 0; k < nInsThreadCount; ++k ) {
for ( size_t i = arrData.size() - 1; i > 0; --i ) {
if ( arrData[i] & 1 ) {
- if ( rMap.erase_with( arrData[i], key_less() ))
- ++m_nDeleteSuccess;
- else
- ++m_nDeleteFailed;
+ if ( Map::c_bEraseExactKey ) {
+ for (size_t key = 0; key < nInsThreadCount; ++key) {
+ if (eraser<Map::c_bEraseExactKey>::erase(rMap, arrData[i], key))
+ ++m_nDeleteSuccess;
+ else
+ ++m_nDeleteFailed;
+ }
+ }
+ else {
+ if (eraser<Map::c_bEraseExactKey>::erase(rMap, arrData[i], 0))
+ ++m_nDeleteSuccess;
+ else
+ ++m_nDeleteFailed;
+ }
}
}
if ( getTest().m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 )
virtual void init() { cds::threading::Manager::attachThread() ; }
virtual void fini() { cds::threading::Manager::detachThread() ; }
+ template <bool>
+ struct extractor {
+ static typename Map::guarded_ptr extract(Map& map, size_t key, size_t /*insThread*/)
+ {
+ return map.extract_with(key, key_less());
+ }
+ };
+
+ template <>
+ struct extractor<true>
+ {
+ static typename Map::guarded_ptr extract(Map& map, size_t key, size_t insThread)
+ {
+ return map.extract(key_type(key, insThread));
+ }
+ };
+
virtual void test()
{
Map& rMap = m_Map;
for ( size_t k = 0; k < nInsThreadCount; ++k ) {
for ( size_t i = 0; i < arrData.size(); ++i ) {
if ( arrData[i] & 1 ) {
- gp = rMap.extract_with( arrData[i], key_less());
+ gp = extractor< Map::c_bEraseExactKey >::extract( rMap, arrData[i], k );
if ( gp )
++m_nDeleteSuccess;
else
for ( size_t k = 0; k < nInsThreadCount; ++k ) {
for ( size_t i = arrData.size() - 1; i > 0; --i ) {
if ( arrData[i] & 1 ) {
- gp = rMap.extract_with( arrData[i], key_less());
+ gp = extractor< Map::c_bEraseExactKey >::extract( rMap, arrData[i], k);
if ( gp )
++m_nDeleteSuccess;
else
virtual void init() { cds::threading::Manager::attachThread() ; }
virtual void fini() { cds::threading::Manager::detachThread() ; }
+ template <bool>
+ struct extractor {
+ static typename Map::exempt_ptr extract( Map& map, size_t key, size_t /*insThread*/ )
+ {
+ return map.extract_with( key, key_less());
+ }
+ };
+
+ template <>
+ struct extractor<true>
+ {
+ static typename Map::exempt_ptr extract(Map& map, size_t key, size_t insThread)
+ {
+ return map.extract( key_type(key, insThread));
+ }
+ };
+
virtual void test()
{
Map& rMap = m_Map;
if ( Map::c_bExtractLockExternal ) {
{
typename Map::rcu_lock l;
- xp = rMap.extract_with( arrData[i], key_less() );
+ xp = extractor<Map::c_bEraseExactKey>::extract( rMap, arrData[i], k );
if ( xp )
++m_nDeleteSuccess;
else
}
}
else {
- xp = rMap.extract_with( arrData[i], key_less() );
+ xp = extractor<Map::c_bEraseExactKey>::extract( rMap, arrData[i], k);
if ( xp )
++m_nDeleteSuccess;
else
if ( Map::c_bExtractLockExternal ) {
{
typename Map::rcu_lock l;
- xp = rMap.extract_with( arrData[i], key_less() );
+ xp = extractor<Map::c_bEraseExactKey>::extract(rMap, arrData[i], k);
if ( xp )
++m_nDeleteSuccess;
else
}
}
else {
- xp = rMap.extract_with( arrData[i], key_less() );
+ xp = extractor<Map::c_bEraseExactKey>::extract(rMap, arrData[i], k);
if ( xp )
++m_nDeleteSuccess;
else
CDSUNIT_DECLARE_SkipListMap
CDSUNIT_DECLARE_EllenBinTreeMap
CDSUNIT_DECLARE_BronsonAVLTreeMap
+ CDSUNIT_DECLARE_MultiLevelHashMap64
CDSUNIT_DECLARE_CuckooMap
- // This test is not suitable for MultiLevelHashMap
- //CDSUNIT_DECLARE_MultiLevelHashMap
-
CPPUNIT_TEST_SUITE(Map_DelOdd)
CDSUNIT_TEST_MichaelMap
CDSUNIT_TEST_SplitList
CDSUNIT_TEST_SkipListMap
CDSUNIT_TEST_EllenBinTreeMap
CDSUNIT_TEST_BronsonAVLTreeMap
+ CDSUNIT_TEST_MultiLevelHashMap64
CDSUNIT_TEST_CuckooMap
-
- //CDSUNIT_TEST_MultiLevelHashMap // the test is not suitable
CPPUNIT_TEST_SUITE_END();
// Not implemented yet
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_delodd.h"
+#include "map2/map_type_multilevel_hashmap.h"
+
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_DelOdd::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
+
+namespace map2 {
+ CDSUNIT_DECLARE_MultiLevelHashMap64
+} // namespace map2
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = true;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
+ static CDS_CONSTEXPR bool const c_bEraseExactKey = false;
};
struct tag_BronsonAVLTreeMap;
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = false;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
+ static CDS_CONSTEXPR bool const c_bEraseExactKey = false;
};
struct tag_CuckooMap;
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = true;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
+ static CDS_CONSTEXPR bool const c_bEraseExactKey = false;
};
struct tag_EllenBinTreeMap;
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = true;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
+ static CDS_CONSTEXPR bool const c_bEraseExactKey = false;
};
struct tag_MichaelHashMap;
#include <cds/container/multilevel_hashmap_hp.h>
#include <cds/container/multilevel_hashmap_dhp.h>
+#include <cds/container/multilevel_hashmap_rcu.h>
#include "print_multilevel_hashset_stat.h"
#include "hashing/hash_func.h"
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = true;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
+ static CDS_CONSTEXPR bool const c_bEraseExactKey = true;
};
struct tag_MultiLevelHashMap;
typedef MultiLevelHashMap< cds::gc::HP, Key, Value > MultiLevelHashMap_hp_stdhash;
typedef MultiLevelHashMap< cds::gc::DHP, Key, Value > MultiLevelHashMap_dhp_stdhash;
+ typedef MultiLevelHashMap< rcu_gpi, Key, Value > MultiLevelHashMap_rcu_gpi_stdhash;
+ typedef MultiLevelHashMap< rcu_gpb, Key, Value > MultiLevelHashMap_rcu_gpb_stdhash;
+ typedef MultiLevelHashMap< rcu_gpt, Key, Value > MultiLevelHashMap_rcu_gpt_stdhash;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef MultiLevelHashMap< rcu_shb, Key, Value > MultiLevelHashMap_rcu_shb_stdhash;
+ typedef MultiLevelHashMap< rcu_sht, Key, Value > MultiLevelHashMap_rcu_sht_stdhash;
+#endif
struct traits_MultiLevelHashMap_stat: public cc::multilevel_hashmap::make_traits<
co::stat< cc::multilevel_hashmap::stat<>>
typedef MultiLevelHashMap< cds::gc::HP, Key, Value, traits_MultiLevelHashMap_stat > MultiLevelHashMap_hp_stdhash_stat;
typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_stat > MultiLevelHashMap_dhp_stdhash_stat;
+ typedef MultiLevelHashMap< rcu_gpi, Key, Value, traits_MultiLevelHashMap_stat > MultiLevelHashMap_rcu_gpi_stdhash_stat;
+ typedef MultiLevelHashMap< rcu_gpb, Key, Value, traits_MultiLevelHashMap_stat > MultiLevelHashMap_rcu_gpb_stdhash_stat;
+ typedef MultiLevelHashMap< rcu_gpt, Key, Value, traits_MultiLevelHashMap_stat > MultiLevelHashMap_rcu_gpt_stdhash_stat;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef MultiLevelHashMap< rcu_shb, Key, Value, traits_MultiLevelHashMap_stat > MultiLevelHashMap_rcu_shb_stdhash_stat;
+ typedef MultiLevelHashMap< rcu_sht, Key, Value, traits_MultiLevelHashMap_stat > MultiLevelHashMap_rcu_sht_stdhash_stat;
+#endif
// SHA256
struct traits_MultiLevelHashMap_sha256 : public cc::multilevel_hashmap::traits
};
typedef MultiLevelHashMap< cds::gc::HP, Key, Value, traits_MultiLevelHashMap_sha256 > MultiLevelHashMap_hp_sha256;
typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_sha256 > MultiLevelHashMap_dhp_sha256;
+ typedef MultiLevelHashMap< rcu_gpi, Key, Value, traits_MultiLevelHashMap_sha256 > MultiLevelHashMap_rcu_gpi_sha256;
+ typedef MultiLevelHashMap< rcu_gpb, Key, Value, traits_MultiLevelHashMap_sha256 > MultiLevelHashMap_rcu_gpb_sha256;
+ typedef MultiLevelHashMap< rcu_gpt, Key, Value, traits_MultiLevelHashMap_sha256 > MultiLevelHashMap_rcu_gpt_sha256;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef MultiLevelHashMap< rcu_shb, Key, Value, traits_MultiLevelHashMap_sha256 > MultiLevelHashMap_rcu_shb_sha256;
+ typedef MultiLevelHashMap< rcu_sht, Key, Value, traits_MultiLevelHashMap_sha256 > MultiLevelHashMap_rcu_sht_sha256;
+#endif
struct traits_MultiLevelHashMap_sha256_stat : public traits_MultiLevelHashMap_sha256
{
};
typedef MultiLevelHashMap< cds::gc::HP, Key, Value, traits_MultiLevelHashMap_sha256_stat > MultiLevelHashMap_hp_sha256_stat;
typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_sha256_stat > MultiLevelHashMap_dhp_sha256_stat;
+ typedef MultiLevelHashMap< rcu_gpi, Key, Value, traits_MultiLevelHashMap_sha256_stat > MultiLevelHashMap_rcu_gpi_sha256_stat;
+ typedef MultiLevelHashMap< rcu_gpb, Key, Value, traits_MultiLevelHashMap_sha256_stat > MultiLevelHashMap_rcu_gpb_sha256_stat;
+ typedef MultiLevelHashMap< rcu_gpt, Key, Value, traits_MultiLevelHashMap_sha256_stat > MultiLevelHashMap_rcu_gpt_sha256_stat;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef MultiLevelHashMap< rcu_shb, Key, Value, traits_MultiLevelHashMap_sha256_stat > MultiLevelHashMap_rcu_shb_sha256_stat;
+ typedef MultiLevelHashMap< rcu_sht, Key, Value, traits_MultiLevelHashMap_sha256_stat > MultiLevelHashMap_rcu_sht_sha256_stat;
+#endif
//MD5
struct traits_MultiLevelHashMap_md5 : public cc::multilevel_hashmap::traits
};
typedef MultiLevelHashMap< cds::gc::HP, Key, Value, traits_MultiLevelHashMap_md5 > MultiLevelHashMap_hp_md5;
typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_md5 > MultiLevelHashMap_dhp_md5;
+ typedef MultiLevelHashMap< rcu_gpi, Key, Value, traits_MultiLevelHashMap_md5 > MultiLevelHashMap_rcu_gpi_md5;
+ typedef MultiLevelHashMap< rcu_gpb, Key, Value, traits_MultiLevelHashMap_md5 > MultiLevelHashMap_rcu_gpb_md5;
+ typedef MultiLevelHashMap< rcu_gpt, Key, Value, traits_MultiLevelHashMap_md5 > MultiLevelHashMap_rcu_gpt_md5;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef MultiLevelHashMap< rcu_shb, Key, Value, traits_MultiLevelHashMap_md5 > MultiLevelHashMap_rcu_shb_md5;
+ typedef MultiLevelHashMap< rcu_sht, Key, Value, traits_MultiLevelHashMap_md5 > MultiLevelHashMap_rcu_sht_md5;
+#endif
struct traits_MultiLevelHashMap_md5_stat : public traits_MultiLevelHashMap_md5
{
};
typedef MultiLevelHashMap< cds::gc::HP, Key, Value, traits_MultiLevelHashMap_md5_stat > MultiLevelHashMap_hp_md5_stat;
typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_md5_stat > MultiLevelHashMap_dhp_md5_stat;
+ typedef MultiLevelHashMap< rcu_gpi, Key, Value, traits_MultiLevelHashMap_md5_stat > MultiLevelHashMap_rcu_gpi_md5_stat;
+ typedef MultiLevelHashMap< rcu_gpb, Key, Value, traits_MultiLevelHashMap_md5_stat > MultiLevelHashMap_rcu_gpb_md5_stat;
+ typedef MultiLevelHashMap< rcu_gpt, Key, Value, traits_MultiLevelHashMap_md5_stat > MultiLevelHashMap_rcu_gpt_md5_stat;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef MultiLevelHashMap< rcu_shb, Key, Value, traits_MultiLevelHashMap_md5_stat > MultiLevelHashMap_rcu_shb_md5_stat;
+ typedef MultiLevelHashMap< rcu_sht, Key, Value, traits_MultiLevelHashMap_md5_stat > MultiLevelHashMap_rcu_sht_md5_stat;
+#endif
// CityHash
#if CDS_BUILD_BITS == 64
};
typedef MultiLevelHashMap< cds::gc::HP, Key, Value, traits_MultiLevelHashMap_city64 > MultiLevelHashMap_hp_city64;
typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_city64 > MultiLevelHashMap_dhp_city64;
+ typedef MultiLevelHashMap< rcu_gpi, Key, Value, traits_MultiLevelHashMap_city64 > MultiLevelHashMap_rcu_gpi_city64;
+ typedef MultiLevelHashMap< rcu_gpb, Key, Value, traits_MultiLevelHashMap_city64 > MultiLevelHashMap_rcu_gpb_city64;
+ typedef MultiLevelHashMap< rcu_gpt, Key, Value, traits_MultiLevelHashMap_city64 > MultiLevelHashMap_rcu_gpt_city64;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef MultiLevelHashMap< rcu_shb, Key, Value, traits_MultiLevelHashMap_city64 > MultiLevelHashMap_rcu_shb_city64;
+ typedef MultiLevelHashMap< rcu_sht, Key, Value, traits_MultiLevelHashMap_city64 > MultiLevelHashMap_rcu_sht_city64;
+#endif
struct traits_MultiLevelHashMap_city64_stat : public traits_MultiLevelHashMap_city64
{
};
typedef MultiLevelHashMap< cds::gc::HP, Key, Value, traits_MultiLevelHashMap_city64_stat > MultiLevelHashMap_hp_city64_stat;
typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_city64_stat > MultiLevelHashMap_dhp_city64_stat;
+ typedef MultiLevelHashMap< rcu_gpi, Key, Value, traits_MultiLevelHashMap_city64_stat > MultiLevelHashMap_rcu_gpi_city64_stat;
+ typedef MultiLevelHashMap< rcu_gpb, Key, Value, traits_MultiLevelHashMap_city64_stat > MultiLevelHashMap_rcu_gpb_city64_stat;
+ typedef MultiLevelHashMap< rcu_gpt, Key, Value, traits_MultiLevelHashMap_city64_stat > MultiLevelHashMap_rcu_gpt_city64_stat;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef MultiLevelHashMap< rcu_shb, Key, Value, traits_MultiLevelHashMap_city64_stat > MultiLevelHashMap_rcu_shb_city64_stat;
+ typedef MultiLevelHashMap< rcu_sht, Key, Value, traits_MultiLevelHashMap_city64_stat > MultiLevelHashMap_rcu_sht_city64_stat;
+#endif
struct traits_MultiLevelHashMap_city128 : public cc::multilevel_hashmap::traits
{
};
typedef MultiLevelHashMap< cds::gc::HP, Key, Value, traits_MultiLevelHashMap_city128 > MultiLevelHashMap_hp_city128;
typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_city128 > MultiLevelHashMap_dhp_city128;
+ typedef MultiLevelHashMap< rcu_gpi, Key, Value, traits_MultiLevelHashMap_city128 > MultiLevelHashMap_rcu_gpi_city128;
+ typedef MultiLevelHashMap< rcu_gpb, Key, Value, traits_MultiLevelHashMap_city128 > MultiLevelHashMap_rcu_gpb_city128;
+ typedef MultiLevelHashMap< rcu_gpt, Key, Value, traits_MultiLevelHashMap_city128 > MultiLevelHashMap_rcu_gpt_city128;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef MultiLevelHashMap< rcu_shb, Key, Value, traits_MultiLevelHashMap_city128 > MultiLevelHashMap_rcu_shb_city128;
+ typedef MultiLevelHashMap< rcu_sht, Key, Value, traits_MultiLevelHashMap_city128 > MultiLevelHashMap_rcu_sht_city128;
+#endif
struct traits_MultiLevelHashMap_city128_stat : public traits_MultiLevelHashMap_city128
{
};
typedef MultiLevelHashMap< cds::gc::HP, Key, Value, traits_MultiLevelHashMap_city128_stat > MultiLevelHashMap_hp_city128_stat;
typedef MultiLevelHashMap< cds::gc::DHP, Key, Value, traits_MultiLevelHashMap_city128_stat > MultiLevelHashMap_dhp_city128_stat;
+ typedef MultiLevelHashMap< rcu_gpi, Key, Value, traits_MultiLevelHashMap_city128_stat > MultiLevelHashMap_rcu_gpi_city128_stat;
+ typedef MultiLevelHashMap< rcu_gpb, Key, Value, traits_MultiLevelHashMap_city128_stat > MultiLevelHashMap_rcu_gpb_city128_stat;
+ typedef MultiLevelHashMap< rcu_gpt, Key, Value, traits_MultiLevelHashMap_city128_stat > MultiLevelHashMap_rcu_gpt_city128_stat;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef MultiLevelHashMap< rcu_shb, Key, Value, traits_MultiLevelHashMap_city128_stat > MultiLevelHashMap_rcu_shb_city128_stat;
+ typedef MultiLevelHashMap< rcu_sht, Key, Value, traits_MultiLevelHashMap_city128_stat > MultiLevelHashMap_rcu_sht_city128_stat;
+#endif
#endif // CDS_BUILD_BITS == 64
};
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = true;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
+ static CDS_CONSTEXPR bool const c_bEraseExactKey = false;
};
struct tag_SkipListMap;
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = true;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;
+ static CDS_CONSTEXPR bool const c_bEraseExactKey = false;
};
template <typename Key, typename T, typename Traits >
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = false;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
+ static CDS_CONSTEXPR bool const c_bEraseExactKey = false;
};
} // namespace map2
// for testing
static CDS_CONSTEXPR bool const c_bExtractSupported = false;
static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
+ static CDS_CONSTEXPR bool const c_bEraseExactKey = false;
};
} // namespace map