From: Peizhao Ou Date: Wed, 17 Jan 2018 01:00:57 +0000 (-0800) Subject: Adjusts pass counts for some sequential map test cases X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=commitdiff_plain;h=2f8bc17e37a31d7eea67e4dc40a10a47ff63bb75;hp=3a3e05a161168102d2666e4f606178ee0b4a37c5 Adjusts pass counts for some sequential map test cases --- diff --git a/test/stress/sequential/sequential-map/find_string/map_find_string.cpp b/test/stress/sequential/sequential-map/find_string/map_find_string.cpp index 7da0e8dd..b4c4c375 100644 --- a/test/stress/sequential/sequential-map/find_string/map_find_string.cpp +++ b/test/stress/sequential/sequential-map/find_string/map_find_string.cpp @@ -38,6 +38,11 @@ namespace map { size_t Map_find_string::s_nMaxLoadFactor = 8; size_t Map_find_string::s_nPercentExists = 50; size_t Map_find_string::s_nPassCount = 2; + size_t Map_find_string::s_nFeldmanPassCount = 100; + size_t Map_find_string::s_nBronsonAVLTreeMapPassCount = 100; + size_t Map_find_string::s_nEllenBinTreeMapPassCount = 100; + size_t Map_find_string::s_nMichaelMapPassCount = 100; + size_t Map_find_string::s_nSkipListMapPassCount = 100; size_t Map_find_string::s_nCuckooInitialSize = 1024; size_t Map_find_string::s_nCuckooProbesetSize = 16; @@ -53,45 +58,80 @@ namespace map { void Map_find_string::setup_test_case() { - cds_test::config const& cfg = get_config( "map_find_string" ); - - s_nMapSize = cfg.get_size_t( "MapSize", s_nMapSize ); - if ( s_nMapSize < 1000 ) - s_nMapSize = 1000; - - s_nThreadCount = cfg.get_size_t( "ThreadCount", s_nThreadCount ); - if ( s_nThreadCount == 0 ) - s_nThreadCount = 1; - - s_nPercentExists = cfg.get_size_t( "PercentExists", s_nPercentExists ); - if ( s_nPercentExists > 100 ) - s_nPercentExists = 100; - else if ( s_nPercentExists < 1 ) - s_nPercentExists = 1; - - s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor ); - if ( s_nMaxLoadFactor == 0 ) - s_nMaxLoadFactor = 1; - - s_nCuckooInitialSize = cfg.get_size_t( "CuckooInitialSize", s_nCuckooInitialSize ); - if ( s_nCuckooInitialSize < 256 ) - s_nCuckooInitialSize = 256; - - s_nCuckooProbesetSize = cfg.get_size_t( "CuckooProbesetSize", s_nCuckooProbesetSize ); - if ( s_nCuckooProbesetSize < 8 ) - s_nCuckooProbesetSize = 8; - - s_nCuckooProbesetThreshold = cfg.get_size_t( "CuckooProbesetThreshold", s_nCuckooProbesetThreshold ); - - s_nFeldmanMap_HeadBits = cfg.get_size_t( "FeldmanMapHeadBits", s_nFeldmanMap_HeadBits ); - if ( s_nFeldmanMap_HeadBits == 0 ) - s_nFeldmanMap_HeadBits = 2; - - s_nFeldmanMap_ArrayBits = cfg.get_size_t( "FeldmanMapArrayBits", s_nFeldmanMap_ArrayBits ); - if ( s_nFeldmanMap_ArrayBits == 0 ) - s_nFeldmanMap_ArrayBits = 2; - - s_arrString = load_dictionary(); + cds_test::config const &cfg = + get_config("sequential_real_map_find_string"); + + s_nMapSize = cfg.get_size_t("MapSize", s_nMapSize); + if (s_nMapSize < 1000) + s_nMapSize = 1000; + + s_nThreadCount = cfg.get_size_t("ThreadCount", s_nThreadCount); + if (s_nThreadCount == 0) + s_nThreadCount = 1; + + s_nPassCount = cfg.get_size_t("PassCount", s_nPassCount); + if (s_nPassCount == 0) + s_nPassCount = 100; + + s_nFeldmanPassCount = + cfg.get_size_t("FeldmanPassCount", s_nFeldmanPassCount); + if (s_nFeldmanPassCount == 0) + s_nFeldmanPassCount = 500; + + s_nBronsonAVLTreeMapPassCount = cfg.get_size_t( + "BronsonAVLTreeMapPassCount", s_nBronsonAVLTreeMapPassCount); + if (s_nBronsonAVLTreeMapPassCount == 0) + s_nBronsonAVLTreeMapPassCount = 500; + + s_nEllenBinTreeMapPassCount = cfg.get_size_t("EllenBinTreeMapPassCount", + s_nEllenBinTreeMapPassCount); + if (s_nEllenBinTreeMapPassCount == 0) + s_nEllenBinTreeMapPassCount = 500; + + s_nMichaelMapPassCount = + cfg.get_size_t("MichaelMapPassCount", s_nMichaelMapPassCount); + if (s_nMichaelMapPassCount == 0) + s_nMichaelMapPassCount = 500; + + s_nSkipListMapPassCount = + cfg.get_size_t("SkipListMapPassCount", s_nSkipListMapPassCount); + if (s_nSkipListMapPassCount == 0) + s_nSkipListMapPassCount = 500; + + s_nPercentExists = cfg.get_size_t("PercentExists", s_nPercentExists); + if (s_nPercentExists > 100) + s_nPercentExists = 100; + else if (s_nPercentExists < 1) + s_nPercentExists = 1; + + s_nMaxLoadFactor = cfg.get_size_t("MaxLoadFactor", s_nMaxLoadFactor); + if (s_nMaxLoadFactor == 0) + s_nMaxLoadFactor = 1; + + s_nCuckooInitialSize = + cfg.get_size_t("CuckooInitialSize", s_nCuckooInitialSize); + if (s_nCuckooInitialSize < 256) + s_nCuckooInitialSize = 256; + + s_nCuckooProbesetSize = + cfg.get_size_t("CuckooProbesetSize", s_nCuckooProbesetSize); + if (s_nCuckooProbesetSize < 8) + s_nCuckooProbesetSize = 8; + + s_nCuckooProbesetThreshold = + cfg.get_size_t("CuckooProbesetThreshold", s_nCuckooProbesetThreshold); + + s_nFeldmanMap_HeadBits = + cfg.get_size_t("FeldmanMapHeadBits", s_nFeldmanMap_HeadBits); + if (s_nFeldmanMap_HeadBits == 0) + s_nFeldmanMap_HeadBits = 2; + + s_nFeldmanMap_ArrayBits = + cfg.get_size_t("FeldmanMapArrayBits", s_nFeldmanMap_ArrayBits); + if (s_nFeldmanMap_ArrayBits == 0) + s_nFeldmanMap_ArrayBits = 2; + + s_arrString = load_dictionary(); } void Map_find_string::TearDownTestCase() diff --git a/test/stress/sequential/sequential-map/find_string/map_find_string.h b/test/stress/sequential/sequential-map/find_string/map_find_string.h index 5479e3b8..b6068a3b 100644 --- a/test/stress/sequential/sequential-map/find_string/map_find_string.h +++ b/test/stress/sequential/sequential-map/find_string/map_find_string.h @@ -39,6 +39,12 @@ namespace map { static size_t s_nMapSize; // map size (count of searching item) static size_t s_nPercentExists; // percent of existing keys in searching sequence static size_t s_nPassCount; + static size_t s_nBronsonAVLTreeMapPassCount; + static size_t s_nEllenBinTreeMapPassCount; + static size_t s_nFeldmanPassCount; + static size_t s_nMichaelMapPassCount; + static size_t s_nSkipListMapPassCount; + static size_t s_nMaxLoadFactor; // maximum load factor static size_t s_nCuckooInitialSize; // initial size for CuckooMap @@ -117,43 +123,22 @@ namespace map { size_t const nPassCount = s_nPassCount; Map& rMap = m_Map; - for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) { - if ( id() & 1 ) { - auto itEnd = s_Data.cend(); - for ( auto it = s_Data.cbegin(); it != itEnd; ++it ) { - auto bFound = rMap.contains( *(it->pKey)); - if ( it->bExists ) { - if ( check_result(bFound, rMap)) - ++m_KeyExists.nSuccess; - else - ++m_KeyExists.nFailed; - } - else { - if ( check_result(bFound, rMap)) - ++m_KeyNotExists.nFailed; - else - ++m_KeyNotExists.nSuccess; - } - } - } - else { - auto itEnd = s_Data.crend(); - for ( auto it = s_Data.crbegin(); it != itEnd; ++it ) { - auto bFound = rMap.contains( *(it->pKey)); - if ( it->bExists ) { - if ( check_result(bFound, rMap)) - ++m_KeyExists.nSuccess; - else - ++m_KeyExists.nFailed; - } - else { - if ( check_result( bFound, rMap )) - ++m_KeyNotExists.nFailed; - else - ++m_KeyNotExists.nSuccess; - } - } + for (size_t nPass = 0; nPass < nPassCount; ++nPass) { + auto itEnd = s_Data.cend(); + for (auto it = s_Data.cbegin(); it != itEnd; ++it) { + auto bFound = rMap.contains(*(it->pKey)); + if (it->bExists) { + if (check_result(bFound, rMap)) + ++m_KeyExists.nSuccess; + else + ++m_KeyExists.nFailed; + } else { + if (check_result(bFound, rMap)) + ++m_KeyNotExists.nFailed; + else + ++m_KeyNotExists.nSuccess; } + } } } }; @@ -175,49 +160,12 @@ namespace map { } } - propout() << std::make_pair( "thread_count", s_nThreadCount ) - << std::make_pair( "map_size", s_nMapSize ) - << std::make_pair( "percent_exist", s_nPercentExists ) - << std::make_pair( "pass_count", s_nPassCount ); - - cds_test::thread_pool& pool = get_pool(); - pool.add( new worker( pool, testMap ), s_nThreadCount ); - - std::chrono::milliseconds duration = pool.run(); - - propout() << std::make_pair( "duration", duration ); - - size_t nExistSuccess = 0; - size_t nExistFailed = 0; - size_t nMissingSuccess = 0; - size_t nMissingFailed = 0; - - // Postcondition: the number of success searching == the number of map item - for ( size_t i = 0; i < pool.size(); ++i ) { - worker& w = static_cast(pool.get( i )); - nExistSuccess += w.m_KeyExists.nSuccess; - nExistFailed += w.m_KeyExists.nFailed; - nMissingSuccess += w.m_KeyNotExists.nSuccess; - nMissingFailed += w.m_KeyNotExists.nFailed; - - EXPECT_EQ( w.m_KeyExists.nSuccess, s_nMapSize * s_nPassCount ) << "thread " << i; - EXPECT_EQ( w.m_KeyExists.nFailed, 0u ) << "thread " << i; - EXPECT_EQ( w.m_KeyNotExists.nSuccess, (s_Data.size() - s_nMapSize) * s_nPassCount ) << "thread " << i; - EXPECT_EQ( w.m_KeyNotExists.nFailed, 0u ) << "thread " << i; - } - - propout() - << std::make_pair( "exist_found", nExistSuccess ) - << std::make_pair( "exist_not_found", nExistFailed ) // must = 0 - << std::make_pair( "missing_not_found", nMissingSuccess ) - << std::make_pair( "missing_found", nMissingFailed ); // must = 0 - - check_before_cleanup( testMap ); + cds_test::thread_pool &pool = get_pool(); + std::unique_ptr worker_thread(new worker(pool, testMap)); + worker_thread->test(); testMap.clear(); - additional_check( testMap ); - print_stat( propout(), testMap ); - additional_cleanup( testMap ); + additional_cleanup(testMap); } template @@ -228,6 +176,42 @@ namespace map { Map testMap( *this ); test( testMap ); } + + template + void run_bronson_avl_tree() { + Map_find_string::s_nPassCount = + Map_find_string::s_nBronsonAVLTreeMapPassCount; + run_test(); + } + + template + void run_ellen_bin_tree() { + Map_find_string::s_nPassCount = + Map_find_string::s_nEllenBinTreeMapPassCount; + run_test(); + } + + template + void run_feldman() { + Map_find_string::s_nPassCount = + Map_find_string::s_nFeldmanPassCount; + run_test(); + } + + template + void run_michael() { + Map_find_string::s_nPassCount = + Map_find_string::s_nMichaelMapPassCount; + run_test(); + } + + template + void run_skip_list() { + Map_find_string::s_nPassCount = + Map_find_string::s_nSkipListMapPassCount; + run_test(); + } + }; class Map_find_string_stdhash: public Map_find_string diff --git a/test/stress/sequential/sequential-map/find_string/map_find_string_bronsonavltree.cpp b/test/stress/sequential/sequential-map/find_string/map_find_string_bronsonavltree.cpp index fe18050f..4f97a46a 100644 --- a/test/stress/sequential/sequential-map/find_string/map_find_string_bronsonavltree.cpp +++ b/test/stress/sequential/sequential-map/find_string/map_find_string_bronsonavltree.cpp @@ -33,6 +33,6 @@ namespace map { - CDSSTRESS_BronsonAVLTreeMap( Map_find_string, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_BronsonAVLTreeMap( Map_find_string, run_bronson_avl_tree, std::string, Map_find_string::value_type ) } // namespace map diff --git a/test/stress/sequential/sequential-map/find_string/map_find_string_ellentree.cpp b/test/stress/sequential/sequential-map/find_string/map_find_string_ellentree.cpp index 9cd3da26..7b1453d5 100644 --- a/test/stress/sequential/sequential-map/find_string/map_find_string_ellentree.cpp +++ b/test/stress/sequential/sequential-map/find_string/map_find_string_ellentree.cpp @@ -33,6 +33,6 @@ namespace map { - CDSSTRESS_EllenBinTreeMap( Map_find_string, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_EllenBinTreeMap( Map_find_string, run_ellen_bin_tree, std::string, Map_find_string::value_type ) } // namespace map diff --git a/test/stress/sequential/sequential-map/find_string/map_find_string_feldman_hashset.cpp b/test/stress/sequential/sequential-map/find_string/map_find_string_feldman_hashset.cpp index 84b370e3..dcb0c70e 100644 --- a/test/stress/sequential/sequential-map/find_string/map_find_string_feldman_hashset.cpp +++ b/test/stress/sequential/sequential-map/find_string/map_find_string_feldman_hashset.cpp @@ -33,10 +33,10 @@ namespace map { - CDSSTRESS_FeldmanHashMap_stdhash( Map_find_string_stdhash, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_FeldmanHashMap_stdhash( Map_find_string_stdhash, run_feldman, std::string, Map_find_string::value_type ) #if CDS_BUILD_BITS == 64 - CDSSTRESS_FeldmanHashMap_city64( Map_find_string_city64, run_test, std::string, Map_find_string::value_type ) - CDSSTRESS_FeldmanHashMap_city128( Map_find_string_city128, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_FeldmanHashMap_city64( Map_find_string_city64, run_feldman, std::string, Map_find_string::value_type ) + CDSSTRESS_FeldmanHashMap_city128( Map_find_string_city128, run_feldman, std::string, Map_find_string::value_type ) #endif } // namespace map diff --git a/test/stress/sequential/sequential-map/find_string/map_find_string_michael.cpp b/test/stress/sequential/sequential-map/find_string/map_find_string_michael.cpp index b649f374..e6325c2a 100644 --- a/test/stress/sequential/sequential-map/find_string/map_find_string_michael.cpp +++ b/test/stress/sequential/sequential-map/find_string/map_find_string_michael.cpp @@ -33,7 +33,7 @@ namespace map { - CDSSTRESS_MichaelMap( Map_find_string_LF, run_test, std::string, Map_find_string::value_type ) - CDSSTRESS_MichaelMap_nogc( Map_find_string_LF, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_MichaelMap( Map_find_string_LF, run_michael, std::string, Map_find_string::value_type ) + CDSSTRESS_MichaelMap_nogc( Map_find_string_LF, run_michael, std::string, Map_find_string::value_type ) } // namespace map diff --git a/test/stress/sequential/sequential-map/find_string/map_find_string_skip.cpp b/test/stress/sequential/sequential-map/find_string/map_find_string_skip.cpp index e790568a..0e947bf0 100644 --- a/test/stress/sequential/sequential-map/find_string/map_find_string_skip.cpp +++ b/test/stress/sequential/sequential-map/find_string/map_find_string_skip.cpp @@ -33,7 +33,7 @@ namespace map { - CDSSTRESS_SkipListMap( Map_find_string, run_test, std::string, Map_find_string::value_type ) - CDSSTRESS_SkipListMap_nogc( Map_find_string, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_SkipListMap( Map_find_string, run_skip_list, std::string, Map_find_string::value_type ) + CDSSTRESS_SkipListMap_nogc( Map_find_string, run_skip_list, std::string, Map_find_string::value_type ) } // namespace map diff --git a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string.cpp b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string.cpp index e1a422ef..8b55be5d 100644 --- a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string.cpp +++ b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string.cpp @@ -37,6 +37,12 @@ namespace map { size_t Map_InsDel_string::s_nInsertThreadCount = 4; // count of insertion thread size_t Map_InsDel_string::s_nDeleteThreadCount = 4; // count of deletion thread size_t Map_InsDel_string::s_nThreadPassCount = 4; // pass count for each thread + size_t Map_InsDel_string::s_nFeldmanPassCount = 100; + size_t Map_InsDel_string::s_nBronsonAVLTreeMapPassCount = 100; + size_t Map_InsDel_string::s_nEllenBinTreeMapPassCount = 100; + size_t Map_InsDel_string::s_nMichaelMapPassCount = 100; + size_t Map_InsDel_string::s_nSkipListMapPassCount = 100; + size_t Map_InsDel_string::s_nMaxLoadFactor = 8; // maximum load factor size_t Map_InsDel_string::s_nCuckooInitialSize = 1024;// initial size for CuckooSet @@ -51,7 +57,7 @@ namespace map { void Map_InsDel_string::setup_test_case() { - cds_test::config const& cfg = get_config( "map_insdel_string" ); + cds_test::config const& cfg = get_config( "sequential_real_map_insdel_string" ); s_nMapSize = cfg.get_size_t( "MapSize", s_nMapSize ); if ( s_nMapSize < 1000 ) @@ -69,6 +75,31 @@ namespace map { if ( s_nThreadPassCount == 0 ) s_nThreadPassCount = 4; + s_nFeldmanPassCount = + cfg.get_size_t("FeldmanPassCount", s_nFeldmanPassCount); + if (s_nFeldmanPassCount == 0) + s_nFeldmanPassCount = 500; + + s_nBronsonAVLTreeMapPassCount = cfg.get_size_t( + "BronsonAVLTreeMapPassCount", s_nBronsonAVLTreeMapPassCount); + if (s_nBronsonAVLTreeMapPassCount == 0) + s_nBronsonAVLTreeMapPassCount = 500; + + s_nEllenBinTreeMapPassCount = cfg.get_size_t( + "EllenBinTreeMapPassCount", s_nEllenBinTreeMapPassCount); + if (s_nEllenBinTreeMapPassCount == 0) + s_nEllenBinTreeMapPassCount = 500; + + s_nMichaelMapPassCount = + cfg.get_size_t("MichaelMapPassCount", s_nMichaelMapPassCount); + if (s_nMichaelMapPassCount == 0) + s_nMichaelMapPassCount = 500; + + s_nSkipListMapPassCount = + cfg.get_size_t("SkipListMapPassCount", s_nSkipListMapPassCount); + if (s_nSkipListMapPassCount == 0) + s_nSkipListMapPassCount = 500; + s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor ); if ( s_nMaxLoadFactor == 0 ) s_nMaxLoadFactor = 1; diff --git a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string.h b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string.h index 35cf8255..dcd6d4ff 100644 --- a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string.h +++ b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string.h @@ -41,6 +41,12 @@ namespace map { static size_t s_nInsertThreadCount; // count of insertion thread static size_t s_nDeleteThreadCount; // count of deletion thread static size_t s_nThreadPassCount; // pass count for each thread + static size_t s_nBronsonAVLTreeMapPassCount; + static size_t s_nEllenBinTreeMapPassCount; + static size_t s_nFeldmanPassCount; + static size_t s_nMichaelMapPassCount; + static size_t s_nSkipListMapPassCount; + static size_t s_nMaxLoadFactor; // maximum load factor static size_t s_nCuckooInitialSize; // initial size for CuckooMap @@ -99,25 +105,12 @@ namespace map { { Map& rMap = m_Map; - if ( id() & 1 ) { - for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) { - for ( auto it = s_arrKeys.cbegin(), itEnd = s_arrKeys.cend(); it != itEnd; ++it ) { - if ( rMap.insert( *it, 0 )) - ++m_nInsertSuccess; - else - ++m_nInsertFailed; - } - } - } - else { - for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) { - for ( auto it = s_arrKeys.crbegin(), itEnd = s_arrKeys.crend(); it != itEnd; ++it ) { - if ( rMap.insert( *it, 1 )) - ++m_nInsertSuccess; - else - ++m_nInsertFailed; - } - } + for (auto it = s_arrKeys.cbegin(), itEnd = s_arrKeys.cend(); + it != itEnd; ++it) { + if (rMap.insert(*it, 0)) + ++m_nInsertSuccess; + else + ++m_nInsertFailed; } } }; @@ -152,25 +145,12 @@ namespace map { { Map& rMap = m_Map; - if ( id() & 1 ) { - for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) { - for ( auto it = s_arrKeys.cbegin(), itEnd = s_arrKeys.cend(); it != itEnd; ++it ) { - if ( rMap.erase( *it )) - ++m_nDeleteSuccess; - else - ++m_nDeleteFailed; - } - } - } - else { - for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) { - for ( auto it = s_arrKeys.crbegin(), itEnd = s_arrKeys.crend(); it != itEnd; ++it ) { - if ( rMap.erase( *it )) - ++m_nDeleteSuccess; - else - ++m_nDeleteFailed; - } - } + for (auto it = s_arrKeys.cbegin(), itEnd = s_arrKeys.cend(); + it != itEnd; ++it) { + if (rMap.erase(*it)) + ++m_nDeleteSuccess; + else + ++m_nDeleteFailed; } } }; @@ -186,62 +166,20 @@ namespace map { typedef Deleter deleter; cds_test::thread_pool& pool = get_pool(); - pool.add( new inserter( pool, testMap ), s_nInsertThreadCount ); - pool.add( new deleter( pool, testMap ), s_nDeleteThreadCount ); - - propout() << std::make_pair( "insert_thread_count", s_nInsertThreadCount ) - << std::make_pair( "delete_thread_count", s_nDeleteThreadCount ) - << std::make_pair( "pass_count", s_nThreadPassCount ) - << std::make_pair( "map_size", s_nMapSize ); - - std::chrono::milliseconds duration = pool.run(); - - propout() << std::make_pair( "duration", duration ); - - size_t nInsertSuccess = 0; - size_t nInsertFailed = 0; - size_t nDeleteSuccess = 0; - size_t nDeleteFailed = 0; - - for ( size_t i = 0; i < pool.size(); ++i ) { - cds_test::thread& thr = pool.get( i ); - switch ( thr.type()) { - case insert_thread: - { - inserter& t = static_cast(thr); - nInsertSuccess += t.m_nInsertSuccess; - nInsertFailed += t.m_nInsertFailed; - } - break; - case delete_thread: - { - deleter& t = static_cast(thr); - nDeleteSuccess += t.m_nDeleteSuccess; - nDeleteFailed += t.m_nDeleteFailed; - } - break; - default: - assert( false ); - } + std::unique_ptr inserter_thrd( + new inserter(pool, testMap)); + std::unique_ptr deleter_thrd( + new deleter(pool, testMap)); + for (size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass) { + inserter_thrd->test(); + deleter_thrd->test(); } - propout() - << std::make_pair( "insert_success", nInsertSuccess ) - << std::make_pair( "insert_failed", nInsertFailed ) - << std::make_pair( "delete_success", nDeleteSuccess ) - << std::make_pair( "delete_failed", nDeleteFailed ) - << std::make_pair( "finish_map_size", testMap.size()); - - check_before_cleanup( testMap ); - - //testMap.clear(); + // testMap.clear(); for ( auto const& str: s_arrKeys ) testMap.erase( str ); EXPECT_TRUE( testMap.empty()); EXPECT_EQ( testMap.size(), 0u ); - - additional_check( testMap ); - print_stat( propout(), testMap ); additional_cleanup( testMap ); } @@ -250,6 +188,41 @@ namespace map { { Map testMap( *this ); do_test( testMap ); + } + + template + void run_bronson_avl_tree() { + Map_InsDel_string::s_nThreadPassCount = + Map_InsDel_string::s_nBronsonAVLTreeMapPassCount; + run_test(); + } + + template + void run_ellen_bin_tree() { + Map_InsDel_string::s_nThreadPassCount = + Map_InsDel_string::s_nEllenBinTreeMapPassCount; + run_test(); + } + + template + void run_feldman() { + Map_InsDel_string::s_nThreadPassCount = + Map_InsDel_string::s_nFeldmanPassCount; + run_test(); + } + + template + void run_michael() { + Map_InsDel_string::s_nThreadPassCount = + Map_InsDel_string::s_nMichaelMapPassCount; + run_test(); + } + + template + void run_skip_list() { + Map_InsDel_string::s_nThreadPassCount = + Map_InsDel_string::s_nSkipListMapPassCount; + run_test(); } }; diff --git a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_bronsonavltree.cpp b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_bronsonavltree.cpp index f7391f1d..737950e7 100644 --- a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_bronsonavltree.cpp +++ b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_bronsonavltree.cpp @@ -33,6 +33,6 @@ namespace map { - CDSSTRESS_BronsonAVLTreeMap( Map_InsDel_string, run_test, std::string, size_t ) + CDSSTRESS_BronsonAVLTreeMap( Map_InsDel_string, run_bronson_avl_tree, std::string, size_t ) } // namespace map diff --git a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_ellentree.cpp b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_ellentree.cpp index 0946b66d..4e7c8eed 100644 --- a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_ellentree.cpp +++ b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_ellentree.cpp @@ -33,6 +33,6 @@ namespace map { - CDSSTRESS_EllenBinTreeMap( Map_InsDel_string, run_test, std::string, size_t ) + CDSSTRESS_EllenBinTreeMap( Map_InsDel_string, run_ellen_bin_tree, std::string, size_t ) } // namespace map diff --git a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_feldman_hashset.cpp b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_feldman_hashset.cpp index 792c6822..0c5666e9 100644 --- a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_feldman_hashset.cpp +++ b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_feldman_hashset.cpp @@ -33,10 +33,10 @@ namespace map { - CDSSTRESS_FeldmanHashMap_stdhash( Map_InsDel_string_stdhash, run_test, std::string, size_t ) + CDSSTRESS_FeldmanHashMap_stdhash( Map_InsDel_string_stdhash, run_feldman, std::string, size_t ) #if CDS_BUILD_BITS == 64 - CDSSTRESS_FeldmanHashMap_city64( Map_InsDel_string_city64, run_test, std::string, size_t ) - CDSSTRESS_FeldmanHashMap_city128( Map_InsDel_string_city128, run_test, std::string, size_t ) + CDSSTRESS_FeldmanHashMap_city64( Map_InsDel_string_city64, run_feldman, std::string, size_t ) + CDSSTRESS_FeldmanHashMap_city128( Map_InsDel_string_city128, run_feldman, std::string, size_t ) #endif } // namespace map diff --git a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_michael.cpp b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_michael.cpp index 014e69f3..3bcf3963 100644 --- a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_michael.cpp +++ b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_michael.cpp @@ -33,6 +33,6 @@ namespace map { - CDSSTRESS_MichaelMap( Map_InsDel_string_LF, run_test, std::string, size_t ) + CDSSTRESS_MichaelMap( Map_InsDel_string_LF, run_michael, std::string, size_t ) } // namespace map diff --git a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_skip.cpp b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_skip.cpp index 9f189274..20065081 100644 --- a/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_skip.cpp +++ b/test/stress/sequential/sequential-map/insdel_string/map_insdel_string_skip.cpp @@ -33,6 +33,6 @@ namespace map { - CDSSTRESS_SkipListMap( Map_InsDel_string, run_test, std::string, size_t ) + CDSSTRESS_SkipListMap( Map_InsDel_string, run_skip_list, std::string, size_t ) } // namespace map