--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_int.cpp">\r
+ <Filter>map_find_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_int_bronsonavltree.cpp">\r
+ <Filter>map_find_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_int_cuckoo.cpp">\r
+ <Filter>map_find_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_int_ellentree.cpp">\r
+ <Filter>map_find_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_int_michael.cpp">\r
+ <Filter>map_find_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_int_refinable.cpp">\r
+ <Filter>map_find_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_int_skip.cpp">\r
+ <Filter>map_find_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_int_split.cpp">\r
+ <Filter>map_find_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_int_std.cpp">\r
+ <Filter>map_find_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_int_striped.cpp">\r
+ <Filter>map_find_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_string.cpp">\r
+ <Filter>map_find_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_string_bronsonavltree.cpp">\r
+ <Filter>map_find_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_string_cuckoo.cpp">\r
+ <Filter>map_find_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_string_ellentree.cpp">\r
+ <Filter>map_find_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_string_michael.cpp">\r
+ <Filter>map_find_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_string_refinable.cpp">\r
+ <Filter>map_find_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_string_skip.cpp">\r
+ <Filter>map_find_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_string_split.cpp">\r
+ <Filter>map_find_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_string_std.cpp">\r
+ <Filter>map_find_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_find_string_striped.cpp">\r
+ <Filter>map_find_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_bronsonavltree.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_cuckoo.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_ellentree.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_michael.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_refinable.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_skip.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_split.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_std.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insfind_int_striped.cpp">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="..\..\..\tests\unit\map2\map_find_int.h">\r
+ <Filter>map_find_int</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\tests\unit\map2\map_find_string.h">\r
+ <Filter>map_find_string</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\tests\unit\map2\map_insfind_int.h">\r
+ <Filter>map_insfind_int</Filter>\r
+ </ClInclude>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <Filter Include="map_find_int">\r
+ <UniqueIdentifier>{05793356-5544-4e12-893f-5761dea6536e}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="map_find_string">\r
+ <UniqueIdentifier>{c6ad8146-72e2-473c-aa04-3db455858146}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="map_insfind_int">\r
+ <UniqueIdentifier>{ba26fa2b-d618-4dd8-97d6-7dc874d9acf4}</UniqueIdentifier>\r
+ </Filter>\r
+ </ItemGroup>\r
+</Project>
\ No newline at end of file
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_bronsonavltree.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_cuckoo.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_ellentree.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_michael.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_refinable.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_skip.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_split.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_std.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_striped.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_bronsonavltree.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_cuckoo.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_striped.cpp" />\r
</ItemGroup>\r
<ItemGroup>\r
+ <ClInclude Include="..\..\..\tests\unit\map2\map_insdelfind.h" />\r
<ClInclude Include="..\..\..\tests\unit\map2\map_insdel_func.h" />\r
<ClInclude Include="..\..\..\tests\unit\map2\map_insdel_int.h" />\r
<ClInclude Include="..\..\..\tests\unit\map2\map_insdel_string.h" />\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func.cpp">\r
+ <Filter>map_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_bronsonavltree.cpp">\r
+ <Filter>map_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_cuckoo.cpp">\r
+ <Filter>map_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_ellentree.cpp">\r
+ <Filter>map_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_michael.cpp">\r
+ <Filter>map_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_refinable.cpp">\r
+ <Filter>map_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_skip.cpp">\r
+ <Filter>map_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_split.cpp">\r
+ <Filter>map_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_striped.cpp">\r
+ <Filter>map_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int.cpp">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_bronsonavltree.cpp">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_cuckoo.cpp">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_ellentree.cpp">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_michael.cpp">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_refinable.cpp">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_skip.cpp">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_split.cpp">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_striped.cpp">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_item_int.cpp">\r
+ <Filter>map_insdel_item_int</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_item_string.cpp">\r
+ <Filter>map_insdel_item_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string.cpp">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_bronsonavltree.cpp">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_cuckoo.cpp">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_ellentree.cpp">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_michael.cpp">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_refinable.cpp">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_skip.cpp">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_split.cpp">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_std.cpp">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_striped.cpp">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind.cpp">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_bronsonavltree.cpp">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_cuckoo.cpp">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_ellentree.cpp">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_michael.cpp">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_refinable.cpp">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_skip.cpp">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_split.cpp">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_std.cpp">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdelfind_striped.cpp">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <Filter Include="map_insdel_func">\r
+ <UniqueIdentifier>{7cb9e730-e4e0-4648-96f1-e1dbf119756e}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="map_insdel_int">\r
+ <UniqueIdentifier>{55aed984-fed9-4007-9ad3-59bec69befe8}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="map_insdel_item_int">\r
+ <UniqueIdentifier>{8e7ec24b-8a28-4503-8514-4593923e3451}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="map_insdel_item_string">\r
+ <UniqueIdentifier>{e7eec6ab-d1a8-4b59-afe9-b98e1b133d73}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="map_insdel_string">\r
+ <UniqueIdentifier>{f613f4ac-8b0f-4a85-81be-d243141b3ce3}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="map_insdelfind">\r
+ <UniqueIdentifier>{9172b0cf-89b6-44eb-bddd-1c59d254bff8}</UniqueIdentifier>\r
+ </Filter>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="..\..\..\tests\unit\map2\map_insdel_func.h">\r
+ <Filter>map_insdel_func</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\tests\unit\map2\map_insdel_int.h">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\tests\unit\map2\map_insdel_string.h">\r
+ <Filter>map_insdel_string</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\tests\unit\map2\map_insdelfind.h">\r
+ <Filter>map_insdelfind</Filter>\r
+ </ClInclude>\r
+ </ItemGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup>\r
+ <ClCompile Include="..\..\..\tests\unit\set2\set_insdelfind.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func.cpp">\r
+ <Filter>set_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func2.cpp">\r
+ <Filter>set_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func3.cpp">\r
+ <Filter>set_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func4.cpp">\r
+ <Filter>set_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func5.cpp">\r
+ <Filter>set_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func6.cpp">\r
+ <Filter>set_insdel_func</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_func7.cpp">\r
+ <Filter>set_insdel_func</Filter>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <Filter Include="set_insdel_func">\r
+ <UniqueIdentifier>{cbe5ede5-77ea-49bb-be6a-16d30d8416f7}</UniqueIdentifier>\r
+ </Filter>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="..\..\..\tests\unit\set2\set_insdel_func.h">\r
+ <Filter>set_insdel_func</Filter>\r
+ </ClInclude>\r
+ </ItemGroup>\r
+</Project>
\ No newline at end of file
tests/unit/map2/map_insdel_string_std.cpp \
tests/unit/map2/map_insdel_item_string.cpp \
tests/unit/map2/map_insdelfind.cpp \
+ tests/unit/map2/map_insdelfind_michael.cpp \
+ tests/unit/map2/map_insdelfind_split.cpp \
+ tests/unit/map2/map_insdelfind_skip.cpp \
+ tests/unit/map2/map_insdelfind_ellentree.cpp \
+ tests/unit/map2/map_insdelfind_bronsonavltree.cpp \
+ tests/unit/map2/map_insdelfind_striped.cpp \
+ tests/unit/map2/map_insdelfind_refinable.cpp \
+ tests/unit/map2/map_insdelfind_cuckoo.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 \
//$$CDS-header$$
-#include "map2/map_types.h"
-#include "cppunit/thread.h"
-#include <algorithm> // random_shuffle
-#include <vector>
+#include "map2/map_insdelfind.h"
namespace map2 {
+ CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDelFind );
-# define TEST_MAP(X) void X() { test<MapTypes<key_type, value_type>::X >() ; }
-# define TEST_MAP_NOLF(X) void X() { test_nolf<MapTypes<key_type, value_type>::X >() ; }
-# define TEST_MAP_EXTRACT(X) TEST_MAP(X)
-# define TEST_MAP_NOLF_EXTRACT(X) TEST_MAP_NOLF(X)
+ size_t Map_InsDelFind::c_nInitialMapSize = 500000;
+ size_t Map_InsDelFind::c_nThreadCount = 8;
+ size_t Map_InsDelFind::c_nMaxLoadFactor = 8;
+ unsigned int Map_InsDelFind::c_nInsertPercentage = 5;
+ unsigned int Map_InsDelFind::c_nDeletePercentage = 5;
+ unsigned int Map_InsDelFind::c_nDuration = 30;
+ bool Map_InsDelFind::c_bPrintGCState = true;
- namespace {
- static size_t c_nInitialMapSize = 500000 ; // initial map size
- static size_t c_nThreadCount = 8 ; // thread count
- static size_t c_nMaxLoadFactor = 8 ; // maximum load factor
- static unsigned int c_nInsertPercentage = 5;
- static unsigned int c_nDeletePercentage = 5;
- static unsigned int c_nDuration = 30 ; // test duration, seconds
- static bool c_bPrintGCState = true;
+ void Map_InsDelFind::setUpParams( const CppUnitMini::TestCfg& cfg )
+ {
+ c_nInitialMapSize = cfg.getSizeT("InitialMapSize", c_nInitialMapSize );
+ c_nThreadCount = cfg.getSizeT("ThreadCount", c_nThreadCount );
+ c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
+ c_nInsertPercentage = cfg.getUInt("InsertPercentage", c_nInsertPercentage );
+ c_nDeletePercentage = cfg.getUInt("DeletePercentage", c_nDeletePercentage );
+ c_nDuration = cfg.getUInt("Duration", c_nDuration );
+ c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
+
+ if ( c_nThreadCount == 0 )
+ c_nThreadCount = cds::OS::topology::processor_count() * 2;
+
+ CPPUNIT_ASSERT( c_nInsertPercentage + c_nDeletePercentage <= 100 );
+
+ actions * pFirst = m_arrShuffle;
+ actions * pLast = m_arrShuffle + c_nInsertPercentage;
+ std::fill( pFirst, pLast, do_insert );
+ pFirst = pLast;
+ pLast += c_nDeletePercentage;
+ std::fill( pFirst, pLast, do_delete );
+ pFirst = pLast;
+ pLast = m_arrShuffle + sizeof(m_arrShuffle)/sizeof(m_arrShuffle[0]);
+ std::fill( pFirst, pLast, do_find );
+ std::random_shuffle( m_arrShuffle, pLast );
}
- class Map_InsDelFind: public CppUnitMini::TestCase
+ void Map_InsDelFind::myRun(const char *in_name, bool invert /*= false*/)
{
- public:
- enum actions
- {
- do_find,
- do_insert,
- do_delete
- };
- static const unsigned int c_nShuffleSize = 100;
- actions m_arrShuffle[c_nShuffleSize];
-
- protected:
- typedef size_t key_type;
- typedef size_t value_type;
-
- template <class MAP>
- class WorkThread: public CppUnitMini::TestThread
- {
- MAP& m_Map;
-
- virtual WorkThread * clone()
- {
- return new WorkThread( *this );
- }
- public:
- size_t m_nInsertSuccess;
- size_t m_nInsertFailed;
- size_t m_nDeleteSuccess;
- size_t m_nDeleteFailed;
- size_t m_nFindSuccess;
- size_t m_nFindFailed;
-
- public:
- WorkThread( CppUnitMini::ThreadPool& pool, MAP& rMap )
- : CppUnitMini::TestThread( pool )
- , m_Map( rMap )
- {}
- WorkThread( WorkThread& src )
- : CppUnitMini::TestThread( src )
- , m_Map( src.m_Map )
- {}
-
- Map_InsDelFind& getTest()
- {
- return reinterpret_cast<Map_InsDelFind&>( m_Pool.m_Test );
- }
-
- virtual void init() { cds::threading::Manager::attachThread() ; }
- virtual void fini() { cds::threading::Manager::detachThread() ; }
-
- virtual void test()
- {
- MAP& rMap = m_Map;
-
- m_nInsertSuccess =
- m_nInsertFailed =
- m_nDeleteSuccess =
- m_nDeleteFailed =
- m_nFindSuccess =
- m_nFindFailed = 0;
-
- actions * pAct = getTest().m_arrShuffle;
- unsigned int i = 0;
- size_t const nNormalize = size_t(-1) / (c_nInitialMapSize * 2);
-
- size_t nRand = 0;
- while ( !time_elapsed() ) {
- nRand = cds::bitop::RandXorShift(nRand);
- size_t n = nRand / nNormalize;
- switch ( pAct[i] ) {
- case do_find:
- if ( rMap.find( n ))
- ++m_nFindSuccess;
- else
- ++m_nFindFailed;
- break;
- case do_insert:
- if ( rMap.insert( n, n ))
- ++m_nInsertSuccess;
- else
- ++m_nInsertFailed;
- break;
- case do_delete:
- if ( rMap.erase( n ))
- ++m_nDeleteSuccess;
- else
- ++m_nDeleteFailed;
- break;
- }
-
- if ( ++i >= c_nShuffleSize )
- i = 0;
- }
- }
- };
-
- protected:
- template <class MAP>
- void do_test( MAP& testMap )
- {
- typedef WorkThread<MAP> work_thread;
- cds::OS::Timer timer;
-
- // fill map - only odd number
- {
- std::vector<size_t> arr;
- arr.reserve( c_nInitialMapSize );
- for ( size_t i = 0; i < c_nInitialMapSize; ++i )
- arr.push_back( i * 2 + 1);
- std::random_shuffle( arr.begin(), arr.end() );
- for ( size_t i = 0; i < c_nInitialMapSize; ++i )
- testMap.insert( arr[i], arr[i] );
- }
- CPPUNIT_MSG( " Insert " << c_nInitialMapSize << " items time (single-threaded)=" << timer.duration() );
-
- timer.reset();
- CppUnitMini::ThreadPool pool( *this );
- pool.add( new work_thread( pool, testMap ), c_nThreadCount );
- pool.run( c_nDuration );
- //CPPUNIT_MSG( " Duration=" << pool.avgDuration() );
-
- size_t nInsertSuccess = 0;
- size_t nInsertFailed = 0;
- size_t nDeleteSuccess = 0;
- size_t nDeleteFailed = 0;
- size_t nFindSuccess = 0;
- size_t nFindFailed = 0;
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- work_thread * pThread = static_cast<work_thread *>( *it );
- assert( pThread != nullptr );
- nInsertSuccess += pThread->m_nInsertSuccess;
- nInsertFailed += pThread->m_nInsertFailed;
- nDeleteSuccess += pThread->m_nDeleteSuccess;
- nDeleteFailed += pThread->m_nDeleteFailed;
- nFindSuccess += pThread->m_nFindSuccess;
- nFindFailed += pThread->m_nFindFailed;
- }
-
- size_t nTotalOps = nInsertSuccess + nInsertFailed + nDeleteSuccess + nDeleteFailed + nFindSuccess + nFindFailed;
-
- CPPUNIT_MSG( " Totals (success/failed): \n\t"
- << " Insert=" << nInsertSuccess << '/' << nInsertFailed << "\n\t"
- << " Delete=" << nDeleteSuccess << '/' << nDeleteFailed << "\n\t"
- << " Find=" << nFindSuccess << '/' << nFindFailed << "\n\t"
- << " Speed=" << (nFindSuccess + nFindFailed) / c_nDuration << " find/sec\n\t"
- << " " << (nInsertSuccess + nDeleteSuccess) / c_nDuration << " modify/sec\n\t"
- << " Total ops=" << nTotalOps << "\n\t"
- << " speed=" << nTotalOps / c_nDuration << " ops/sec\n\t"
- << " Map size=" << testMap.size()
- );
-
-
- check_before_cleanup( testMap );
-
- CPPUNIT_MSG( " Clear map (single-threaded)..." );
- timer.reset();
- testMap.clear();
- CPPUNIT_MSG( " Duration=" << timer.duration() );
- CPPUNIT_ASSERT_EX( testMap.empty(), ((long long) testMap.size()) );
-
- additional_check( testMap );
- print_stat( testMap );
- additional_cleanup( testMap );
- }
-
- template <class MAP>
- void test()
- {
- CPPUNIT_MSG( "Thread count=" << c_nThreadCount
- << " initial map size=" << c_nInitialMapSize
- << " insert=" << c_nInsertPercentage << '%'
- << " delete=" << c_nDeletePercentage << '%'
- << " duration=" << c_nDuration << "s"
- );
-
- for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
- CPPUNIT_MSG( "Load factor=" << nLoadFactor );
- MAP testMap( c_nInitialMapSize, nLoadFactor );
- do_test( testMap );
- if ( c_bPrintGCState )
- print_gc_state();
- }
-
- }
-
- template <class MAP>
- void test_nolf()
- {
- CPPUNIT_MSG( "Thread count=" << c_nThreadCount
- << " initial map size=" << c_nInitialMapSize
- << " insert=" << c_nInsertPercentage << '%'
- << " delete=" << c_nDeletePercentage << '%'
- << " duration=" << c_nDuration << "s"
- );
-
- MAP testMap;
- do_test( testMap );
- if ( c_bPrintGCState )
- print_gc_state();
- }
-
- void setUpParams( const CppUnitMini::TestCfg& cfg ) {
- c_nInitialMapSize = cfg.getULong("InitialMapSize", 500000 );
- c_nThreadCount = cfg.getULong("ThreadCount", 8 );
- c_nMaxLoadFactor = cfg.getULong("MaxLoadFactor", 8 );
- c_nInsertPercentage = cfg.getUInt("InsertPercentage", 5 );
- c_nDeletePercentage = cfg.getUInt("DeletePercentage", 5 );
- c_nDuration = cfg.getUInt("Duration", 30 );
- c_bPrintGCState = cfg.getBool("PrintGCStateFlag", true );
-
- if ( c_nThreadCount == 0 )
- c_nThreadCount = cds::OS::topology::processor_count() * 2;
-
- CPPUNIT_ASSERT( c_nInsertPercentage + c_nDeletePercentage <= 100 );
-
- actions * pFirst = m_arrShuffle;
- actions * pLast = m_arrShuffle + c_nInsertPercentage;
- std::fill( pFirst, pLast, do_insert );
- pFirst = pLast;
- pLast += c_nDeletePercentage;
- std::fill( pFirst, pLast, do_delete );
- pFirst = pLast;
- pLast = m_arrShuffle + sizeof(m_arrShuffle)/sizeof(m_arrShuffle[0]);
- std::fill( pFirst, pLast, do_find );
- std::random_shuffle( m_arrShuffle, pLast );
- }
-
-# include "map2/map_defs.h"
- CDSUNIT_DECLARE_MichaelMap
- CDSUNIT_DECLARE_SplitList
- CDSUNIT_DECLARE_SkipListMap
- CDSUNIT_DECLARE_EllenBinTreeMap
- CDSUNIT_DECLARE_BronsonAVLTreeMap
- CDSUNIT_DECLARE_StripedMap
- CDSUNIT_DECLARE_RefinableMap
- CDSUNIT_DECLARE_CuckooMap
- CDSUNIT_DECLARE_StdMap
-
- CPPUNIT_TEST_SUITE( Map_InsDelFind )
- CDSUNIT_TEST_MichaelMap
- CDSUNIT_TEST_SplitList
- CDSUNIT_TEST_SkipListMap
- CDSUNIT_TEST_EllenBinTreeMap
- CDSUNIT_TEST_BronsonAVLTreeMap
- CDSUNIT_TEST_StripedMap
- CDSUNIT_TEST_RefinableMap
- CDSUNIT_TEST_CuckooMap
- CDSUNIT_TEST_StdMap
- CPPUNIT_TEST_SUITE_END()
- };
-
- CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDelFind );
+ setUpParams( m_Cfg.get( "Map_InsDelFind" ));
+
+ run_MichaelMap(in_name, invert);
+ run_SplitList(in_name, invert);
+ run_SkipListMap(in_name, invert);
+ run_EllenBinTreeMap(in_name, invert);
+ run_BronsonAVLTreeMap(in_name, invert);
+ run_StripedMap(in_name, invert);
+ run_RefinableMap(in_name, invert);
+ run_CuckooMap(in_name, invert);
+ run_StdMap(in_name, invert);
+
+ endTestCase();
+ }
} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_types.h"
+#include "cppunit/thread.h"
+#include <algorithm> // random_shuffle
+#include <vector>
+
+namespace map2 {
+
+# define TEST_MAP(X) void X() { test<MapTypes<key_type, value_type>::X >() ; }
+# define TEST_MAP_NOLF(X) void X() { test_nolf<MapTypes<key_type, value_type>::X >() ; }
+# define TEST_MAP_EXTRACT(X) TEST_MAP(X)
+# define TEST_MAP_NOLF_EXTRACT(X) TEST_MAP_NOLF(X)
+
+ class Map_InsDelFind: public CppUnitMini::TestCase
+ {
+ static size_t c_nInitialMapSize; // initial map size
+ static size_t c_nThreadCount; // thread count
+ static size_t c_nMaxLoadFactor; // maximum load factor
+ static unsigned int c_nInsertPercentage;
+ static unsigned int c_nDeletePercentage;
+ static unsigned int c_nDuration; // test duration, seconds
+ static bool c_bPrintGCState;
+
+ public:
+ enum actions
+ {
+ do_find,
+ do_insert,
+ do_delete
+ };
+ static const unsigned int c_nShuffleSize = 100;
+ actions m_arrShuffle[c_nShuffleSize];
+
+ protected:
+ typedef CppUnitMini::TestCase Base;
+ typedef size_t key_type;
+ typedef size_t value_type;
+
+ template <class MAP>
+ class WorkThread: public CppUnitMini::TestThread
+ {
+ MAP& m_Map;
+
+ virtual WorkThread * clone()
+ {
+ return new WorkThread( *this );
+ }
+ public:
+ size_t m_nInsertSuccess;
+ size_t m_nInsertFailed;
+ size_t m_nDeleteSuccess;
+ size_t m_nDeleteFailed;
+ size_t m_nFindSuccess;
+ size_t m_nFindFailed;
+
+ public:
+ WorkThread( CppUnitMini::ThreadPool& pool, MAP& rMap )
+ : CppUnitMini::TestThread( pool )
+ , m_Map( rMap )
+ {}
+ WorkThread( WorkThread& src )
+ : CppUnitMini::TestThread( src )
+ , m_Map( src.m_Map )
+ {}
+
+ Map_InsDelFind& getTest()
+ {
+ return reinterpret_cast<Map_InsDelFind&>( m_Pool.m_Test );
+ }
+
+ virtual void init() { cds::threading::Manager::attachThread() ; }
+ virtual void fini() { cds::threading::Manager::detachThread() ; }
+
+ virtual void test()
+ {
+ MAP& rMap = m_Map;
+
+ m_nInsertSuccess =
+ m_nInsertFailed =
+ m_nDeleteSuccess =
+ m_nDeleteFailed =
+ m_nFindSuccess =
+ m_nFindFailed = 0;
+
+ actions * pAct = getTest().m_arrShuffle;
+ unsigned int i = 0;
+ size_t const nNormalize = size_t(-1) / (c_nInitialMapSize * 2);
+
+ size_t nRand = 0;
+ while ( !time_elapsed() ) {
+ nRand = cds::bitop::RandXorShift(nRand);
+ size_t n = nRand / nNormalize;
+ switch ( pAct[i] ) {
+ case do_find:
+ if ( rMap.find( n ))
+ ++m_nFindSuccess;
+ else
+ ++m_nFindFailed;
+ break;
+ case do_insert:
+ if ( rMap.insert( n, n ))
+ ++m_nInsertSuccess;
+ else
+ ++m_nInsertFailed;
+ break;
+ case do_delete:
+ if ( rMap.erase( n ))
+ ++m_nDeleteSuccess;
+ else
+ ++m_nDeleteFailed;
+ break;
+ }
+
+ if ( ++i >= c_nShuffleSize )
+ i = 0;
+ }
+ }
+ };
+
+ protected:
+ template <class MAP>
+ void do_test( MAP& testMap )
+ {
+ typedef WorkThread<MAP> work_thread;
+ cds::OS::Timer timer;
+
+ // fill map - only odd number
+ {
+ std::vector<size_t> arr;
+ arr.reserve( c_nInitialMapSize );
+ for ( size_t i = 0; i < c_nInitialMapSize; ++i )
+ arr.push_back( i * 2 + 1);
+ std::random_shuffle( arr.begin(), arr.end() );
+ for ( size_t i = 0; i < c_nInitialMapSize; ++i )
+ testMap.insert( arr[i], arr[i] );
+ }
+ CPPUNIT_MSG( " Insert " << c_nInitialMapSize << " items time (single-threaded)=" << timer.duration() );
+
+ timer.reset();
+ CppUnitMini::ThreadPool pool( *this );
+ pool.add( new work_thread( pool, testMap ), c_nThreadCount );
+ pool.run( c_nDuration );
+ //CPPUNIT_MSG( " Duration=" << pool.avgDuration() );
+
+ size_t nInsertSuccess = 0;
+ size_t nInsertFailed = 0;
+ size_t nDeleteSuccess = 0;
+ size_t nDeleteFailed = 0;
+ size_t nFindSuccess = 0;
+ size_t nFindFailed = 0;
+ for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
+ work_thread * pThread = static_cast<work_thread *>( *it );
+ assert( pThread != nullptr );
+ nInsertSuccess += pThread->m_nInsertSuccess;
+ nInsertFailed += pThread->m_nInsertFailed;
+ nDeleteSuccess += pThread->m_nDeleteSuccess;
+ nDeleteFailed += pThread->m_nDeleteFailed;
+ nFindSuccess += pThread->m_nFindSuccess;
+ nFindFailed += pThread->m_nFindFailed;
+ }
+
+ size_t nTotalOps = nInsertSuccess + nInsertFailed + nDeleteSuccess + nDeleteFailed + nFindSuccess + nFindFailed;
+
+ CPPUNIT_MSG( " Totals (success/failed): \n\t"
+ << " Insert=" << nInsertSuccess << '/' << nInsertFailed << "\n\t"
+ << " Delete=" << nDeleteSuccess << '/' << nDeleteFailed << "\n\t"
+ << " Find=" << nFindSuccess << '/' << nFindFailed << "\n\t"
+ << " Speed=" << (nFindSuccess + nFindFailed) / c_nDuration << " find/sec\n\t"
+ << " " << (nInsertSuccess + nDeleteSuccess) / c_nDuration << " modify/sec\n\t"
+ << " Total ops=" << nTotalOps << "\n\t"
+ << " speed=" << nTotalOps / c_nDuration << " ops/sec\n\t"
+ << " Map size=" << testMap.size()
+ );
+
+
+ check_before_cleanup( testMap );
+
+ CPPUNIT_MSG( " Clear map (single-threaded)..." );
+ timer.reset();
+ testMap.clear();
+ CPPUNIT_MSG( " Duration=" << timer.duration() );
+ CPPUNIT_ASSERT_EX( testMap.empty(), ((long long) testMap.size()) );
+
+ additional_check( testMap );
+ print_stat( testMap );
+ additional_cleanup( testMap );
+ }
+
+ template <class MAP>
+ void test()
+ {
+ CPPUNIT_MSG( "Thread count=" << c_nThreadCount
+ << " initial map size=" << c_nInitialMapSize
+ << " insert=" << c_nInsertPercentage << '%'
+ << " delete=" << c_nDeletePercentage << '%'
+ << " duration=" << c_nDuration << "s"
+ );
+
+ for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
+ CPPUNIT_MSG( "Load factor=" << nLoadFactor );
+ MAP testMap( c_nInitialMapSize, nLoadFactor );
+ do_test( testMap );
+ if ( c_bPrintGCState )
+ print_gc_state();
+ }
+
+ }
+
+ template <class MAP>
+ void test_nolf()
+ {
+ CPPUNIT_MSG( "Thread count=" << c_nThreadCount
+ << " initial map size=" << c_nInitialMapSize
+ << " insert=" << c_nInsertPercentage << '%'
+ << " delete=" << c_nDeletePercentage << '%'
+ << " duration=" << c_nDuration << "s"
+ );
+
+ MAP testMap;
+ do_test( testMap );
+ if ( c_bPrintGCState )
+ print_gc_state();
+ }
+
+ void setUpParams( const CppUnitMini::TestCfg& cfg );
+
+ void run_MichaelMap(const char *in_name, bool invert = false);
+ void run_SplitList(const char *in_name, bool invert = false);
+ void run_StripedMap(const char *in_name, bool invert = false);
+ void run_RefinableMap(const char *in_name, bool invert = false);
+ void run_CuckooMap(const char *in_name, bool invert = false);
+ void run_SkipListMap(const char *in_name, bool invert = false);
+ void run_EllenBinTreeMap(const char *in_name, bool invert = false);
+ void run_BronsonAVLTreeMap(const char *in_name, bool invert = false);
+ void run_StdMap(const char *in_name, bool invert = false);
+
+ virtual void myRun(const char *in_name, bool invert = false);
+
+# include "map2/map_defs.h"
+ CDSUNIT_DECLARE_MichaelMap
+ CDSUNIT_DECLARE_SplitList
+ CDSUNIT_DECLARE_SkipListMap
+ CDSUNIT_DECLARE_EllenBinTreeMap
+ CDSUNIT_DECLARE_BronsonAVLTreeMap
+ CDSUNIT_DECLARE_StripedMap
+ CDSUNIT_DECLARE_RefinableMap
+ CDSUNIT_DECLARE_CuckooMap
+ CDSUNIT_DECLARE_StdMap
+ };
+} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insdelfind.h"
+
+namespace map2 {
+ CPPUNIT_TEST_SUITE_PART( Map_InsDelFind, run_BronsonAVLTreeMap )
+ CDSUNIT_TEST_BronsonAVLTreeMap
+ CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insdelfind.h"
+
+namespace map2 {
+ CPPUNIT_TEST_SUITE_PART( Map_InsDelFind, run_CuckooMap )
+ CDSUNIT_TEST_CuckooMap
+ CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insdelfind.h"
+
+namespace map2 {
+ CPPUNIT_TEST_SUITE_PART( Map_InsDelFind, run_EllenBinTreeMap )
+ CDSUNIT_TEST_EllenBinTreeMap
+ CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insdelfind.h"
+
+namespace map2 {
+ CPPUNIT_TEST_SUITE_PART( Map_InsDelFind, run_MichaelMap )
+ CDSUNIT_TEST_MichaelMap
+ CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insdelfind.h"
+
+namespace map2 {
+ CPPUNIT_TEST_SUITE_PART( Map_InsDelFind, run_RefinableMap )
+ CDSUNIT_TEST_RefinableMap
+ CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insdelfind.h"
+
+namespace map2 {
+ CPPUNIT_TEST_SUITE_PART( Map_InsDelFind, run_SkipListMap )
+ CDSUNIT_TEST_SkipListMap
+ CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insdelfind.h"
+
+namespace map2 {
+ CPPUNIT_TEST_SUITE_PART( Map_InsDelFind, run_SplitList )
+ CDSUNIT_TEST_SplitList
+ CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insdelfind.h"
+
+namespace map2 {
+ CPPUNIT_TEST_SUITE_PART( Map_InsDelFind, run_StdMap )
+ CDSUNIT_TEST_StdMap
+ CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insdelfind.h"
+
+namespace map2 {
+ CPPUNIT_TEST_SUITE_PART( Map_InsDelFind, run_StripedMap )
+ CDSUNIT_TEST_StripedMap
+ CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2