From c625ef0eddef4f5c21cb567b3f57de380f7ec838 Mon Sep 17 00:00:00 2001 From: khizmax Date: Mon, 2 May 2016 21:13:44 +0300 Subject: [PATCH] Migrated Set_DelOdd stress test to gtest framework --- projects/Win/vc14/cds.sln | 42 + projects/Win/vc14/stress-framework.vcxproj | 2 + .../Win/vc14/stress-framework.vcxproj.filters | 6 + projects/Win/vc14/stress-pqueue.vcxproj | 4 +- projects/Win/vc14/stress-queue.vcxproj | 4 +- projects/Win/vc14/stress-set-delodd.vcxproj | 270 +++++++ .../vc14/stress-set-delodd.vcxproj.filters | 48 ++ projects/Win/vc14/stress-stack.vcxproj | 4 +- test/include/cds_test/hash_func.h | 6 +- test/include/cds_test/stat_cuckoo_out.h | 116 +++ .../cds_test/stat_feldman_hashset_out.h | 87 ++ test/include/cds_test/stat_splitlist_out.h | 66 ++ test/include/cds_test/stress_test.h | 9 + test/stress/CMakeLists.txt | 3 + test/stress/data/test-debug.conf | 7 +- test/stress/data/test-express.conf | 7 +- test/stress/data/test.conf | 7 +- .../ellen_bintree_update_desc_pool.cpp | 40 + .../ellen_bintree_update_desc_pool.h | 131 +++ test/stress/queue/push_pop.cpp | 1 + test/stress/set/CMakeLists.txt | 9 + test/stress/set/delodd/CMakeLists.txt | 28 + test/stress/set/delodd/set_delodd.cpp | 116 +++ test/stress/set/delodd/set_delodd.h | 745 ++++++++++++++++++ test/stress/set/delodd/set_delodd_cuckoo.cpp | 67 ++ .../set/delodd/set_delodd_ellentree.cpp | 66 ++ .../set/delodd/set_delodd_feldman_hashset.cpp | 63 ++ test/stress/set/delodd/set_delodd_michael.cpp | 124 +++ test/stress/set/delodd/set_delodd_skip.cpp | 135 ++++ test/stress/set/delodd/set_delodd_split.cpp | 172 ++++ test/stress/set/set_type.h | 251 ++++++ test/stress/set/set_type_cuckoo.h | 210 +++++ test/stress/set/set_type_ellen_bintree.h | 329 ++++++++ test/stress/set/set_type_feldman_hashset.h | 322 ++++++++ test/stress/set/set_type_lazy_list.h | 144 ++++ test/stress/set/set_type_michael.h | 197 +++++ test/stress/set/set_type_michael_list.h | 144 ++++ test/stress/set/set_type_skip_list.h | 228 ++++++ test/stress/set/set_type_split_list.h | 526 +++++++++++++ test/stress/set/set_type_std.h | 245 ++++++ test/stress/set/set_type_striped.h | 619 +++++++++++++++ 41 files changed, 5585 insertions(+), 15 deletions(-) create mode 100644 projects/Win/vc14/stress-set-delodd.vcxproj create mode 100644 projects/Win/vc14/stress-set-delodd.vcxproj.filters create mode 100644 test/include/cds_test/stat_cuckoo_out.h create mode 100644 test/include/cds_test/stat_feldman_hashset_out.h create mode 100644 test/include/cds_test/stat_splitlist_out.h create mode 100644 test/stress/framework/ellen_bintree_update_desc_pool.cpp create mode 100644 test/stress/framework/ellen_bintree_update_desc_pool.h create mode 100644 test/stress/set/CMakeLists.txt create mode 100644 test/stress/set/delodd/CMakeLists.txt create mode 100644 test/stress/set/delodd/set_delodd.cpp create mode 100644 test/stress/set/delodd/set_delodd.h create mode 100644 test/stress/set/delodd/set_delodd_cuckoo.cpp create mode 100644 test/stress/set/delodd/set_delodd_ellentree.cpp create mode 100644 test/stress/set/delodd/set_delodd_feldman_hashset.cpp create mode 100644 test/stress/set/delodd/set_delodd_michael.cpp create mode 100644 test/stress/set/delodd/set_delodd_skip.cpp create mode 100644 test/stress/set/delodd/set_delodd_split.cpp create mode 100644 test/stress/set/set_type.h create mode 100644 test/stress/set/set_type_cuckoo.h create mode 100644 test/stress/set/set_type_ellen_bintree.h create mode 100644 test/stress/set/set_type_feldman_hashset.h create mode 100644 test/stress/set/set_type_lazy_list.h create mode 100644 test/stress/set/set_type_michael.h create mode 100644 test/stress/set/set_type_michael_list.h create mode 100644 test/stress/set/set_type_skip_list.h create mode 100644 test/stress/set/set_type_split_list.h create mode 100644 test/stress/set/set_type_std.h create mode 100644 test/stress/set/set_type_striped.h diff --git a/projects/Win/vc14/cds.sln b/projects/Win/vc14/cds.sln index 87e2b638..ed5e5672 100644 --- a/projects/Win/vc14/cds.sln +++ b/projects/Win/vc14/cds.sln @@ -126,8 +126,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cds_test", "cds_test", "{3A ProjectSection(SolutionItems) = preProject ..\..\..\test\include\cds_test\check_size.h = ..\..\..\test\include\cds_test\check_size.h ..\..\..\test\include\cds_test\fixture.h = ..\..\..\test\include\cds_test\fixture.h + ..\..\..\test\include\cds_test\hash_func.h = ..\..\..\test\include\cds_test\hash_func.h + ..\..\..\test\include\cds_test\stat_cuckoo_out.h = ..\..\..\test\include\cds_test\stat_cuckoo_out.h ..\..\..\test\include\cds_test\stat_ellenbintree_out.h = ..\..\..\test\include\cds_test\stat_ellenbintree_out.h + ..\..\..\test\include\cds_test\stat_feldman_hashset_out.h = ..\..\..\test\include\cds_test\stat_feldman_hashset_out.h ..\..\..\test\include\cds_test\stat_skiplist_out.h = ..\..\..\test\include\cds_test\stat_skiplist_out.h + ..\..\..\test\include\cds_test\stat_splitlist_out.h = ..\..\..\test\include\cds_test\stat_splitlist_out.h ..\..\..\test\include\cds_test\stress_test.h = ..\..\..\test\include\cds_test\stress_test.h ..\..\..\test\include\cds_test\thread.h = ..\..\..\test\include\cds_test\thread.h EndProjectSection @@ -208,6 +212,29 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-misc", "gtest-misc.vc {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239} EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "set", "set", "{0D83E8C7-97D1-4BA1-928A-6846E7089652}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress-set-delodd", "stress-set-delodd.vcxproj", "{8202D428-1E08-4744-B372-6B2E83A9928E}" + ProjectSection(ProjectDependencies) = postProject + {A34CED07-A442-4FA1-81C4-F8B9CD3C832B} = {A34CED07-A442-4FA1-81C4-F8B9CD3C832B} + {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Header Files", "Header Files", "{D968B0F5-52BD-40C1-B230-28104567CE97}" + ProjectSection(SolutionItems) = preProject + ..\..\..\test\stress\set\set_type.h = ..\..\..\test\stress\set\set_type.h + ..\..\..\test\stress\set\set_type_cuckoo.h = ..\..\..\test\stress\set\set_type_cuckoo.h + ..\..\..\test\stress\set\set_type_ellen_bintree.h = ..\..\..\test\stress\set\set_type_ellen_bintree.h + ..\..\..\test\stress\set\set_type_feldman_hashset.h = ..\..\..\test\stress\set\set_type_feldman_hashset.h + ..\..\..\test\stress\set\set_type_lazy_list.h = ..\..\..\test\stress\set\set_type_lazy_list.h + ..\..\..\test\stress\set\set_type_michael.h = ..\..\..\test\stress\set\set_type_michael.h + ..\..\..\test\stress\set\set_type_michael_list.h = ..\..\..\test\stress\set\set_type_michael_list.h + ..\..\..\test\stress\set\set_type_skip_list.h = ..\..\..\test\stress\set\set_type_skip_list.h + ..\..\..\test\stress\set\set_type_split_list.h = ..\..\..\test\stress\set\set_type_split_list.h + ..\..\..\test\stress\set\set_type_std.h = ..\..\..\test\stress\set\set_type_std.h + ..\..\..\test\stress\set\set_type_striped.h = ..\..\..\test\stress\set\set_type_striped.h + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -542,6 +569,18 @@ Global {FA22E700-1AE5-4D7B-B9F1-0A919FF7FF06}.Release|Win32.Build.0 = Release|Win32 {FA22E700-1AE5-4D7B-B9F1-0A919FF7FF06}.Release|x64.ActiveCfg = Release|x64 {FA22E700-1AE5-4D7B-B9F1-0A919FF7FF06}.Release|x64.Build.0 = Release|x64 + {8202D428-1E08-4744-B372-6B2E83A9928E}.Debug|Win32.ActiveCfg = Debug|Win32 + {8202D428-1E08-4744-B372-6B2E83A9928E}.Debug|Win32.Build.0 = Debug|Win32 + {8202D428-1E08-4744-B372-6B2E83A9928E}.Debug|x64.ActiveCfg = Debug|x64 + {8202D428-1E08-4744-B372-6B2E83A9928E}.Debug|x64.Build.0 = Debug|x64 + {8202D428-1E08-4744-B372-6B2E83A9928E}.DebugVLD|Win32.ActiveCfg = DebugVLD|Win32 + {8202D428-1E08-4744-B372-6B2E83A9928E}.DebugVLD|Win32.Build.0 = DebugVLD|Win32 + {8202D428-1E08-4744-B372-6B2E83A9928E}.DebugVLD|x64.ActiveCfg = DebugVLD|x64 + {8202D428-1E08-4744-B372-6B2E83A9928E}.DebugVLD|x64.Build.0 = DebugVLD|x64 + {8202D428-1E08-4744-B372-6B2E83A9928E}.Release|Win32.ActiveCfg = Release|Win32 + {8202D428-1E08-4744-B372-6B2E83A9928E}.Release|Win32.Build.0 = Release|Win32 + {8202D428-1E08-4744-B372-6B2E83A9928E}.Release|x64.ActiveCfg = Release|x64 + {8202D428-1E08-4744-B372-6B2E83A9928E}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -575,6 +614,9 @@ Global {00FD5CB8-E1A4-40CA-B613-30A06A75622B} = {810490B7-31E5-49AE-8455-CAF99A9658B6} {2ABD6A2E-BEA7-4C8C-982B-A609F83D2DCB} = {810490B7-31E5-49AE-8455-CAF99A9658B6} {FA22E700-1AE5-4D7B-B9F1-0A919FF7FF06} = {810490B7-31E5-49AE-8455-CAF99A9658B6} + {0D83E8C7-97D1-4BA1-928A-6846E7089652} = {10E1FAF2-904D-405E-8AB5-6878A1B03346} + {8202D428-1E08-4744-B372-6B2E83A9928E} = {0D83E8C7-97D1-4BA1-928A-6846E7089652} + {D968B0F5-52BD-40C1-B230-28104567CE97} = {0D83E8C7-97D1-4BA1-928A-6846E7089652} EndGlobalSection GlobalSection(DPCodeReviewSolutionGUID) = preSolution DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} diff --git a/projects/Win/vc14/stress-framework.vcxproj b/projects/Win/vc14/stress-framework.vcxproj index 893c66c7..f4de7a03 100644 --- a/projects/Win/vc14/stress-framework.vcxproj +++ b/projects/Win/vc14/stress-framework.vcxproj @@ -28,6 +28,7 @@ + @@ -40,6 +41,7 @@ 4267 + diff --git a/projects/Win/vc14/stress-framework.vcxproj.filters b/projects/Win/vc14/stress-framework.vcxproj.filters index 557cbb20..a757333f 100644 --- a/projects/Win/vc14/stress-framework.vcxproj.filters +++ b/projects/Win/vc14/stress-framework.vcxproj.filters @@ -21,6 +21,9 @@ Header Files + + Header Files + @@ -35,6 +38,9 @@ Source Files + + Source Files + diff --git a/projects/Win/vc14/stress-pqueue.vcxproj b/projects/Win/vc14/stress-pqueue.vcxproj index 6349e317..3c32f120 100644 --- a/projects/Win/vc14/stress-pqueue.vcxproj +++ b/projects/Win/vc14/stress-pqueue.vcxproj @@ -223,7 +223,7 @@ true true $(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) - gtest.lib;stres-framework.lib;%(AdditionalDependencies) + gtest.lib;stress-framework.lib;%(AdditionalDependencies) @@ -242,7 +242,7 @@ true true $(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) - gtest.lib;stres-framework.lib;%(AdditionalDependencies) + gtest.lib;stress-framework.lib;%(AdditionalDependencies) diff --git a/projects/Win/vc14/stress-queue.vcxproj b/projects/Win/vc14/stress-queue.vcxproj index 2a1c3746..5dc03005 100644 --- a/projects/Win/vc14/stress-queue.vcxproj +++ b/projects/Win/vc14/stress-queue.vcxproj @@ -228,7 +228,7 @@ true true $(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) - gtest.lib;stres-framework.lib;%(AdditionalDependencies) + gtest.lib;stress-framework.lib;%(AdditionalDependencies) @@ -247,7 +247,7 @@ true true $(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) - gtest.lib;stres-framework.lib;%(AdditionalDependencies) + gtest.lib;stress-framework.lib;%(AdditionalDependencies) diff --git a/projects/Win/vc14/stress-set-delodd.vcxproj b/projects/Win/vc14/stress-set-delodd.vcxproj new file mode 100644 index 00000000..7c0bc7c5 --- /dev/null +++ b/projects/Win/vc14/stress-set-delodd.vcxproj @@ -0,0 +1,270 @@ + + + + + DebugVLD + Win32 + + + DebugVLD + x64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + _SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + 4503 + 4503 + + + + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + + + + + {8202D428-1E08-4744-B372-6B2E83A9928E} + Win32Proj + stress_set_delodd + 8.1 + stress-set-delodd + + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ + $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ + $(ProjectName)_d + + + true + $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ + $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ + $(ProjectName)_d + + + true + $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ + $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ + $(ProjectName)_d + + + true + $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ + $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ + $(ProjectName)_d + + + false + $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\ + $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ + + + false + $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\ + $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ + + + + NotUsing + Level3 + Disabled + _ENABLE_ATOMIC_ALIGNMENT_FIX;CDSUNIT_USE_URCU;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(SolutionDir)..\..\..\test\stress\set;$(SolutionDir)..\..\..\test\stress\;$(BOOST_PATH);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + + + Console + true + $(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtestd.lib;stress-framework_d.lib;%(AdditionalDependencies) + + + + + NotUsing + Level3 + Disabled + _ENABLE_ATOMIC_ALIGNMENT_FIX;CDSUNIT_USE_URCU;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(SolutionDir)..\..\..\test\stress\set;$(SolutionDir)..\..\..\test\stress\;$(BOOST_PATH);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + + + Console + true + $(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtestd.lib;stress-framework_d.lib;%(AdditionalDependencies) + + + + + NotUsing + Level3 + Disabled + _ENABLE_ATOMIC_ALIGNMENT_FIX;CDSUNIT_USE_URCU;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(SolutionDir)..\..\..\test\stress\set;$(SolutionDir)..\..\..\test\stress\;$(BOOST_PATH);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + + + Console + true + $(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtestd.lib;stress-framework_d.lib;%(AdditionalDependencies) + + + + + NotUsing + Level3 + Disabled + _ENABLE_ATOMIC_ALIGNMENT_FIX;CDSUNIT_USE_URCU;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(SolutionDir)..\..\..\test\stress\set;$(SolutionDir)..\..\..\test\stress\;$(BOOST_PATH);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + + + Console + true + $(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtestd.lib;stress-framework_d.lib;%(AdditionalDependencies) + + + + + Level3 + NotUsing + MaxSpeed + true + true + _ENABLE_ATOMIC_ALIGNMENT_FIX;CDSUNIT_USE_URCU;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(SolutionDir)..\..\..\test\stress\set;$(SolutionDir)..\..\..\test\stress\;$(BOOST_PATH);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + + + Console + true + true + true + $(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtest.lib;stress-framework.lib;%(AdditionalDependencies) + + + + + Level3 + NotUsing + MaxSpeed + true + true + _ENABLE_ATOMIC_ALIGNMENT_FIX;CDSUNIT_USE_URCU;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(SolutionDir)..\..\..\test\stress\set;$(SolutionDir)..\..\..\test\stress\;$(BOOST_PATH);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + + + Console + true + true + true + $(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) + gtest.lib;stress-framework.lib;%(AdditionalDependencies) + + + + + + \ No newline at end of file diff --git a/projects/Win/vc14/stress-set-delodd.vcxproj.filters b/projects/Win/vc14/stress-set-delodd.vcxproj.filters new file mode 100644 index 00000000..ee2c183b --- /dev/null +++ b/projects/Win/vc14/stress-set-delodd.vcxproj.filters @@ -0,0 +1,48 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/projects/Win/vc14/stress-stack.vcxproj b/projects/Win/vc14/stress-stack.vcxproj index 17f254dd..4e936da1 100644 --- a/projects/Win/vc14/stress-stack.vcxproj +++ b/projects/Win/vc14/stress-stack.vcxproj @@ -218,7 +218,7 @@ true true $(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) - gtest.lib;stres-framework.lib;%(AdditionalDependencies) + gtest.lib;stress-framework.lib;%(AdditionalDependencies) @@ -237,7 +237,7 @@ true true $(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir) - gtest.lib;stres-framework.lib;%(AdditionalDependencies) + gtest.lib;stress-framework.lib;%(AdditionalDependencies) diff --git a/test/include/cds_test/hash_func.h b/test/include/cds_test/hash_func.h index abbc7802..0595b1c5 100644 --- a/test/include/cds_test/hash_func.h +++ b/test/include/cds_test/hash_func.h @@ -6,10 +6,10 @@ #include #if CDS_BUILD_BITS == 64 -# include "hashing/city.h" +# include #endif -namespace hashing { +namespace cds_test { #if CDS_BUILD_BITS == 64 class city32 { @@ -103,6 +103,6 @@ namespace hashing { #endif // #if CDS_BUILD_BITS == 64 -} // namespace hashing +} // namespace cds_test #endif // #ifndef CDSUNIT_HASH_FUNC_H diff --git a/test/include/cds_test/stat_cuckoo_out.h b/test/include/cds_test/stat_cuckoo_out.h new file mode 100644 index 00000000..25c198f7 --- /dev/null +++ b/test/include/cds_test/stat_cuckoo_out.h @@ -0,0 +1,116 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSTEST_STAT_CUCKOO_OUT_H +#define CDSTEST_STAT_CUCKOO_OUT_H + +#include + +namespace cds_test { + + static inline property_stream& operator <<( property_stream& o, cds::intrusive::cuckoo::striping_stat const& s ) + { + return o + << CDSSTRESS_STAT_OUT( s, m_nCellLockCount ) + << CDSSTRESS_STAT_OUT( s, m_nCellLockCount ) + << CDSSTRESS_STAT_OUT( s, m_nCellTryLockCount ) + << CDSSTRESS_STAT_OUT( s, m_nFullLockCount ) + << CDSSTRESS_STAT_OUT( s, m_nResizeLockCount ) + << CDSSTRESS_STAT_OUT( s, m_nResizeCount ); + } + + static inline property_stream& operator <<( property_stream& o, cds::intrusive::cuckoo::empty_striping_stat const& /*s*/ ) + { + return o; + } + + static inline property_stream& operator <<( property_stream& o, cds::intrusive::cuckoo::refinable_stat const& s ) + { + return o + << CDSSTRESS_STAT_OUT( s, m_nCellLockCount ) + << CDSSTRESS_STAT_OUT( s, m_nCellLockWaitResizing ) + << CDSSTRESS_STAT_OUT( s, m_nCellLockArrayChanged ) + << CDSSTRESS_STAT_OUT( s, m_nCellLockFailed ) + << CDSSTRESS_STAT_OUT( s, m_nSecondCellLockCount ) + << CDSSTRESS_STAT_OUT( s, m_nSecondCellLockFailed ) + << CDSSTRESS_STAT_OUT( s, m_nFullLockCount ) + << CDSSTRESS_STAT_OUT( s, m_nFullLockIter ) + << CDSSTRESS_STAT_OUT( s, m_nResizeLockCount ) + << CDSSTRESS_STAT_OUT( s, m_nResizeLockIter ) + << CDSSTRESS_STAT_OUT( s, m_nResizeLockArrayChanged ) + << CDSSTRESS_STAT_OUT( s, m_nResizeCount ); + } + + static inline property_stream& operator <<( property_stream& o, cds::intrusive::cuckoo::empty_refinable_stat const& /*s*/ ) + { + return o; + } + + static inline property_stream& operator <<( property_stream& o, cds::intrusive::cuckoo::stat const& s ) + { + return o + << CDSSTRESS_STAT_OUT( s, m_nRelocateCallCount ) + << CDSSTRESS_STAT_OUT( s, m_nRelocateRoundCount ) + << CDSSTRESS_STAT_OUT( s, m_nFalseRelocateCount ) + << CDSSTRESS_STAT_OUT( s, m_nSuccessRelocateCount ) + << CDSSTRESS_STAT_OUT( s, m_nRelocateAboveThresholdCount ) + << CDSSTRESS_STAT_OUT( s, m_nFailedRelocateCount ) + << CDSSTRESS_STAT_OUT( s, m_nResizeCallCount ) + << CDSSTRESS_STAT_OUT( s, m_nFalseResizeCount ) + << CDSSTRESS_STAT_OUT( s, m_nResizeSuccessNodeMove ) + << CDSSTRESS_STAT_OUT( s, m_nResizeRelocateCall ) + << CDSSTRESS_STAT_OUT( s, m_nInsertSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nInsertFailed ) + << CDSSTRESS_STAT_OUT( s, m_nInsertResizeCount ) + << CDSSTRESS_STAT_OUT( s, m_nInsertRelocateCount ) + << CDSSTRESS_STAT_OUT( s, m_nInsertRelocateFault ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateExistCount ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateSuccessCount ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateResizeCount ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateRelocateCount ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateRelocateFault ) + << CDSSTRESS_STAT_OUT( s, m_nUnlinkSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nUnlinkFailed ) + << CDSSTRESS_STAT_OUT( s, m_nEraseSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nEraseFailed ) + << CDSSTRESS_STAT_OUT( s, m_nFindSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nFindFailed ) + << CDSSTRESS_STAT_OUT( s, m_nFindWithSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nFindWithFailed ); + } + + static inline property_stream& operator <<( property_stream& o, cds::intrusive::cuckoo::empty_stat const& /*s*/ ) + { + return o; + } + +} // namespace cds_test + +#endif // #ifndef CDSTEST_STAT_CUCKOO_OUT_H diff --git a/test/include/cds_test/stat_feldman_hashset_out.h b/test/include/cds_test/stat_feldman_hashset_out.h new file mode 100644 index 00000000..7b3c5400 --- /dev/null +++ b/test/include/cds_test/stat_feldman_hashset_out.h @@ -0,0 +1,87 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSTEST_STAT_FELDMAN_HASHSET_OUT_H +#define CDSTEST_STAT_FELDMAN_HASHSET_OUT_H + +#include +#include + +namespace cds_test { + + static inline property_stream& operator <<( property_stream& o, cds::intrusive::feldman_hashset::empty_stat const& /*s*/ ) + { + return o; + } + + static inline property_stream& operator <<( property_stream& o, cds::intrusive::feldman_hashset::stat<> const& s ) + { + return o + << CDSSTRESS_STAT_OUT( s, m_nInsertSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nInsertFailed ) + << CDSSTRESS_STAT_OUT( s, m_nInsertRetry ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateNew ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateExisting ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateFailed ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateRetry ) + << CDSSTRESS_STAT_OUT( s, m_nEraseSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nEraseFailed ) + << CDSSTRESS_STAT_OUT( s, m_nEraseRetry ) + << CDSSTRESS_STAT_OUT( s, m_nFindSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nFindFailed ) + << CDSSTRESS_STAT_OUT( s, m_nExpandNodeSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nExpandNodeFailed ) + << CDSSTRESS_STAT_OUT( s, m_nSlotChanged ) + << CDSSTRESS_STAT_OUT( s, m_nSlotConverting ) + << CDSSTRESS_STAT_OUT( s, m_nArrayNodeCount ) + << CDSSTRESS_STAT_OUT( s, m_nHeight ); + } + + static inline property_stream& operator<<( property_stream& o, std::vector< cds::intrusive::feldman_hashset::level_statistics > const& level_stat ) + { +# define CDSSTRESS_LEVELSTAT_OUT( level, field ) \ + CDSSTRESS_STAT_OUT_( "level_stat." + std::to_string(level) + "." + #field, it->field ) + + o << CDSSTRESS_STAT_OUT_( "stat.level_count", level_stat.size() ); + size_t i = 0; + for ( auto it = level_stat.begin(); it != level_stat.end(); ++it, ++i ) { + o << CDSSTRESS_LEVELSTAT_OUT( i, array_node_count ) + << CDSSTRESS_LEVELSTAT_OUT( i, node_capacity ) + << CDSSTRESS_LEVELSTAT_OUT( i, data_cell_count ) + << CDSSTRESS_LEVELSTAT_OUT( i, array_cell_count ) + << CDSSTRESS_LEVELSTAT_OUT( i, empty_cell_count ); + } + return o; +# undef CDSSTRESS_LEVELSTAT_OUT + } + +} // namespace std + +#endif // #ifndef CDSTEST_STAT_FELDMAN_HASHSET_OUT_H diff --git a/test/include/cds_test/stat_splitlist_out.h b/test/include/cds_test/stat_splitlist_out.h new file mode 100644 index 00000000..90343491 --- /dev/null +++ b/test/include/cds_test/stat_splitlist_out.h @@ -0,0 +1,66 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSTEST_STAT_SPLITLIST_OUT_H +#define CDSTEST_STAT_SPLITLIST_OUT_H + +#include + +namespace cds_test { + + static inline property_stream& operator <<( property_stream& o, cds::intrusive::split_list::empty_stat const& /*s*/ ) + { + return o; + } + + static inline property_stream& operator <<( property_stream& o, cds::intrusive::split_list::stat<> const& s ) + { + return o + << CDSSTRESS_STAT_OUT( s, m_nInsertSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nInsertFailed ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateExist ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateNew ) + << CDSSTRESS_STAT_OUT( s, m_nExtractSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nExtractFailed ) + << CDSSTRESS_STAT_OUT( s, m_nEraseSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nEraseFailed ) + << CDSSTRESS_STAT_OUT( s, m_nFindSuccess ) + << CDSSTRESS_STAT_OUT( s, m_nFindFailed ) + << CDSSTRESS_STAT_OUT( s, m_nHeadNodeAllocated ) + << CDSSTRESS_STAT_OUT( s, m_nHeadNodeFreed ) + << CDSSTRESS_STAT_OUT( s, m_nBucketCount ) + << CDSSTRESS_STAT_OUT( s, m_nInitBucketRecursive ) + << CDSSTRESS_STAT_OUT( s, m_nInitBucketContention ) + << CDSSTRESS_STAT_OUT( s, m_nBusyWaitBucketInit ); + } + +} // namespace cds_test + +#endif // #ifndef CDSTEST_STAT_SPLITLIST_OUT_H diff --git a/test/include/cds_test/stress_test.h b/test/include/cds_test/stress_test.h index eac2b7e3..10aeff54 100644 --- a/test/include/cds_test/stress_test.h +++ b/test/include/cds_test/stress_test.h @@ -126,6 +126,15 @@ namespace cds_test { return s; } + template + static inline property_stream& operator <<( property_stream& s, std::pair prop ) + { + std::stringstream ss; + ss << prop.second; + ::testing::Test::RecordProperty( prop.first.c_str(), ss.str().c_str() ); + return s; + } + static inline property_stream& operator <<( property_stream& s, std::pair prop ) { std::stringstream ss; diff --git a/test/stress/CMakeLists.txt b/test/stress/CMakeLists.txt index 7f45d5b6..d310abe8 100644 --- a/test/stress/CMakeLists.txt +++ b/test/stress/CMakeLists.txt @@ -3,6 +3,7 @@ set(CDSSTRESS_FRAMEWORK_LIBRARY stress-framework) set(CDSSTRESS_FRAMEWORK_SOURCES framework/city.cpp framework/config.cpp + framework/ellen_bintree_update_desc_pool.cpp framework/michael_alloc.cpp framework/stress_test.cpp ) @@ -15,6 +16,7 @@ include_directories( add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pqueue) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/queue) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/set) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stack) add_custom_target( stress-all @@ -22,6 +24,7 @@ add_custom_target( stress-all stress-pqueue stress-queue stress-stack + stress-set ) file(GLOB CONF_FILES ${PROJECT_SOURCE_DIR}/test/stress/data/*.conf) diff --git a/test/stress/data/test-debug.conf b/test/stress/data/test-debug.conf index f286e370..345d37f7 100644 --- a/test/stress/data/test-debug.conf +++ b/test/stress/data/test-debug.conf @@ -8,6 +8,9 @@ dhp_liberate_threshold=1024 dhp_init_guard_count=8 dhp_epoch_count=16 +# cds::urcu::gc initialization parameters +rcu_buffer_size=256 + [Atomic_ST] iterCount=10000 @@ -315,13 +318,13 @@ CuckooProbesetThreshold=0 FeldmanMapHeadBits=8 FeldmanMapArrayBits=4 -[Map_DelOdd] +[map_delodd] MapSize=50000 InsThreadCount=2 DelThreadCount=2 ExtractThreadCount=2 MaxLoadFactor=4 -PrintGCStateFlag=1 + #Cuckoo map properties CuckooInitialSize=256 CuckooProbesetSize=8 diff --git a/test/stress/data/test-express.conf b/test/stress/data/test-express.conf index 3f576dfa..ac933e92 100644 --- a/test/stress/data/test-express.conf +++ b/test/stress/data/test-express.conf @@ -9,6 +9,9 @@ dhp_liberate_threshold=1024 dhp_init_guard_count=16 dhp_epoch_count=16 +# cds::urcu::gc initialization parameters +rcu_buffer_size=256 + [Atomic_ST] iterCount=1000000 @@ -309,13 +312,13 @@ CuckooProbesetThreshold=0 FeldmanMapHeadBits=8 FeldmanMapArrayBits=4 -[Map_DelOdd] +[map_delodd] MapSize=500000 InsThreadCount=4 DelThreadCount=3 ExtractThreadCount=3 MaxLoadFactor=4 -PrintGCStateFlag=1 + #Cuckoo map properties CuckooInitialSize=1024 CuckooProbesetSize=16 diff --git a/test/stress/data/test.conf b/test/stress/data/test.conf index 3d7bde4e..5bf63d4b 100644 --- a/test/stress/data/test.conf +++ b/test/stress/data/test.conf @@ -8,6 +8,9 @@ dhp_liberate_threshold=1024 dhp_init_guard_count=16 dhp_epoch_count=16 +# cds::urcu::gc initialization parameters +rcu_buffer_size=256 + [Atomic_ST] iterCount=1000000 @@ -307,13 +310,13 @@ FeldmanMapHeadBits=10 FeldmanMapArrayBits=4 -[Map_DelOdd] +[map_delodd] MapSize=1000000 InsThreadCount=4 DelThreadCount=3 ExtractThreadCount=3 MaxLoadFactor=4 -PrintGCStateFlag=1 + #Cuckoo map properties CuckooInitialSize=1024 CuckooProbesetSize=16 diff --git a/test/stress/framework/ellen_bintree_update_desc_pool.cpp b/test/stress/framework/ellen_bintree_update_desc_pool.cpp new file mode 100644 index 00000000..a8db9220 --- /dev/null +++ b/test/stress/framework/ellen_bintree_update_desc_pool.cpp @@ -0,0 +1,40 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "ellen_bintree_update_desc_pool.h" + +namespace ellen_bintree_pool { + update_desc_pool_type s_UpdateDescPool; + + bounded_update_desc_pool_type s_BoundedUpdateDescPool; + + cds::atomicity::event_counter internal_node_counter::m_nAlloc; + cds::atomicity::event_counter internal_node_counter::m_nFree; +} diff --git a/test/stress/framework/ellen_bintree_update_desc_pool.h b/test/stress/framework/ellen_bintree_update_desc_pool.h new file mode 100644 index 00000000..bd199c94 --- /dev/null +++ b/test/stress/framework/ellen_bintree_update_desc_pool.h @@ -0,0 +1,131 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_ELLEN_BINTREE_UPDATE_DESC_POOL_H +#define CDSUNIT_ELLEN_BINTREE_UPDATE_DESC_POOL_H + +#include +#include +#include +#include + +namespace ellen_bintree_pool { + typedef cds::container::ellen_bintree::node_types< cds::urcu::gc< cds::urcu::general_instant<> >, int > node_types; // fake + typedef node_types::leaf_node_type leaf_node; + typedef node_types::internal_node_type internal_node; + typedef node_types::update_desc_type update_desc; + + // Update descriptor pool based on Vyukov's queue + struct update_desc_pool_traits : public cds::memory::vyukov_queue_pool_traits + { + typedef cds::opt::v::static_buffer< cds::any_type, 4096 > buffer; + }; + + typedef cds::memory::vyukov_queue_pool< update_desc, update_desc_pool_traits > update_desc_pool_type; + extern update_desc_pool_type s_UpdateDescPool; + + struct update_desc_pool_accessor { + typedef update_desc_pool_type::value_type value_type; + + update_desc_pool_type& operator()() const + { + return s_UpdateDescPool; + } + }; + + // Update descriptor pool based on bounded Vyukov's queue + struct bounded_update_desc_pool_traits : public cds::memory::vyukov_queue_pool_traits + { + typedef cds::opt::v::static_buffer< cds::any_type, 4096 > buffer; + }; + typedef cds::memory::bounded_vyukov_queue_pool< update_desc, bounded_update_desc_pool_traits > bounded_update_desc_pool_type; + extern bounded_update_desc_pool_type s_BoundedUpdateDescPool; + + struct bounded_update_desc_pool_accessor { + typedef bounded_update_desc_pool_type::value_type value_type; + + bounded_update_desc_pool_type& operator()() const + { + return s_BoundedUpdateDescPool; + } + }; + + + // Internal node allocator + struct internal_node_counter + { + static cds::atomicity::event_counter m_nAlloc; + static cds::atomicity::event_counter m_nFree; + + static void onAlloc() + { + ++m_nAlloc; + } + static void onFree() + { + ++m_nFree; + } + + static void reset() + { + m_nAlloc.reset(); + m_nFree.reset(); + } + }; + + template + class internal_node_allocator + : public Alloc::template rebind< T >::other + , internal_node_counter + { + typedef typename Alloc::template rebind< T >::other base_class; + public: + template + struct rebind { + typedef internal_node_allocator< Other, Alloc > other; + }; + + T * allocate( size_t n, void const * pHint = nullptr ) + { + internal_node_counter::onAlloc(); + T * p = base_class::allocate( n, pHint ); + return p; + } + + void deallocate( T * p, size_t n ) + { + internal_node_counter::onFree(); + return base_class::deallocate( p, n ); + } + }; + +} // namespace ellen_bintree_pool + +#endif // #ifndef CDSUNIT_ELLEN_BINTREE_UPDATE_DESC_POOL_H diff --git a/test/stress/queue/push_pop.cpp b/test/stress/queue/push_pop.cpp index 328a51ec..5720172d 100644 --- a/test/stress/queue/push_pop.cpp +++ b/test/stress/queue/push_pop.cpp @@ -98,6 +98,7 @@ namespace { s_nProducerDone.fetch_add( 1 ); } + public: Queue& m_Queue; size_t m_nPushFailed; diff --git a/test/stress/set/CMakeLists.txt b/test/stress/set/CMakeLists.txt new file mode 100644 index 00000000..d0a5d35e --- /dev/null +++ b/test/stress/set/CMakeLists.txt @@ -0,0 +1,9 @@ + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCDSUNIT_USE_URCU") + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/delodd) + +add_custom_target( stress-set + DEPENDS + stress-set-delodd +) diff --git a/test/stress/set/delodd/CMakeLists.txt b/test/stress/set/delodd/CMakeLists.txt new file mode 100644 index 00000000..b0b9e573 --- /dev/null +++ b/test/stress/set/delodd/CMakeLists.txt @@ -0,0 +1,28 @@ +set(PACKAGE_NAME stress-set-delodd) + +set(CDSSTRESS_SET_DELODD_SOURCES + ../../main.cpp + set_delodd.cpp + set_delodd_cuckoo.cpp + set_delodd_ellentree.cpp + set_delodd_feldman_hashset.cpp + set_delodd_michael.cpp + set_delodd_skip.cpp + set_delodd_split.cpp +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. +) + +add_executable(${PACKAGE_NAME} ${CDSSTRESS_SET_DELODD_SOURCES} $) +target_link_libraries(${PACKAGE_NAME} + ${CDS_SHARED_LIBRARY} + ${GTEST_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} +) + +add_test(NAME ${PACKAGE_NAME} COMMAND ${PACKAGE_NAME} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) \ No newline at end of file diff --git a/test/stress/set/delodd/set_delodd.cpp b/test/stress/set/delodd/set_delodd.cpp new file mode 100644 index 00000000..09c44fed --- /dev/null +++ b/test/stress/set/delodd/set_delodd.cpp @@ -0,0 +1,116 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "set_delodd.h" + +namespace set { + + size_t Set_DelOdd::s_nSetSize = 1000000; + size_t Set_DelOdd::s_nInsThreadCount = 4; + size_t Set_DelOdd::s_nDelThreadCount = 4; + size_t Set_DelOdd::s_nExtractThreadCount = 4; + size_t Set_DelOdd::s_nMaxLoadFactor = 8; + + size_t Set_DelOdd::s_nCuckooInitialSize = 1024; + size_t Set_DelOdd::s_nCuckooProbesetSize = 16; + size_t Set_DelOdd::s_nCuckooProbesetThreshold = 0; + + size_t Set_DelOdd::s_nFeldmanSet_HeadBits = 10; + size_t Set_DelOdd::s_nFeldmanSet_ArrayBits = 4; + + + size_t Set_DelOdd::s_nLoadFactor = 1; + std::vector Set_DelOdd::m_arrData; + + void Set_DelOdd::SetUpTestCase() + { + cds_test::config const& cfg = get_config( "map_delodd" ); + + s_nSetSize = cfg.get_size_t( "MapSize", s_nSetSize ); + if ( s_nSetSize < 1000 ) + s_nSetSize = 1000; + + s_nInsThreadCount = cfg.get_size_t( "InsThreadCount", s_nInsThreadCount ); + if ( s_nInsThreadCount == 0 ) + s_nInsThreadCount = 1; + + s_nDelThreadCount = cfg.get_size_t( "DelThreadCount", s_nDelThreadCount ); + s_nExtractThreadCount = cfg.get_size_t( "ExtractThreadCount", s_nExtractThreadCount ); + + 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_nFeldmanSet_HeadBits = cfg.get_size_t( "FeldmanMapHeadBits", s_nFeldmanSet_HeadBits ); + if ( s_nFeldmanSet_HeadBits == 0 ) + s_nFeldmanSet_HeadBits = 2; + + s_nFeldmanSet_ArrayBits = cfg.get_size_t( "FeldmanMapArrayBits", s_nFeldmanSet_ArrayBits ); + if ( s_nFeldmanSet_ArrayBits == 0 ) + s_nFeldmanSet_ArrayBits = 2; + + m_arrData.resize( s_nSetSize ); + for ( size_t i = 0; i < s_nSetSize; ++i ) + m_arrData[i] = i; + shuffle( m_arrData.begin(), m_arrData.end() ); + } + + void Set_DelOdd::TearDownTestCase() + { + m_arrData.clear(); + } + + std::vector Set_DelOdd_LF::get_load_factors() + { + cds_test::config const& cfg = get_config( "map_delodd" ); + + s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor ); + if ( s_nMaxLoadFactor == 0 ) + s_nMaxLoadFactor = 1; + + std::vector lf; + for ( size_t n = 1; n <= s_nMaxLoadFactor; n *= 2 ) + lf.push_back( n ); + + return lf; + } + + INSTANTIATE_TEST_CASE_P( a, Set_DelOdd_LF, ::testing::ValuesIn( Set_DelOdd_LF::get_load_factors() ) ); +} // namespace set diff --git a/test/stress/set/delodd/set_delodd.h b/test/stress/set/delodd/set_delodd.h new file mode 100644 index 00000000..1fb37720 --- /dev/null +++ b/test/stress/set/delodd/set_delodd.h @@ -0,0 +1,745 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "set_type.h" + +namespace set { + + struct key_thread + { + uint32_t nKey; + uint16_t nThread; + uint16_t pad_; + + key_thread( size_t key, size_t threadNo ) + : nKey( static_cast(key)) + , nThread( static_cast(threadNo)) + , pad_(0) + {} + + key_thread() + {} + }; + + typedef set_type_base::key_val key_value_pair; + + template <> + struct cmp { + int operator ()(key_thread const& k1, key_thread const& k2) const + { + if ( k1.nKey < k2.nKey ) + return -1; + if ( k1.nKey > k2.nKey ) + return 1; + if ( k1.nThread < k2.nThread ) + return -1; + if ( k1.nThread > k2.nThread ) + return 1; + return 0; + } + int operator ()(key_thread const& k1, size_t k2) const + { + if ( k1.nKey < k2 ) + return -1; + if ( k1.nKey > k2 ) + return 1; + return 0; + } + int operator ()(size_t k1, key_thread const& k2) const + { + if ( k1 < k2.nKey ) + return -1; + if ( k1 > k2.nKey ) + return 1; + return 0; + } + }; + + template <> + struct less + { + bool operator()( set::key_thread const& k1, set::key_thread const& k2 ) const + { + if ( k1.nKey <= k2.nKey ) + return k1.nKey < k2.nKey || k1.nThread < k2.nThread; + return false; + } + }; + + template <> + struct hash + { + typedef size_t result_type; + typedef set::key_thread argument_type; + + size_t operator()( set::key_thread const& k ) const + { + return std::hash()(k.nKey); + } + size_t operator()( size_t k ) const + { + return std::hash()(k); + } + }; + + + class Set_DelOdd: public cds_test::stress_fixture + { + public: + static size_t s_nSetSize; // max set size + static size_t s_nInsThreadCount; // insert thread count + static size_t s_nDelThreadCount; // delete thread count + static size_t s_nExtractThreadCount; // extract thread count + static size_t s_nMaxLoadFactor; // maximum load factor + + static size_t s_nCuckooInitialSize; // initial size for CuckooSet + static size_t s_nCuckooProbesetSize; // CuckooSet probeset size (only for list-based probeset) + static size_t s_nCuckooProbesetThreshold; // CUckooSet probeset threshold (0 - use default) + + static size_t s_nFeldmanSet_HeadBits; + static size_t s_nFeldmanSet_ArrayBits; + + static size_t s_nLoadFactor; + + static std::vector m_arrData; + + static void SetUpTestCase(); + static void TearDownTestCase(); + + protected: + typedef key_thread key_type; + typedef size_t value_type; + + atomics::atomic m_nInsThreadCount; + + enum { + inserter_thread, + deleter_thread, + extractor_thread, + }; + + + // Inserts keys from [0..N) + template + class Inserter: public cds_test::thread + { + typedef cds_test::thread base_class; + Set& m_Set; + + struct update_functor + { + template + void operator()( bool /*bNew*/, key_value_pair const&, Q const& ) + {} + + void operator()(key_value_pair& /*cur*/, key_value_pair * /*prev*/) + {} + }; + public: + size_t m_nInsertSuccess = 0; + size_t m_nInsertFailed = 0; + + public: + Inserter( cds_test::thread_pool& pool, Set& set ) + : base_class( pool, inserter_thread ) + , m_Set( set ) + {} + + Inserter( Inserter& src ) + : base_class( src ) + , m_Set( src.m_Set ) + {} + + virtual thread * clone() + { + return new Inserter( *this ); + } + + virtual void test() + { + Set& rSet = m_Set; + Set_DelOdd& fixture = pool().template fixture(); + + std::vector& arrData = fixture.m_arrData; + for ( size_t i = 0; i < arrData.size(); ++i ) { + if ( rSet.insert( key_type( arrData[i], id() ))) + ++m_nInsertSuccess; + else + ++m_nInsertFailed; + } + + update_functor f; + for ( size_t i = arrData.size() - 1; i > 0; --i ) { + if ( arrData[i] & 1 ) + rSet.update( key_type( arrData[i], id() ), f, true ); + } + + fixture.m_nInsThreadCount.fetch_sub( 1, atomics::memory_order_release ); + } + }; + + struct key_equal { + bool operator()( key_type const& k1, key_type const& k2 ) const + { + return k1.nKey == k2.nKey; + } + bool operator()( size_t k1, key_type const& k2 ) const + { + return k1 == k2.nKey; + } + bool operator()( key_type const& k1, size_t k2 ) const + { + return k1.nKey == k2; + } + bool operator ()( key_value_pair const& k1, key_value_pair const& k2 ) const + { + return operator()( k1.key, k2.key ); + } + bool operator ()( key_value_pair const& k1, key_type const& k2 ) const + { + return operator()( k1.key, k2 ); + } + bool operator ()( key_type const& k1, key_value_pair const& k2 ) const + { + return operator()( k1, k2.key ); + } + bool operator ()( key_value_pair const& k1, size_t k2 ) const + { + return operator()( k1.key, k2 ); + } + bool operator ()( size_t k1, key_value_pair const& k2 ) const + { + return operator()( k1, k2.key ); + } + }; + + struct key_less { + bool operator()( key_type const& k1, key_type const& k2 ) const + { + return k1.nKey < k2.nKey; + } + bool operator()( size_t k1, key_type const& k2 ) const + { + return k1 < k2.nKey; + } + bool operator()( key_type const& k1, size_t k2 ) const + { + return k1.nKey < k2; + } + bool operator ()( key_value_pair const& k1, key_value_pair const& k2 ) const + { + return operator()( k1.key, k2.key ); + } + bool operator ()( key_value_pair const& k1, key_type const& k2 ) const + { + return operator()( k1.key, k2 ); + } + bool operator ()( key_type const& k1, key_value_pair const& k2 ) const + { + return operator()( k1, k2.key ); + } + bool operator ()( key_value_pair const& k1, size_t k2 ) const + { + return operator()( k1.key, k2 ); + } + bool operator ()( size_t k1, key_value_pair const& k2 ) const + { + return operator()( k1, k2.key ); + } + + typedef key_equal equal_to; + }; + + // Deletes odd keys from [0..N) + template + class Deleter: public cds_test::thread + { + typedef cds_test::thread base_class; + Set& m_Set; + + public: + size_t m_nDeleteSuccess = 0; + size_t m_nDeleteFailed = 0; + + public: + Deleter( cds_test::thread_pool& pool, Set& set ) + : base_class( pool, deleter_thread ) + , m_Set( set ) + {} + Deleter( Deleter& src ) + : base_class( src ) + , m_Set( src.m_Set ) + {} + + virtual thread * clone() + { + return new Deleter( *this ); + } + + template + struct eraser { + static bool erase( SetType& s, size_t key, size_t /*thread*/) + { + return s.erase_with( key, key_less() ); + } + }; + + template + struct eraser { + static bool erase(SetType& s, size_t key, size_t thread) + { + return s.erase( key_type(key, thread)); + } + }; + + virtual void test() + { + Set& rSet = m_Set; + + size_t const nInsThreadCount = s_nInsThreadCount; + Set_DelOdd& fixture = pool().template fixture(); + std::vector& arrData = fixture.m_arrData; + + if ( id() & 1 ) { + for (size_t i = 0; i < arrData.size(); ++i) { + if ( arrData[i] & 1 ) { + for ( size_t k = 0; k < nInsThreadCount; ++k ) { + if ( eraser::erase( rSet, arrData[i], k )) + ++m_nDeleteSuccess; + else + ++m_nDeleteFailed; + } + } + if ( fixture.m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 ) + break; + } + } + else { + for ( size_t i = arrData.size() - 1; i > 0; --i ) { + if ( arrData[i] & 1 ) { + for ( size_t k = 0; k < nInsThreadCount; ++k ) { + if (eraser::erase(rSet, arrData[i], k)) + ++m_nDeleteSuccess; + else + ++m_nDeleteFailed; + } + } + if ( fixture.m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 ) + break; + } + } + } + }; + + // Extracts odd keys from [0..N) + template + class Extractor: public cds_test::thread + { + typedef cds_test::thread base_class; + Set& m_Set; + + public: + size_t m_nExtractSuccess = 0; + size_t m_nExtractFailed = 0; + + public: + Extractor( cds_test::thread_pool& pool, Set& set ) + : base_class( pool, extractor_thread ) + , m_Set( set ) + {} + + Extractor( Extractor& src ) + : base_class( src ) + , m_Set( src.m_Set ) + {} + + virtual thread * clone() + { + return new Extractor( *this ); + } + + template + struct extractor { + static typename SetType::guarded_ptr extract(SetType& s, size_t key, size_t /*thread*/) + { + return s.extract_with( key, key_less()); + } + }; + + template + struct extractor { + static typename SetType::guarded_ptr extract(SetType& s, size_t key, size_t thread) + { + return s.extract( key_type(key, thread)); + } + }; + + virtual void test() + { + Set& rSet = m_Set; + + typename Set::guarded_ptr gp; + + Set_DelOdd& fixture = pool().template fixture(); + std::vector& arrData = fixture.m_arrData; + size_t const nInsThreadCount = s_nInsThreadCount; + + if ( id() & 1 ) { + for ( size_t i = 0; i < arrData.size(); ++i ) { + if ( arrData[i] & 1 ) { + for ( size_t k = 0; k < nInsThreadCount; ++k ) { + gp = extractor::extract( rSet, arrData[i], k ); + if ( gp ) + ++m_nExtractSuccess; + else + ++m_nExtractFailed; + gp.release(); + } + } + if ( fixture.m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 ) + break; + } + } + else { + for ( size_t i = arrData.size() - 1; i > 0; --i ) { + if ( arrData[i] & 1 ) { + for ( size_t k = 0; k < nInsThreadCount; ++k ) { + gp = extractor::extract( rSet, arrData[i], k); + if ( gp ) + ++m_nExtractSuccess; + else + ++m_nExtractFailed; + gp.release(); + } + } + if ( fixture.m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 ) + break; + } + } + } + }; + + template + class Extractor< cds::urcu::gc, Set >: public cds_test::thread + { + typedef cds_test::thread base_class; + Set& m_Set; + + public: + size_t m_nExtractSuccess = 0; + size_t m_nExtractFailed = 0; + + public: + Extractor( cds_test::thread_pool& pool, Set& set ) + : base_class( pool, extractor_thread ) + , m_Set( set ) + {} + + Extractor( Extractor& src ) + : base_class( src ) + , m_Set( src.m_Set ) + {} + + virtual thread * clone() + { + return new Extractor( *this ); + } + + template + struct extractor { + static typename SetType::exempt_ptr extract(SetType& s, size_t key, size_t /*thread*/) + { + return s.extract_with(key, key_less()); + } + }; + + template + struct extractor { + static typename SetType::exempt_ptr extract(SetType& s, size_t key, size_t thread) + { + return s.extract(key_type(key, thread)); + } + }; + + virtual void test() + { + Set& rSet = m_Set; + + typename Set::exempt_ptr xp; + + Set_DelOdd& fixture = pool().template fixture(); + std::vector& arrData = fixture.m_arrData; + size_t const nInsThreadCount = fixture.s_nInsThreadCount; + + if ( id() & 1 ) { + for ( size_t i = 0; i < arrData.size(); ++i ) { + if ( arrData[i] & 1 ) { + for ( size_t k = 0; k < nInsThreadCount; ++k ) { + if ( Set::c_bExtractLockExternal ) { + typename Set::rcu_lock l; + xp = extractor::extract( rSet, arrData[i], k); + if ( xp ) + ++m_nExtractSuccess; + else + ++m_nExtractFailed; + } + else { + xp = extractor::extract(rSet, arrData[i], k); + if ( xp ) + ++m_nExtractSuccess; + else + ++m_nExtractFailed; + } + xp.release(); + } + } + if ( fixture.m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 ) + break; + } + } + else { + for ( size_t i = arrData.size() - 1; i > 0; --i ) { + if ( arrData[i] & 1 ) { + for ( size_t k = 0; k < nInsThreadCount; ++k ) { + if ( Set::c_bExtractLockExternal ) { + typename Set::rcu_lock l; + xp = extractor::extract(rSet, arrData[i], k); + if ( xp ) + ++m_nExtractSuccess; + else + ++m_nExtractFailed; + } + else { + xp = extractor::extract(rSet, arrData[i], k); + if ( xp ) + ++m_nExtractSuccess; + else + ++m_nExtractFailed; + } + xp.release(); + } + } + if ( fixture.m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 ) + break; + } + } + } + }; + + protected: + template + void do_test_with( Set& testSet ) + { + typedef Inserter insert_thread; + typedef Deleter delete_thread; + + m_nInsThreadCount.store( s_nInsThreadCount, atomics::memory_order_release ); + + cds_test::thread_pool& pool = get_pool(); + pool.add( new insert_thread( pool, testSet ), s_nInsThreadCount ); + pool.add( new delete_thread( pool, testSet ), s_nDelThreadCount ? s_nDelThreadCount : cds::OS::topology::processor_count()); + + propout() << std::make_pair( "insert_thread_count", s_nInsThreadCount ) + << std::make_pair( "delete_thread_count", s_nDelThreadCount ) + << std::make_pair( "set_size", s_nSetSize ); + + 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 ); + if ( thr.type() == inserter_thread ) { + insert_thread& inserter = static_cast(thr); + nInsertSuccess += inserter.m_nInsertSuccess; + nInsertFailed += inserter.m_nInsertFailed; + } + else { + assert( thr.type() == deleter_thread ); + delete_thread& deleter = static_cast(thr); + nDeleteSuccess += deleter.m_nDeleteSuccess; + nDeleteFailed += deleter.m_nDeleteFailed; + } + } + + EXPECT_EQ( nInsertSuccess, s_nSetSize * s_nInsThreadCount ); + EXPECT_EQ( nInsertFailed, 0 ); + + 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 ); + } + + template + void do_test_extract_with( Set& testSet ) + { + typedef Inserter insert_thread; + typedef Deleter delete_thread; + typedef Extractor< typename Set::gc, Set > extract_thread; + + m_nInsThreadCount.store( s_nInsThreadCount, atomics::memory_order_release ); + + cds_test::thread_pool& pool = get_pool(); + pool.add( new insert_thread( pool, testSet ), s_nInsThreadCount ); + if ( s_nDelThreadCount ) + pool.add( new delete_thread( pool, testSet ), s_nDelThreadCount ); + if ( s_nExtractThreadCount ) + pool.add( new extract_thread( pool, testSet ), s_nExtractThreadCount ); + + propout() << std::make_pair( "insert_thread_count", s_nInsThreadCount ) + << std::make_pair( "delete_thread_count", s_nDelThreadCount ) + << std::make_pair( "extract_thread_count", s_nExtractThreadCount ) + << std::make_pair( "set_size", s_nSetSize ); + + 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; + size_t nExtractSuccess = 0; + size_t nExtractFailed = 0; + for ( size_t i = 0; i < pool.size(); ++i ) { + cds_test::thread& thr = pool.get( i ); + switch ( thr.type() ) { + case inserter_thread: + { + insert_thread& inserter = static_cast( thr ); + nInsertSuccess += inserter.m_nInsertSuccess; + nInsertFailed += inserter.m_nInsertFailed; + } + break; + case deleter_thread: + { + delete_thread& deleter = static_cast(thr); + nDeleteSuccess += deleter.m_nDeleteSuccess; + nDeleteFailed += deleter.m_nDeleteFailed; + } + break; + case extractor_thread: + { + extract_thread& extractor = static_cast(thr); + nExtractSuccess += extractor.m_nExtractSuccess; + nExtractFailed += extractor.m_nExtractFailed; + } + break; + default: + assert( false ); + } + } + + EXPECT_EQ( nInsertSuccess, s_nSetSize * s_nInsThreadCount ); + EXPECT_EQ( nInsertFailed, 0 ); + + 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( "extract_success", nExtractSuccess ) + << std::make_pair( "extract_failed", nExtractFailed ); + } + + template + void analyze( Set& testSet ) + { + // All even keys must be in the set + { + for ( size_t n = 0; n < s_nSetSize; n +=2 ) { + for ( size_t i = 0; i < s_nInsThreadCount; ++i ) { + EXPECT_TRUE( testSet.contains( key_type( n, i ))) << "key=" << n << "/" << i; + } + } + } + + check_before_clear( testSet ); + + testSet.clear(); + EXPECT_TRUE( testSet.empty() ) << "set.size=" << testSet.size(); + + additional_check( testSet ); + print_stat( propout(), testSet ); + additional_cleanup( testSet ); + } + + template + void run_test() + { + static_assert( !Set::c_bExtractSupported, "Set class must not support extract() method" ); + + Set testSet( *this ); + do_test_with( testSet ); + analyze( testSet ); + } + + template + void run_test_extract() + { + static_assert( Set::c_bExtractSupported, "Set class must support extract() method" ); + + Set testSet( *this ); + do_test_extract_with( testSet ); + analyze( testSet ); + } + }; + + class Set_DelOdd_LF: public Set_DelOdd + , public ::testing::WithParamInterface + { + public: + template + void run_test() + { + s_nLoadFactor = GetParam(); + propout() << std::make_pair( "load_factor", s_nLoadFactor ); + Set_DelOdd::run_test(); + } + + template + void run_test_extract() + { + s_nLoadFactor = GetParam(); + propout() << std::make_pair( "load_factor", s_nLoadFactor ); + Set_DelOdd::run_test_extract(); + } + + static std::vector get_load_factors(); + }; + +} // namespace set diff --git a/test/stress/set/delodd/set_delodd_cuckoo.cpp b/test/stress/set/delodd/set_delodd_cuckoo.cpp new file mode 100644 index 00000000..75a67c4c --- /dev/null +++ b/test/stress/set/delodd/set_delodd_cuckoo.cpp @@ -0,0 +1,67 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "set_delodd.h" +#include "set_type_cuckoo.h" + +#define CDSSTRESS_CuckooSet( cuckoo_set_type ) \ + TEST_F( Set_DelOdd, cuckoo_set_type ) \ + { \ + typedef set::set_type< tag_CuckooSet, key_thread, size_t >::cuckoo_set_type set_type; \ + run_test(); \ + } + +namespace set { + + CDSSTRESS_CuckooSet( CuckooStripedSet_list_unord ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_list_unord ) + CDSSTRESS_CuckooSet( CuckooStripedSet_list_unord_stat ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_list_unord_stat ) + CDSSTRESS_CuckooSet( CuckooStripedSet_list_unord_storehash ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_list_unord_storehash ) + CDSSTRESS_CuckooSet( CuckooStripedSet_list_ord ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_list_ord ) + CDSSTRESS_CuckooSet( CuckooStripedSet_list_ord_stat ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_list_ord_stat ) + CDSSTRESS_CuckooSet( CuckooStripedSet_list_ord_storehash ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_list_ord_storehash ) + CDSSTRESS_CuckooSet( CuckooStripedSet_vector_unord ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_vector_unord ) + CDSSTRESS_CuckooSet( CuckooStripedSet_vector_unord_stat ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_vector_unord_stat ) + CDSSTRESS_CuckooSet( CuckooStripedSet_vector_unord_storehash ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_vector_unord_storehash ) + CDSSTRESS_CuckooSet( CuckooStripedSet_vector_ord ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_vector_ord ) + CDSSTRESS_CuckooSet( CuckooStripedSet_vector_ord_stat ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_vector_ord_stat ) + CDSSTRESS_CuckooSet( CuckooStripedSet_vector_ord_storehash ) + CDSSTRESS_CuckooSet( CuckooRefinableSet_vector_ord_storehash ) +} // namespace set diff --git a/test/stress/set/delodd/set_delodd_ellentree.cpp b/test/stress/set/delodd/set_delodd_ellentree.cpp new file mode 100644 index 00000000..85ded33d --- /dev/null +++ b/test/stress/set/delodd/set_delodd_ellentree.cpp @@ -0,0 +1,66 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "set_delodd.h" +#include "set_type_ellen_bintree.h" + +#define CDSSTRESS_EllenBinTreeSet( ellen_set_type ) \ + TEST_F( Set_DelOdd, ellen_set_type ) \ + { \ + typedef set::set_type< tag_EllenBinTreeSet, key_thread, size_t >::ellen_set_type set_type; \ + run_test_extract(); \ + } + +namespace set { + + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_hp ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_dhp ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_rcu_gpi ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_rcu_gpb ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_rcu_gpt ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_rcu_shb ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_rcu_sht ) +#endif + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_yield_hp ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_yield_dhp ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_yield_rcu_gpb ) + + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_hp_stat ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_dhp_stat ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_rcu_gpi_stat ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_rcu_gpb_stat ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_rcu_gpt_stat ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_rcu_shb_stat ) + CDSSTRESS_EllenBinTreeSet( EllenBinTreeSet_rcu_sht_stat ) +#endif + +} // namespace set diff --git a/test/stress/set/delodd/set_delodd_feldman_hashset.cpp b/test/stress/set/delodd/set_delodd_feldman_hashset.cpp new file mode 100644 index 00000000..5c171086 --- /dev/null +++ b/test/stress/set/delodd/set_delodd_feldman_hashset.cpp @@ -0,0 +1,63 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "set_delodd.h" +#include "set_type_feldman_hashset.h" + +#define CDSSTRESS_FeldmanHashSet( feldman_set_type ) \ + TEST_F( Set_DelOdd, feldman_set_type ) \ + { \ + typedef set::set_type< tag_FeldmanHashSet, key_thread, size_t >::feldman_set_type set_type; \ + run_test_extract(); \ + } + +namespace set { + + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_hp_fixed ) + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_dhp_fixed ) + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_rcu_gpi_fixed ) + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_rcu_gpb_fixed ) + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_rcu_gpt_fixed ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_rcu_shb_fixed ) + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_rcu_sht_fixed ) +#endif + + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_hp_fixed_stat ) + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_dhp_fixed_stat ) + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_rcu_gpi_fixed_stat ) + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_rcu_gpb_fixed_stat ) + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_rcu_gpt_fixed_stat ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_rcu_shb_fixed_stat ) + CDSSTRESS_FeldmanHashSet( FeldmanHashSet_rcu_sht_fixed_stat ) +#endif + +} // namespace set diff --git a/test/stress/set/delodd/set_delodd_michael.cpp b/test/stress/set/delodd/set_delodd_michael.cpp new file mode 100644 index 00000000..5dd9a851 --- /dev/null +++ b/test/stress/set/delodd/set_delodd_michael.cpp @@ -0,0 +1,124 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "set_delodd.h" +#include "set_type_michael.h" + +#define CDSSTRESS_MichaelSet( michael_set_type ) \ + TEST_P( Set_DelOdd_LF, michael_set_type ) \ + { \ + typedef set::set_type< tag_MichaelHashSet, key_thread, size_t >::michael_set_type set_type; \ + run_test_extract(); \ + } + +namespace set { + + CDSSTRESS_MichaelSet( MichaelSet_HP_cmp_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_DHP_cmp_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPI_cmp_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPB_cmp_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPT_cmp_stdAlloc ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_MichaelSet( MichaelSet_RCU_SHB_cmp_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_SHT_cmp_stdAlloc ) +#endif + + CDSSTRESS_MichaelSet( MichaelSet_HP_less_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_DHP_less_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPI_less_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPB_less_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPT_less_stdAlloc ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_MichaelSet( MichaelSet_RCU_SHB_less_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_SHT_less_stdAlloc ) +#endif + + + CDSSTRESS_MichaelSet( MichaelSet_HP_cmp_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_DHP_cmp_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPI_cmp_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPB_cmp_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPT_cmp_michaelAlloc ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_MichaelSet( MichaelSet_RCU_SHB_cmp_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_SHT_cmp_michaelAlloc ) +#endif + + CDSSTRESS_MichaelSet( MichaelSet_HP_less_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_DHP_less_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPI_less_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPB_less_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_GPT_less_michaelAlloc ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_MichaelSet( MichaelSet_RCU_SHB_less_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_RCU_SHT_less_michaelAlloc ) +#endif + + + CDSSTRESS_MichaelSet( MichaelSet_Lazy_HP_cmp_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_DHP_cmp_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPI_cmp_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPB_cmp_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPT_cmp_stdAlloc ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_SHB_cmp_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_SHT_cmp_stdAlloc ) +#endif + + CDSSTRESS_MichaelSet( MichaelSet_Lazy_HP_less_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_DHP_less_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPI_less_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPB_less_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPT_less_stdAlloc ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_SHB_less_stdAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_SHT_less_stdAlloc ) +#endif + + CDSSTRESS_MichaelSet( MichaelSet_Lazy_HP_cmp_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_DHP_cmp_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPI_cmp_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPB_cmp_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPT_cmp_michaelAlloc ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_SHB_cmp_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_SHT_cmp_michaelAlloc ) +#endif + + CDSSTRESS_MichaelSet( MichaelSet_Lazy_HP_less_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_DHP_less_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPI_less_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPB_less_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_GPT_less_michaelAlloc ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_SHB_less_michaelAlloc ) + CDSSTRESS_MichaelSet( MichaelSet_Lazy_RCU_SHT_less_michaelAlloc ) +#endif +} // namespace set diff --git a/test/stress/set/delodd/set_delodd_skip.cpp b/test/stress/set/delodd/set_delodd_skip.cpp new file mode 100644 index 00000000..8d4ed31e --- /dev/null +++ b/test/stress/set/delodd/set_delodd_skip.cpp @@ -0,0 +1,135 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "set_delodd.h" +#include "set_type_skip_list.h" + +#define CDSSTRESS_SkipListSet( skiplist_set_type ) \ + TEST_F( Set_DelOdd, skiplist_set_type ) \ + { \ + typedef set::set_type< tag_SkipListSet, key_thread, size_t >::skiplist_set_type set_type; \ + run_test_extract(); \ + } + +namespace set { + + CDSSTRESS_SkipListSet( SkipListSet_hp_less_pascal ) + CDSSTRESS_SkipListSet( SkipListSet_dhp_less_pascal ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpi_less_pascal ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpb_less_pascal ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpt_less_pascal ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SkipListSet( SkipListSet_rcu_shb_less_pascal ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_sht_less_pascal ) +#endif + + CDSSTRESS_SkipListSet( SkipListSet_hp_less_pascal_seqcst ) + CDSSTRESS_SkipListSet( SkipListSet_dhp_less_pascal_seqcst ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpi_less_pascal_seqcst ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpb_less_pascal_seqcst ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpt_less_pascal_seqcst ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SkipListSet( SkipListSet_rcu_shb_less_pascal_seqcst ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_sht_less_pascal_seqcst ) +#endif + + CDSSTRESS_SkipListSet( SkipListSet_hp_less_pascal_stat ) + CDSSTRESS_SkipListSet( SkipListSet_dhp_less_pascal_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpi_less_pascal_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpb_less_pascal_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpt_less_pascal_stat ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SkipListSet( SkipListSet_rcu_shb_less_pascal_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_sht_less_pascal_stat ) +#endif + + CDSSTRESS_SkipListSet( SkipListSet_hp_cmp_pascal ) + CDSSTRESS_SkipListSet( SkipListSet_dhp_cmp_pascal ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpi_cmp_pascal ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpb_cmp_pascal ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpt_cmp_pascal ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SkipListSet( SkipListSet_rcu_shb_cmp_pascal ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_sht_cmp_pascal ) +#endif + + CDSSTRESS_SkipListSet( SkipListSet_hp_cmp_pascal_stat ) + CDSSTRESS_SkipListSet( SkipListSet_dhp_cmp_pascal_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpi_cmp_pascal_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpb_cmp_pascal_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpt_cmp_pascal_stat ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SkipListSet( SkipListSet_rcu_shb_cmp_pascal_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_sht_cmp_pascal_stat ) +#endif + + CDSSTRESS_SkipListSet( SkipListSet_hp_less_xorshift ) + CDSSTRESS_SkipListSet( SkipListSet_dhp_less_xorshift ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpi_less_xorshift ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpb_less_xorshift ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpt_less_xorshift ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SkipListSet( SkipListSet_rcu_shb_less_xorshift ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_sht_less_xorshift ) +#endif + + CDSSTRESS_SkipListSet( SkipListSet_hp_less_xorshift_stat ) + CDSSTRESS_SkipListSet( SkipListSet_dhp_less_xorshift_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpi_less_xorshift_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpb_less_xorshift_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpt_less_xorshift_stat ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SkipListSet( SkipListSet_rcu_shb_less_xorshift_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_sht_less_xorshift_stat ) +#endif + + CDSSTRESS_SkipListSet( SkipListSet_hp_cmp_xorshift ) + CDSSTRESS_SkipListSet( SkipListSet_dhp_cmp_xorshift ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpi_cmp_xorshift ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpb_cmp_xorshift ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpt_cmp_xorshift ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SkipListSet( SkipListSet_rcu_shb_cmp_xorshift ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_sht_cmp_xorshift ) +#endif + + CDSSTRESS_SkipListSet( SkipListSet_hp_cmp_xorshift_stat ) + CDSSTRESS_SkipListSet( SkipListSet_dhp_cmp_xorshift_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpi_cmp_xorshift_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpb_cmp_xorshift_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_gpt_cmp_xorshift_stat ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SkipListSet( SkipListSet_rcu_shb_cmp_xorshift_stat ) + CDSSTRESS_SkipListSet( SkipListSet_rcu_sht_cmp_xorshift_stat ) +#endif + + + +} // namespace set diff --git a/test/stress/set/delodd/set_delodd_split.cpp b/test/stress/set/delodd/set_delodd_split.cpp new file mode 100644 index 00000000..ac211452 --- /dev/null +++ b/test/stress/set/delodd/set_delodd_split.cpp @@ -0,0 +1,172 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "set_delodd.h" +#include "set_type_split_list.h" + +#define CDSSTRESS_SplitListSet( splitlist_set_type ) \ + TEST_P( Set_DelOdd_LF, splitlist_set_type ) \ + { \ + typedef set::set_type< tag_SplitListSet, key_thread, size_t >::splitlist_set_type set_type; \ + run_test_extract(); \ + } + +namespace set { + + CDSSTRESS_SplitListSet( SplitList_Michael_HP_dyn_cmp ) + CDSSTRESS_SplitListSet( SplitList_Michael_DHP_dyn_cmp ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPI_dyn_cmp ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPB_dyn_cmp ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPT_dyn_cmp ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHB_dyn_cmp ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHT_dyn_cmp ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Michael_HP_dyn_cmp_stat ) + CDSSTRESS_SplitListSet( SplitList_Michael_DHP_dyn_cmp_stat ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPI_dyn_cmp_stat ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPB_dyn_cmp_stat ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPT_dyn_cmp_stat ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHB_dyn_cmp_stat ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHT_dyn_cmp_stat ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Michael_HP_dyn_cmp_seqcst ) + CDSSTRESS_SplitListSet( SplitList_Michael_DHP_dyn_cmp_seqcst ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPI_dyn_cmp_seqcst ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPB_dyn_cmp_seqcst ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPT_dyn_cmp_seqcst ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHB_dyn_cmp_seqcst ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHT_dyn_cmp_seqcst ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Michael_HP_st_cmp ) + CDSSTRESS_SplitListSet( SplitList_Michael_DHP_st_cmp ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPI_st_cmp ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPB_st_cmp ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPT_st_cmp ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHB_st_cmp ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHT_st_cmp ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Michael_HP_dyn_less ) + CDSSTRESS_SplitListSet( SplitList_Michael_DHP_dyn_less ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPI_dyn_less ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPB_dyn_less ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPT_dyn_less ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHB_dyn_less ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHT_dyn_less ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Michael_HP_st_less ) + CDSSTRESS_SplitListSet( SplitList_Michael_DHP_st_less ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPI_st_less ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPB_st_less ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPT_st_less ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHB_st_less ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHT_st_less ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Michael_HP_st_less_stat ) + CDSSTRESS_SplitListSet( SplitList_Michael_DHP_st_less_stat ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPI_st_less_stat ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPB_st_less_stat ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_GPT_st_less_stat ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHB_st_less_stat ) + CDSSTRESS_SplitListSet( SplitList_Michael_RCU_SHT_st_less_stat ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Lazy_HP_dyn_cmp ) + CDSSTRESS_SplitListSet( SplitList_Lazy_DHP_dyn_cmp ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPI_dyn_cmp ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPB_dyn_cmp ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPT_dyn_cmp ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHB_dyn_cmp ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHT_dyn_cmp ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Lazy_HP_dyn_cmp_stat ) + CDSSTRESS_SplitListSet( SplitList_Lazy_DHP_dyn_cmp_stat ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPI_dyn_cmp_stat ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPB_dyn_cmp_stat ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPT_dyn_cmp_stat ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHB_dyn_cmp_stat ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHT_dyn_cmp_stat ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Lazy_HP_st_cmp ) + CDSSTRESS_SplitListSet( SplitList_Lazy_DHP_st_cmp ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPI_st_cmp ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPB_st_cmp ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPT_st_cmp ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHB_st_cmp ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHT_st_cmp ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Lazy_HP_dyn_less ) + CDSSTRESS_SplitListSet( SplitList_Lazy_DHP_dyn_less ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPI_dyn_less ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPB_dyn_less ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPT_dyn_less ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHB_dyn_less ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHT_dyn_less ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Lazy_HP_st_less ) + CDSSTRESS_SplitListSet( SplitList_Lazy_DHP_st_less ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPI_st_less ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPB_st_less ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPT_st_less ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHB_st_less ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHT_st_less ) +#endif + + CDSSTRESS_SplitListSet( SplitList_Lazy_HP_st_less_stat ) + CDSSTRESS_SplitListSet( SplitList_Lazy_DHP_st_less_stat ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPI_st_less_stat ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPB_st_less_stat ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_GPT_st_less_stat ) +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHB_st_less_stat ) + CDSSTRESS_SplitListSet( SplitList_Lazy_RCU_SHT_st_less_stat ) +#endif +} // namespace set diff --git a/test/stress/set/set_type.h b/test/stress/set/set_type.h new file mode 100644 index 00000000..3d84ff2f --- /dev/null +++ b/test/stress/set/set_type.h @@ -0,0 +1,251 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_H +#define CDSUNIT_SET_TYPE_H + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include "framework/michael_alloc.h" + +namespace set { + namespace cc = cds::container; + namespace co = cds::opt; + + typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_gpi; + typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_gpb; + typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_gpt; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cds::urcu::gc< cds::urcu::signal_buffered<> > rcu_shb; + typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_sht; +#endif + + template + struct less; + + template + struct cmp + { + int operator ()(Key const& k1, Key const& k2) const + { + if ( less( k1, k2 ) ) + return -1; + return less( k2, k1 ) ? 1 : 0; + } + }; + + template + struct hash; + +#define CDSUNIT_INT_COMPARE(t) template <> struct cmp { int operator()( t k1, t k2 ){ return (int)(k1 - k2); } } + CDSUNIT_INT_COMPARE(char); + CDSUNIT_INT_COMPARE(unsigned char); + CDSUNIT_INT_COMPARE(int); + CDSUNIT_INT_COMPARE(unsigned int); + CDSUNIT_INT_COMPARE(long); + CDSUNIT_INT_COMPARE(unsigned long); + CDSUNIT_INT_COMPARE(long long); + CDSUNIT_INT_COMPARE(unsigned long long); +#undef CDSUNIT_INT_COMPARE + + template <> + struct cmp + { + int operator()(std::string const& s1, std::string const& s2) + { + return s1.compare( s2 ); + } + int operator()(std::string const& s1, char const * s2) + { + return s1.compare( s2 ); + } + int operator()(char const * s1, std::string const& s2) + { + return -s2.compare( s1 ); + } + }; + + // forward + template + struct set_type; + + template + struct set_type_base + { + typedef Key key_type; + typedef Value value_type; + + struct key_val { + key_type key; + value_type val; + + /*explicit*/ key_val( key_type const& k ): key(k), val() {} + key_val( key_type const& k, value_type const& v ): key(k), val(v) {} + + template + explicit key_val( K const& k ): key(k) {} + + template + key_val( K const& k, T const& v ): key(k), val(v) {} + }; + + typedef set::hash key_hash; + typedef set::less key_less; + typedef set::cmp key_compare; + + struct less { + bool operator()( key_val const& k1, key_val const& k2 ) const + { + return key_less()( k1.key, k2.key ); + } + bool operator()( key_type const& k1, key_val const& k2 ) const + { + return key_less()( k1, k2.key ); + } + bool operator()( key_val const& k1, key_type const& k2 ) const + { + return key_less()( k1.key, k2 ); + } + }; + + struct compare { + int operator()( key_val const& k1, key_val const& k2 ) const + { + return key_compare()( k1.key, k2.key ); + } + int operator()( key_type const& k1, key_val const& k2 ) const + { + return key_compare()( k1, k2.key ); + } + int operator()( key_val const& k1, key_type const& k2 ) const + { + return key_compare()( k1.key, k2 ); + } + }; + + struct equal_to { + bool operator()( key_val const& k1, key_val const& k2 ) const + { + return key_compare()( k1.key, k2.key ) == 0; + } + bool operator()( key_type const& k1, key_val const& k2 ) const + { + return key_compare()( k1, k2.key ) == 0; + } + bool operator()( key_val const& k1, key_type const& k2 ) const + { + return key_compare()( k1.key, k2 ) == 0; + } + }; + + + struct hash: public key_hash + { + size_t operator()( key_val const& v ) const + { + return key_hash::operator()( v.key ); + } + size_t operator()( key_type const& key ) const + { + return key_hash::operator()( key ); + } + template + size_t operator()( Q const& k ) const + { + return key_hash::operator()( k ); + } + }; + + struct hash2: public hash + { + size_t operator()( key_val const& k ) const + { + size_t h = hash::operator ()( k.key ); + size_t seed = ~h; + seed ^= h + 0x9e3779b9 + (seed << 6) + (seed >> 2); + return seed; + } + size_t operator()( key_type const& k ) const + { + size_t h = hash::operator ()( k ); + size_t seed = ~h; + seed ^= h + 0x9e3779b9 + (seed << 6) + (seed >> 2); + return seed; + } + template + size_t operator()( Q const& k ) const + { + return key_hash::operator()( k ); + } + }; + }; + + + // ************************************************* + // print_stat + // ************************************************* + + template + static inline void print_stat( cds_test::property_stream&, Set const& /*s*/ ) + {} + + + //******************************************************* + // additional_check + //******************************************************* + + template + static inline void additional_check( Set& /*set*/ ) + {} + + template + static inline void additional_cleanup( Set& /*set*/ ) + {} + + //******************************************************* + // check_before_clear + //******************************************************* + + template + static inline void check_before_clear( Set& /*s*/ ) + {} + +} // namespace set + + +#endif // ifndef CDSUNIT_SET_TYPE_H diff --git a/test/stress/set/set_type_cuckoo.h b/test/stress/set/set_type_cuckoo.h new file mode 100644 index 00000000..ae939f57 --- /dev/null +++ b/test/stress/set/set_type_cuckoo.h @@ -0,0 +1,210 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_CUCKOO_H +#define CDSUNIT_SET_TYPE_CUCKOO_H + +#include "set/set_type.h" + +#include +#include + +namespace set { + + template + class CuckooSet : public cc::CuckooSet< V, Traits > + { + public: + typedef cc::CuckooSet< V, Traits > cuckoo_base_class; + + public: + template + CuckooSet( Config const& cfg ) + : cuckoo_base_class( + cfg.s_nCuckooInitialSize, + static_cast( cfg.s_nCuckooProbesetSize ), + static_cast( cfg.s_nCuckooProbesetThreshold ) + ) + {} + + template + bool erase_with( Q const& key, Pred /*pred*/ ) + { + return cuckoo_base_class::erase_with( key, typename std::conditional< cuckoo_base_class::c_isSorted, Pred, typename Pred::equal_to>::type() ); + } + + // 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_CuckooSet; + + template + struct set_type< tag_CuckooSet, Key, Val >: public set_type_base< Key, Val > + { + typedef set_type_base< Key, Val > base_class; + typedef typename base_class::key_val key_val; + typedef typename base_class::compare compare; + typedef typename base_class::equal_to equal_to; + typedef typename base_class::less less; + typedef typename base_class::hash hash; + typedef typename base_class::hash2 hash2; + + // *************************************************************************** + // CuckooSet + + template + struct traits_CuckooStripedSet : public Traits + { + typedef cc::cuckoo::striping<> mutex_policy; + }; + template + struct traits_CuckooRefinableSet : public Traits + { + typedef cc::cuckoo::refinable<> mutex_policy; + }; + + struct traits_CuckooSet_list_unord : + public cc::cuckoo::make_traits < + cc::cuckoo::probeset_type< cc::cuckoo::list > + , co::equal_to< equal_to > + , co::hash< std::tuple< hash, hash2 > > + > ::type + {}; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_list_unord; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_list_unord; + + struct traits_CuckooSet_list_unord_stat : public traits_CuckooSet_list_unord + { + typedef cc::cuckoo::stat stat; + }; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_list_unord_stat; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_list_unord_stat; + + struct traits_CuckooSet_list_unord_storehash : public traits_CuckooSet_list_unord + { + static CDS_CONSTEXPR const bool store_hash = true; + }; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_list_unord_storehash; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_list_unord_storehash; + + struct traits_CuckooSet_list_ord : + public cc::cuckoo::make_traits < + cc::cuckoo::probeset_type< cc::cuckoo::list > + , co::compare< compare > + , co::hash< std::tuple< hash, hash2 > > + > ::type + {}; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_list_ord; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_list_ord; + + struct traits_CuckooSet_list_ord_stat : public traits_CuckooSet_list_ord + { + typedef cc::cuckoo::stat stat; + }; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_list_ord_stat; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_list_ord_stat; + + struct traits_CuckooSet_list_ord_storehash : public traits_CuckooSet_list_ord + { + static CDS_CONSTEXPR const bool store_hash = true; + }; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_list_ord_storehash; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_list_ord_storehash; + + + struct traits_CuckooSet_vector_unord : + public cc::cuckoo::make_traits < + cc::cuckoo::probeset_type< cc::cuckoo::vector<4> > + , co::equal_to< equal_to > + , co::hash< std::tuple< hash, hash2 > > + > ::type + {}; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_vector_unord; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_vector_unord; + + struct traits_CuckooSet_vector_unord_stat : public traits_CuckooSet_vector_unord + { + typedef cc::cuckoo::stat stat; + }; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_vector_unord_stat; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_vector_unord_stat; + + struct traits_CuckooSet_vector_unord_storehash : public traits_CuckooSet_vector_unord + { + static CDS_CONSTEXPR const bool store_hash = true; + }; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_vector_unord_storehash; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_vector_unord_storehash; + + struct traits_CuckooSet_vector_ord : + public cc::cuckoo::make_traits < + cc::cuckoo::probeset_type< cc::cuckoo::vector<4> > + , co::compare< compare > + , co::hash< std::tuple< hash, hash2 > > + > ::type + {}; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_vector_ord; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_vector_ord; + + struct traits_CuckooSet_vector_ord_stat : public traits_CuckooSet_vector_ord + { + typedef cc::cuckoo::stat stat; + }; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_vector_ord_stat; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_vector_ord_stat; + + struct traits_CuckooSet_vector_ord_storehash : public traits_CuckooSet_vector_ord + { + static CDS_CONSTEXPR const bool store_hash = true; + }; + typedef CuckooSet< key_val, traits_CuckooStripedSet> CuckooStripedSet_vector_ord_storehash; + typedef CuckooSet< key_val, traits_CuckooRefinableSet> CuckooRefinableSet_vector_ord_storehash; + + }; + + template + static inline void print_stat( cds_test::property_stream& o, cc::CuckooSet< T, Traits > const& s ) + { + o << s.statistics() << s.mutex_policy_statistics(); + } + + template + static inline void print_stat( cds_test::property_stream& o, CuckooSet< V, Traits > const& s ) + { + typedef CuckooSet< V, Traits > set_type; + print_stat( o, static_cast(s) ); + } + +} // namespace set + +#endif // #ifndef CDSUNIT_SET_TYPE_CUCKOO_H diff --git a/test/stress/set/set_type_ellen_bintree.h b/test/stress/set/set_type_ellen_bintree.h new file mode 100644 index 00000000..ebb39a4b --- /dev/null +++ b/test/stress/set/set_type_ellen_bintree.h @@ -0,0 +1,329 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_ELLEN_BINTREE_H +#define CDSUNIT_SET_TYPE_ELLEN_BINTREE_H + +#include "set_type.h" + +#include +#include +#include + +#include +#include "framework/ellen_bintree_update_desc_pool.h" + +namespace set { + + template + class EllenBinTreeSet : public cc::EllenBinTreeSet< GC, Key, T, Traits > + { + typedef cc::EllenBinTreeSet< GC, Key, T, Traits > base_class; + public: + template + EllenBinTreeSet( Config const& /*cfg*/ ) + {} + + // 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_EllenBinTreeSet; + + template + struct set_type< tag_EllenBinTreeSet, Key, Val >: public set_type_base< Key, Val > + { + typedef set_type_base< Key, Val > base_class; + typedef typename base_class::key_type key_type; + typedef typename base_class::key_val key_val; + typedef typename base_class::compare compare; + typedef typename base_class::less less; + typedef typename base_class::key_less key_less; + + struct ellen_bintree_props { + struct key_extractor { + void operator()( key_type& dest, key_val const& src ) const + { + dest = src.key; + } + }; + + struct less { + bool operator()( key_val const& v1, key_val const& v2 ) const + { + return key_less()( v1.key, v2.key ); + } + bool operator()( key_type const& k, key_val const& v ) const + { + return key_less()( k, v.key ); + } + bool operator()( key_val const& v, key_type const& k ) const + { + return key_less()( v.key, k ); + } + bool operator()( key_type const& k1, key_type const& k2 ) const + { + return key_less()( k1, k2 ); + } + }; + + struct hp_gc { + typedef cc::ellen_bintree::node leaf_node; + typedef cc::ellen_bintree::internal_node< key_type, leaf_node > internal_node; + typedef cc::ellen_bintree::update_desc< leaf_node, internal_node > update_desc; + }; + + struct dhp_gc { + typedef cc::ellen_bintree::node leaf_node; + typedef cc::ellen_bintree::internal_node< key_type, leaf_node > internal_node; + typedef cc::ellen_bintree::update_desc< leaf_node, internal_node > update_desc; + }; + + struct gpi { + typedef cc::ellen_bintree::node leaf_node; + typedef cc::ellen_bintree::internal_node< key_type, leaf_node > internal_node; + typedef cc::ellen_bintree::update_desc< leaf_node, internal_node > update_desc; + }; + struct gpb { + typedef cc::ellen_bintree::node leaf_node; + typedef cc::ellen_bintree::internal_node< key_type, leaf_node > internal_node; + typedef cc::ellen_bintree::update_desc< leaf_node, internal_node > update_desc; + }; + struct gpt { + typedef cc::ellen_bintree::node leaf_node; + typedef cc::ellen_bintree::internal_node< key_type, leaf_node > internal_node; + typedef cc::ellen_bintree::update_desc< leaf_node, internal_node > update_desc; + }; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + struct shb { + typedef cc::ellen_bintree::node leaf_node; + typedef cc::ellen_bintree::internal_node< key_type, leaf_node > internal_node; + typedef cc::ellen_bintree::update_desc< leaf_node, internal_node > update_desc; + }; + struct sht { + typedef cc::ellen_bintree::node leaf_node; + typedef cc::ellen_bintree::internal_node< key_type, leaf_node > internal_node; + typedef cc::ellen_bintree::update_desc< leaf_node, internal_node > update_desc; + }; +#endif + }; + + struct traits_EllenBinTreeSet: public cc::ellen_bintree::make_set_traits< + cc::ellen_bintree::key_extractor< typename ellen_bintree_props::key_extractor > + ,co::less< typename ellen_bintree_props::less > + ,co::node_allocator< ellen_bintree_pool::internal_node_allocator< int > > + >::type + {}; + + struct traits_EllenBinTreeSet_hp : public traits_EllenBinTreeSet + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::hp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< cds::gc::HP, key_type, key_val, traits_EllenBinTreeSet_hp > EllenBinTreeSet_hp; + + struct traits_EllenBinTreeSet_dhp : public traits_EllenBinTreeSet + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::dhp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< cds::gc::DHP, key_type, key_val, traits_EllenBinTreeSet_dhp > EllenBinTreeSet_dhp; + + struct traits_EllenBinTreeSet_gpi : public traits_EllenBinTreeSet + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpi::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_gpi, key_type, key_val, traits_EllenBinTreeSet_gpi > EllenBinTreeSet_rcu_gpi; + + struct traits_EllenBinTreeSet_gpb : public traits_EllenBinTreeSet + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_gpb, key_type, key_val, traits_EllenBinTreeSet_gpb > EllenBinTreeSet_rcu_gpb; + + struct traits_EllenBinTreeSet_gpt : public traits_EllenBinTreeSet + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpt::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_gpt, key_type, key_val, traits_EllenBinTreeSet_gpt > EllenBinTreeSet_rcu_gpt; + +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + struct traits_EllenBinTreeSet_shb : public traits_EllenBinTreeSet + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::shb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_shb, key_type, key_val, traits_EllenBinTreeSet_shb > EllenBinTreeSet_rcu_shb; + + struct traits_EllenBinTreeSet_sht : public traits_EllenBinTreeSet + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::sht::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_sht, key_type, key_val, traits_EllenBinTreeSet_sht > EllenBinTreeSet_rcu_sht; +#endif + + // + struct traits_EllenBinTreeSet_yield : public traits_EllenBinTreeSet + { + typedef cds::backoff::yield back_off; + }; + + struct traits_EllenBinTreeSet_yield_hp : public traits_EllenBinTreeSet_yield + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::hp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< cds::gc::HP, key_type, key_val, traits_EllenBinTreeSet_yield_hp > EllenBinTreeSet_yield_hp; + + struct traits_EllenBinTreeSet_yield_dhp : public traits_EllenBinTreeSet_yield + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::dhp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< cds::gc::DHP, key_type, key_val, traits_EllenBinTreeSet_yield_dhp > EllenBinTreeSet_yield_dhp; + + + struct traits_EllenBinTreeSet_yield_gpb : public traits_EllenBinTreeSet_yield + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_gpb, key_type, key_val, traits_EllenBinTreeSet_yield_gpb > EllenBinTreeSet_yield_rcu_gpb; + + + struct traits_EllenBinTreeSet_stat: public cc::ellen_bintree::make_set_traits< + cc::ellen_bintree::key_extractor< typename ellen_bintree_props::key_extractor > + ,co::less< typename ellen_bintree_props::less > + ,co::node_allocator< ellen_bintree_pool::internal_node_allocator< int > > + ,co::stat< cc::ellen_bintree::stat<> > + >::type + {}; + + struct traits_EllenBinTreeSet_stat_hp : public traits_EllenBinTreeSet_stat + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::hp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< cds::gc::HP, key_type, key_val, traits_EllenBinTreeSet_stat_hp > EllenBinTreeSet_hp_stat; + + struct traits_EllenBinTreeSet_stat_dhp : public traits_EllenBinTreeSet_stat + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::dhp_gc::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< cds::gc::DHP, key_type, key_val, traits_EllenBinTreeSet_stat_dhp > EllenBinTreeSet_dhp_stat; + + struct traits_EllenBinTreeSet_stat_gpi : public traits_EllenBinTreeSet_stat + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpi::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_gpi, key_type, key_val, traits_EllenBinTreeSet_stat_gpi > EllenBinTreeSet_rcu_gpi_stat; + + struct traits_EllenBinTreeSet_stat_gpb : public traits_EllenBinTreeSet_stat + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_gpb, key_type, key_val, traits_EllenBinTreeSet_stat_gpb > EllenBinTreeSet_rcu_gpb_stat; + + struct traits_EllenBinTreeSet_stat_gpt : public traits_EllenBinTreeSet_stat + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::gpt::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_gpt, key_type, key_val, traits_EllenBinTreeSet_stat_gpt > EllenBinTreeSet_rcu_gpt_stat; + +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + struct traits_EllenBinTreeSet_stat_shb : public traits_EllenBinTreeSet_stat + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::shb::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_shb, key_type, key_val, traits_EllenBinTreeSet_stat_shb > EllenBinTreeSet_rcu_shb_stat; + + struct traits_EllenBinTreeSet_stat_sht : public traits_EllenBinTreeSet_stat + { + typedef cds::memory::pool_allocator< typename ellen_bintree_props::sht::update_desc, ellen_bintree_pool::update_desc_pool_accessor > update_desc_allocator; + }; + typedef EllenBinTreeSet< rcu_sht, key_type, key_val, traits_EllenBinTreeSet_stat_sht > EllenBinTreeSet_rcu_sht_stat; +#endif + + }; + + template + static inline void print_stat( cds_test::property_stream& o, EllenBinTreeSet const& s ) + { + o << s.statistics(); + } + + namespace ellen_bintree_check { + static inline void check_stat( cds::intrusive::ellen_bintree::empty_stat const& /*s*/ ) + { + // Not true for threaded RCU + /* + EXPECT_EQ( ellen_bintree_pool::internal_node_counter::m_nAlloc.get(), ellen_bintree_pool::internal_node_counter::m_nFree.get()); + */ + } + static inline void check_stat( cds::intrusive::ellen_bintree::stat<> const& stat ) + { + EXPECT_EQ( stat.m_nInternalNodeCreated, stat.m_nInternalNodeDeleted ); + EXPECT_EQ( stat.m_nUpdateDescCreated, stat.m_nUpdateDescDeleted ); + //EXPECT_EQ( ellen_bintree_pool::internal_node_counter::m_nAlloc.get(), ellen_bintree_pool::internal_node_counter::m_nFree.get() ); + EXPECT_EQ( ellen_bintree_pool::internal_node_counter::m_nAlloc.get(), stat.m_nInternalNodeCreated ); + // true if RCU is not threaded + //EXPECT_EQ( stat.m_nInternalNodeDeleted, ellen_bintree_pool::internal_node_counter::m_nFree.get() ); + } + } // namespace ellen_bintree_check + + template + static inline void additional_check( EllenBinTreeSet& s ) + { + typedef EllenBinTreeSet set_type; + GC::force_dispose(); + ellen_bintree_check::check_stat( s.statistics()); +/* + bool const threaded_rcu = std::is_same::value +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + || std::is_same::value +#endif + ; + if ( !threaded_rcu ) { + EXPECT_EQ( ellen_bintree_pool::internal_node_counter::m_nAlloc.get(), ellen_bintree_pool::internal_node_counter::m_nFree.get()); + } +*/ + } + + template + static inline void additional_cleanup( EllenBinTreeSet& /*s*/ ) + { + ellen_bintree_pool::internal_node_counter::reset(); + } + + template + static inline void check_before_clear( cds::container::EllenBinTreeSet& s ) + { + EXPECT_TRUE( s.check_consistency() ); + } + + +} // namespace set + +#endif // #ifndef CDSUNIT_SET_TYPE_ELLEN_BINTREE_H diff --git a/test/stress/set/set_type_feldman_hashset.h b/test/stress/set/set_type_feldman_hashset.h new file mode 100644 index 00000000..12513341 --- /dev/null +++ b/test/stress/set/set_type_feldman_hashset.h @@ -0,0 +1,322 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_FELDMAN_HASHSET_H +#define CDSUNIT_SET_TYPE_FELDMAN_HASHSET_H + +#include "set/set_type.h" + +#include +#include +#include + +#include +#include + +namespace set { + + template + class FeldmanHashSet : public cc::FeldmanHashSet< GC, T, Traits > + { + typedef cc::FeldmanHashSet< GC, T, Traits > base_class; + + template + struct get_extracted_ptr + { + typedef typename base_class::guarded_ptr extracted_ptr; + }; + + template + struct get_extracted_ptr> + { + typedef typename base_class::exempt_ptr extracted_ptr; + }; + + public: + typedef typename T::hasher hasher; + typedef typename get_extracted_ptr::extracted_ptr extracted_ptr; + + template + FeldmanHashSet( Config const& cfg ) + : base_class( cfg.s_nFeldmanSet_HeadBits, cfg.s_nFeldmanSet_ArrayBits ) + {} + + template + bool erase( Q const& key ) + { + return base_class::erase( hasher()( key )); + } + + template + bool erase( Q const& key, Func f ) + { + return base_class::erase( hasher()( key ), f ); + } + + template + extracted_ptr extract(Q const& key) + { + return base_class::extract( hasher()(key) ); + } + + template + bool contains( Q const& key ) + { + return base_class::contains( hasher()(key) ); + } + + // 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_FeldmanHashSet; + + template + struct set_type< tag_FeldmanHashSet, Key, Val >: public set_type_base< Key, Val > + { + typedef set_type_base< Key, Val > base_class; + typedef typename base_class::compare compare; + typedef typename base_class::less less; + typedef typename base_class::hash hash; + typedef typename base_class::key_type key_type; + typedef typename base_class::value_type value_type; + + template + struct hash_type + { + typedef Hasher hasher; + typedef typename hasher::hash_type type; + }; + + template + struct hash_type> + { + typedef std::hash hasher; + typedef size_t type; + }; + + template + struct key_val: base_class::key_val + { + typedef typename base_class::key_val base; + typedef Hasher hasher; + typedef typename hash_type::type hash_type; + + hash_type hash; + + /*explicit*/ key_val( key_type const& k ): base(k), hash( hasher()( k )) {} + key_val( key_type const& k, value_type const& v ): base(k, v), hash( hasher()( k )) {} + + template + /*explicit*/ key_val( K const& k ): base(k), hash( hasher()( k )) {} + + template + key_val( K const& k, T const& v ): base(k, v), hash( hasher()( k )) {} + }; + + struct default_traits : public cc::feldman_hashset::traits + { + struct hash_accessor { + template + typename key_val::hash_type const& operator()( key_val const& kv ) + { + return kv.hash; + } + }; + }; + + typedef FeldmanHashSet< cds::gc::HP, key_val>, default_traits > FeldmanHashSet_hp_stdhash; + typedef FeldmanHashSet< cds::gc::DHP, key_val>, default_traits > FeldmanHashSet_dhp_stdhash; + typedef FeldmanHashSet< rcu_gpi, key_val>, default_traits > FeldmanHashSet_rcu_gpi_stdhash; + typedef FeldmanHashSet< rcu_gpb, key_val>, default_traits > FeldmanHashSet_rcu_gpb_stdhash; + typedef FeldmanHashSet< rcu_gpt, key_val>, default_traits > FeldmanHashSet_rcu_gpt_stdhash; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef FeldmanHashSet< rcu_shb, key_val>, default_traits > FeldmanHashSet_rcu_shb_stdhash; + typedef FeldmanHashSet< rcu_sht, key_val>, default_traits > FeldmanHashSet_rcu_sht_stdhash; +#endif + + struct traits_FeldmanHashSet_stat: public cc::feldman_hashset::make_traits< + co::type_traits< default_traits >, + co::stat< cc::feldman_hashset::stat<>> + >::type + {}; + + typedef FeldmanHashSet< cds::gc::HP, key_val>, traits_FeldmanHashSet_stat > FeldmanHashSet_hp_stdhash_stat; + typedef FeldmanHashSet< cds::gc::DHP, key_val>, traits_FeldmanHashSet_stat > FeldmanHashSet_dhp_stdhash_stat; + typedef FeldmanHashSet< rcu_gpi, key_val>, traits_FeldmanHashSet_stat > FeldmanHashSet_rcu_gpi_stdhash_stat; + typedef FeldmanHashSet< rcu_gpb, key_val>, traits_FeldmanHashSet_stat > FeldmanHashSet_rcu_gpb_stdhash_stat; + typedef FeldmanHashSet< rcu_gpt, key_val>, traits_FeldmanHashSet_stat > FeldmanHashSet_rcu_gpt_stdhash_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef FeldmanHashSet< rcu_shb, key_val>, traits_FeldmanHashSet_stat > FeldmanHashSet_rcu_shb_stdhash_stat; + typedef FeldmanHashSet< rcu_sht, key_val>, traits_FeldmanHashSet_stat > FeldmanHashSet_rcu_sht_stdhash_stat; +#endif + + // CityHash +#if CDS_BUILD_BITS == 64 + struct traits_FeldmanHashSet_city64 : public default_traits + { + typedef ::cds_test::city64::less less; + }; + typedef FeldmanHashSet< cds::gc::HP, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64 > FeldmanHashSet_hp_city64; + typedef FeldmanHashSet< cds::gc::DHP, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64 > FeldmanHashSet_dhp_city64; + typedef FeldmanHashSet< rcu_gpi, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64 > FeldmanHashSet_rcu_gpi_city64; + typedef FeldmanHashSet< rcu_gpb, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64 > FeldmanHashSet_rcu_gpb_city64; + typedef FeldmanHashSet< rcu_gpt, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64 > FeldmanHashSet_rcu_gpt_city64; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef FeldmanHashSet< rcu_shb, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64 > FeldmanHashSet_rcu_shb_city64; + typedef FeldmanHashSet< rcu_sht, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64 > FeldmanHashSet_rcu_sht_city64; +#endif + + struct traits_FeldmanHashSet_city64_stat : public traits_FeldmanHashSet_city64 + { + typedef cc::feldman_hashset::stat<> stat; + }; + typedef FeldmanHashSet< cds::gc::HP, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64_stat > FeldmanHashSet_hp_city64_stat; + typedef FeldmanHashSet< cds::gc::DHP, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64_stat > FeldmanHashSet_dhp_city64_stat; + typedef FeldmanHashSet< rcu_gpi, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64_stat > FeldmanHashSet_rcu_gpi_city64_stat; + typedef FeldmanHashSet< rcu_gpb, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64_stat > FeldmanHashSet_rcu_gpb_city64_stat; + typedef FeldmanHashSet< rcu_gpt, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64_stat > FeldmanHashSet_rcu_gpt_city64_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef FeldmanHashSet< rcu_shb, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64_stat > FeldmanHashSet_rcu_shb_city64_stat; + typedef FeldmanHashSet< rcu_sht, key_val<::cds_test::city64>, traits_FeldmanHashSet_city64_stat > FeldmanHashSet_rcu_sht_city64_stat; +#endif + + struct traits_FeldmanHashSet_city128 : public default_traits + { + typedef ::cds_test::city128::less less; + }; + typedef FeldmanHashSet< cds::gc::HP, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128 > FeldmanHashSet_hp_city128; + typedef FeldmanHashSet< cds::gc::DHP, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128 > FeldmanHashSet_dhp_city128; + typedef FeldmanHashSet< rcu_gpi, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128 > FeldmanHashSet_rcu_gpi_city128; + typedef FeldmanHashSet< rcu_gpb, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128 > FeldmanHashSet_rcu_gpb_city128; + typedef FeldmanHashSet< rcu_gpt, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128 > FeldmanHashSet_rcu_gpt_city128; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef FeldmanHashSet< rcu_shb, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128 > FeldmanHashSet_rcu_shb_city128; + typedef FeldmanHashSet< rcu_sht, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128 > FeldmanHashSet_rcu_sht_city128; +#endif + + struct traits_FeldmanHashSet_city128_stat : public traits_FeldmanHashSet_city128 + { + typedef cc::feldman_hashset::stat<> stat; + }; + typedef FeldmanHashSet< cds::gc::HP, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128_stat > FeldmanHashSet_hp_city128_stat; + typedef FeldmanHashSet< cds::gc::DHP, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128_stat > FeldmanHashSet_dhp_city128_stat; + typedef FeldmanHashSet< rcu_gpi, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128_stat > FeldmanHashSet_rcu_gpi_city128_stat; + typedef FeldmanHashSet< rcu_gpb, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128_stat > FeldmanHashSet_rcu_gpb_city128_stat; + typedef FeldmanHashSet< rcu_gpt, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128_stat > FeldmanHashSet_rcu_gpt_city128_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef FeldmanHashSet< rcu_shb, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128_stat > FeldmanHashSet_rcu_shb_city128_stat; + typedef FeldmanHashSet< rcu_sht, key_val<::cds_test::city128>, traits_FeldmanHashSet_city128_stat > FeldmanHashSet_rcu_sht_city128_stat; +#endif + +#endif // #if CDS_BUILD_BITS == 64 + + + // for fixed-sized key + // No hash function is necessary + + struct fixed_sized_key + { + typedef typename set_type_base< Key, Val >::key_type key_type; + struct key_val : public set_type_base< Key, Val >::key_val + { + typedef typename set_type_base< Key, Val >::key_val base_class; + + /*explicit*/ key_val(key_type const& k) : base_class(k) {} + key_val(key_type const& k, value_type const& v) : base_class(k, v) {} + + template + /*explicit*/ key_val(K const& k) : base_class(k) {} + + template + key_val(K const& k, T const& v) : base_class(k, v) {} + + // mock hasher + struct hasher { + template + key_type operator()( Q const& k ) const + { + return key_type( k ); + } + }; + }; + + struct traits : public cc::feldman_hashset::traits + { + struct hash_accessor { + key_type operator()(key_val const& kv) + { + return kv.key; + } + }; + }; + + struct traits_stat : public traits + { + typedef cc::feldman_hashset::stat<> stat; + }; + }; + + typedef FeldmanHashSet< cds::gc::HP, typename fixed_sized_key::key_val, typename fixed_sized_key::traits > FeldmanHashSet_hp_fixed; + typedef FeldmanHashSet< cds::gc::DHP, typename fixed_sized_key::key_val, typename fixed_sized_key::traits > FeldmanHashSet_dhp_fixed; + typedef FeldmanHashSet< rcu_gpi, typename fixed_sized_key::key_val, typename fixed_sized_key::traits > FeldmanHashSet_rcu_gpi_fixed; + typedef FeldmanHashSet< rcu_gpb, typename fixed_sized_key::key_val, typename fixed_sized_key::traits > FeldmanHashSet_rcu_gpb_fixed; + typedef FeldmanHashSet< rcu_gpt, typename fixed_sized_key::key_val, typename fixed_sized_key::traits > FeldmanHashSet_rcu_gpt_fixed; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef FeldmanHashSet< rcu_shb, typename fixed_sized_key::key_val, typename fixed_sized_key::traits > FeldmanHashSet_rcu_shb_fixed; + typedef FeldmanHashSet< rcu_sht, typename fixed_sized_key::key_val, typename fixed_sized_key::traits > FeldmanHashSet_rcu_sht_fixed; +#endif + + typedef FeldmanHashSet< cds::gc::HP, typename fixed_sized_key::key_val, typename fixed_sized_key::traits_stat > FeldmanHashSet_hp_fixed_stat; + typedef FeldmanHashSet< cds::gc::DHP, typename fixed_sized_key::key_val, typename fixed_sized_key::traits_stat > FeldmanHashSet_dhp_fixed_stat; + typedef FeldmanHashSet< rcu_gpi, typename fixed_sized_key::key_val, typename fixed_sized_key::traits_stat > FeldmanHashSet_rcu_gpi_fixed_stat; + typedef FeldmanHashSet< rcu_gpb, typename fixed_sized_key::key_val, typename fixed_sized_key::traits_stat > FeldmanHashSet_rcu_gpb_fixed_stat; + typedef FeldmanHashSet< rcu_gpt, typename fixed_sized_key::key_val, typename fixed_sized_key::traits_stat > FeldmanHashSet_rcu_gpt_fixed_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef FeldmanHashSet< rcu_shb, typename fixed_sized_key::key_val, typename fixed_sized_key::traits_stat > FeldmanHashSet_rcu_shb_fixed_stat; + typedef FeldmanHashSet< rcu_sht, typename fixed_sized_key::key_val, typename fixed_sized_key::traits_stat > FeldmanHashSet_rcu_sht_fixed_stat; +#endif + + }; + + template + static inline void print_stat( cds_test::property_stream& o, FeldmanHashSet< GC, T, Traits > const& s ) + { + std::vector< cds::intrusive::feldman_hashset::level_statistics > level_stat; + s.get_level_statistics( level_stat ); + + o << s.statistics() << level_stat; + } + +} // namespace set + +#endif // #ifndef CDSUNIT_SET_TYPE_FELDMAN_HASHSET_H diff --git a/test/stress/set/set_type_lazy_list.h b/test/stress/set/set_type_lazy_list.h new file mode 100644 index 00000000..05938c4c --- /dev/null +++ b/test/stress/set/set_type_lazy_list.h @@ -0,0 +1,144 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_LAZY_LIST_H +#define CDSUNIT_SET_TYPE_LAZY_LIST_H + +#include "set_type.h" + +#include +#include +#include + +namespace set { + + template + struct lazy_list_type + { + typedef typename set_type_base< Key, Val >::key_val key_val; + typedef typename set_type_base< Key, Val >::compare compare; + typedef typename set_type_base< Key, Val >::less less; + + struct traits_LazyList_cmp_stdAlloc : + public cc::lazy_list::make_traits< + co::compare< compare > + >::type + {}; + typedef cc::LazyList< cds::gc::HP, key_val, traits_LazyList_cmp_stdAlloc > LazyList_HP_cmp_stdAlloc; + typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_cmp_stdAlloc > LazyList_DHP_cmp_stdAlloc; + typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_cmp_stdAlloc > LazyList_RCU_GPI_cmp_stdAlloc; + typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_cmp_stdAlloc > LazyList_RCU_GPB_cmp_stdAlloc; + typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_cmp_stdAlloc > LazyList_RCU_GPT_cmp_stdAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_cmp_stdAlloc > LazyList_RCU_SHB_cmp_stdAlloc; + typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_cmp_stdAlloc > LazyList_RCU_SHT_cmp_stdAlloc; +#endif + struct traits_LazyList_cmp_stdAlloc_seqcst : + public cc::lazy_list::make_traits< + co::compare< compare > + ,co::memory_model< co::v::sequential_consistent > + >::type + {}; + typedef cc::LazyList< cds::gc::HP, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_HP_cmp_stdAlloc_seqcst; + typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_DHP_cmp_stdAlloc_seqcst; + typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_RCU_GPI_cmp_stdAlloc_seqcst; + typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_RCU_GPB_cmp_stdAlloc_seqcst; + typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_RCU_GPT_cmp_stdAlloc_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_RCU_SHB_cmp_stdAlloc_seqcst; + typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_cmp_stdAlloc_seqcst > LazyList_RCU_SHT_cmp_stdAlloc_seqcst; +#endif + struct traits_LazyList_cmp_michaelAlloc : + public cc::lazy_list::make_traits< + co::compare< compare >, + co::allocator< memory::MichaelAllocator > + >::type + {}; + typedef cc::LazyList< cds::gc::HP, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_HP_cmp_michaelAlloc; + typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_DHP_cmp_michaelAlloc; + typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_RCU_GPI_cmp_michaelAlloc; + typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_RCU_GPB_cmp_michaelAlloc; + typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_RCU_GPT_cmp_michaelAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_RCU_SHB_cmp_michaelAlloc; + typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_cmp_michaelAlloc > LazyList_RCU_SHT_cmp_michaelAlloc; +#endif + + struct traits_LazyList_less_stdAlloc: + public cc::lazy_list::make_traits< + co::less< less > + >::type + {}; + typedef cc::LazyList< cds::gc::HP, key_val, traits_LazyList_less_stdAlloc > LazyList_HP_less_stdAlloc; + typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_less_stdAlloc > LazyList_DHP_less_stdAlloc; + typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_less_stdAlloc > LazyList_RCU_GPI_less_stdAlloc; + typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_less_stdAlloc > LazyList_RCU_GPB_less_stdAlloc; + typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_less_stdAlloc > LazyList_RCU_GPT_less_stdAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_less_stdAlloc > LazyList_RCU_SHB_less_stdAlloc; + typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_less_stdAlloc > LazyList_RCU_SHT_less_stdAlloc; +#endif + + struct traits_LazyList_less_stdAlloc_seqcst : + public cc::lazy_list::make_traits< + co::less< less > + ,co::memory_model< co::v::sequential_consistent > + >::type + {}; + typedef cc::LazyList< cds::gc::HP, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_HP_less_stdAlloc_seqcst; + typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_DHP_less_stdAlloc_seqcst; + typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_RCU_GPI_less_stdAlloc_seqcst; + typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_RCU_GPB_less_stdAlloc_seqcst; + typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_RCU_GPT_less_stdAlloc_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_RCU_SHB_less_stdAlloc_seqcst; + typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_less_stdAlloc_seqcst > LazyList_RCU_SHT_less_stdAlloc_seqcst; +#endif + + struct traits_LazyList_less_michaelAlloc : + public cc::lazy_list::make_traits< + co::less< less >, + co::allocator< memory::MichaelAllocator > + >::type + {}; + typedef cc::LazyList< cds::gc::HP, key_val, traits_LazyList_less_michaelAlloc > LazyList_HP_less_michaelAlloc; + typedef cc::LazyList< cds::gc::DHP, key_val, traits_LazyList_less_michaelAlloc > LazyList_DHP_less_michaelAlloc; + typedef cc::LazyList< rcu_gpi, key_val, traits_LazyList_less_michaelAlloc > LazyList_RCU_GPI_less_michaelAlloc; + typedef cc::LazyList< rcu_gpb, key_val, traits_LazyList_less_michaelAlloc > LazyList_RCU_GPB_less_michaelAlloc; + typedef cc::LazyList< rcu_gpt, key_val, traits_LazyList_less_michaelAlloc > LazyList_RCU_GPT_less_michaelAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::LazyList< rcu_shb, key_val, traits_LazyList_less_michaelAlloc > LazyList_RCU_SHB_less_michaelAlloc; + typedef cc::LazyList< rcu_sht, key_val, traits_LazyList_less_michaelAlloc > LazyList_RCU_SHT_less_michaelAlloc; +#endif + }; + +} // namespace set + +#endif // #ifndef CDSUNIT_SET_TYPE_LAZY_LIST_H diff --git a/test/stress/set/set_type_michael.h b/test/stress/set/set_type_michael.h new file mode 100644 index 00000000..854a2f34 --- /dev/null +++ b/test/stress/set/set_type_michael.h @@ -0,0 +1,197 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_MICHAEL_H +#define CDSUNIT_SET_TYPE_MICHAEL_H + +#include "set_type_michael_list.h" +#include "set_type_lazy_list.h" + +#include +#include + +#include + +namespace set { + + template + class MichaelHashSet : public cc::MichaelHashSet< GC, List, Traits > + { + typedef cc::MichaelHashSet< GC, List, Traits > base_class; + public: + template + MichaelHashSet( Config const& cfg ) + : base_class( cfg.s_nSetSize, cfg.s_nLoadFactor ) + {} + + // 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_MichaelHashSet; + + template + struct set_type< tag_MichaelHashSet, Key, Val >: public set_type_base< Key, Val > + { + typedef set_type_base< Key, Val > base_class; + typedef typename base_class::key_val key_val; + typedef typename base_class::compare compare; + typedef typename base_class::less less; + typedef typename base_class::hash hash; + + // *************************************************************************** + // MichaelHashSet based on MichaelList + + typedef michael_list_type< Key, Val > ml; + + struct traits_MichaelSet_stdAlloc : + public cc::michael_set::make_traits< + co::hash< hash > + >::type + {}; + typedef MichaelHashSet< cds::gc::HP, typename ml::MichaelList_HP_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_HP_cmp_stdAlloc; + typedef MichaelHashSet< cds::gc::DHP, typename ml::MichaelList_DHP_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_DHP_cmp_stdAlloc; + typedef MichaelHashSet< rcu_gpi, typename ml::MichaelList_RCU_GPI_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_RCU_GPI_cmp_stdAlloc; + typedef MichaelHashSet< rcu_gpb, typename ml::MichaelList_RCU_GPB_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_RCU_GPB_cmp_stdAlloc; + typedef MichaelHashSet< rcu_gpt, typename ml::MichaelList_RCU_GPT_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_RCU_GPT_cmp_stdAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef MichaelHashSet< rcu_shb, typename ml::MichaelList_RCU_SHB_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_RCU_SHB_cmp_stdAlloc; + typedef MichaelHashSet< rcu_sht, typename ml::MichaelList_RCU_SHT_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_RCU_SHT_cmp_stdAlloc; +#endif + + typedef MichaelHashSet< cds::gc::HP, typename ml::MichaelList_HP_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_HP_less_stdAlloc; + typedef MichaelHashSet< cds::gc::DHP, typename ml::MichaelList_DHP_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_DHP_less_stdAlloc; + typedef MichaelHashSet< rcu_gpi, typename ml::MichaelList_RCU_GPI_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_RCU_GPI_less_stdAlloc; + typedef MichaelHashSet< rcu_gpb, typename ml::MichaelList_RCU_GPB_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_RCU_GPB_less_stdAlloc; + typedef MichaelHashSet< rcu_gpt, typename ml::MichaelList_RCU_GPT_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_RCU_GPT_less_stdAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef MichaelHashSet< rcu_shb, typename ml::MichaelList_RCU_SHB_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_RCU_SHB_less_stdAlloc; + typedef MichaelHashSet< rcu_sht, typename ml::MichaelList_RCU_SHT_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_RCU_SHT_less_stdAlloc; +#endif + + typedef MichaelHashSet< cds::gc::HP, typename ml::MichaelList_HP_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_HP_less_stdAlloc_seqcst; + typedef MichaelHashSet< cds::gc::DHP, typename ml::MichaelList_DHP_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_DHP_less_stdAlloc_seqcst; + typedef MichaelHashSet< rcu_gpi, typename ml::MichaelList_RCU_GPI_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_RCU_GPI_less_stdAlloc_seqcst; + typedef MichaelHashSet< rcu_gpb, typename ml::MichaelList_RCU_GPB_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_RCU_GPB_less_stdAlloc_seqcst; + typedef MichaelHashSet< rcu_gpt, typename ml::MichaelList_RCU_GPT_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_RCU_GPT_less_stdAlloc_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef MichaelHashSet< rcu_shb, typename ml::MichaelList_RCU_SHB_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_RCU_SHB_less_stdAlloc_seqcst; + typedef MichaelHashSet< rcu_sht, typename ml::MichaelList_RCU_SHT_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_RCU_SHT_less_stdAlloc_seqcst; +#endif + + struct traits_MichaelSet_michaelAlloc : + public cc::michael_set::make_traits< + co::hash< hash >, + co::allocator< memory::MichaelAllocator > + >::type + {}; + typedef MichaelHashSet< cds::gc::HP, typename ml::MichaelList_HP_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_HP_cmp_michaelAlloc; + typedef MichaelHashSet< cds::gc::DHP, typename ml::MichaelList_DHP_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_DHP_cmp_michaelAlloc; + typedef MichaelHashSet< rcu_gpi, typename ml::MichaelList_RCU_GPI_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_RCU_GPI_cmp_michaelAlloc; + typedef MichaelHashSet< rcu_gpb, typename ml::MichaelList_RCU_GPB_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_RCU_GPB_cmp_michaelAlloc; + typedef MichaelHashSet< rcu_gpt, typename ml::MichaelList_RCU_GPT_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_RCU_GPT_cmp_michaelAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef MichaelHashSet< rcu_shb, typename ml::MichaelList_RCU_SHB_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_RCU_SHB_cmp_michaelAlloc; + typedef MichaelHashSet< rcu_sht, typename ml::MichaelList_RCU_SHT_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_RCU_SHT_cmp_michaelAlloc; +#endif + + typedef MichaelHashSet< cds::gc::HP, typename ml::MichaelList_HP_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_HP_less_michaelAlloc; + typedef MichaelHashSet< cds::gc::DHP, typename ml::MichaelList_DHP_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_DHP_less_michaelAlloc; + typedef MichaelHashSet< rcu_gpi, typename ml::MichaelList_RCU_GPI_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_RCU_GPI_less_michaelAlloc; + typedef MichaelHashSet< rcu_gpb, typename ml::MichaelList_RCU_GPB_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_RCU_GPB_less_michaelAlloc; + typedef MichaelHashSet< rcu_gpt, typename ml::MichaelList_RCU_GPT_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_RCU_GPT_less_michaelAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef MichaelHashSet< rcu_shb, typename ml::MichaelList_RCU_SHB_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_RCU_SHB_less_michaelAlloc; + typedef MichaelHashSet< rcu_sht, typename ml::MichaelList_RCU_SHT_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_RCU_SHT_less_michaelAlloc; +#endif + + + // *************************************************************************** + // MichaelHashSet based on LazyList + + typedef lazy_list_type< Key, Val > ll; + + typedef MichaelHashSet< cds::gc::HP, typename ll::LazyList_HP_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_HP_cmp_stdAlloc; + typedef MichaelHashSet< cds::gc::DHP, typename ll::LazyList_DHP_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_DHP_cmp_stdAlloc; + typedef MichaelHashSet< rcu_gpi, typename ll::LazyList_RCU_GPI_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_GPI_cmp_stdAlloc; + typedef MichaelHashSet< rcu_gpb, typename ll::LazyList_RCU_GPB_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_GPB_cmp_stdAlloc; + typedef MichaelHashSet< rcu_gpt, typename ll::LazyList_RCU_GPT_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_GPT_cmp_stdAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef MichaelHashSet< rcu_shb, typename ll::LazyList_RCU_SHB_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_SHB_cmp_stdAlloc; + typedef MichaelHashSet< rcu_sht, typename ll::LazyList_RCU_SHT_cmp_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_SHT_cmp_stdAlloc; +#endif + + typedef MichaelHashSet< cds::gc::HP, typename ll::LazyList_HP_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_HP_less_stdAlloc; + typedef MichaelHashSet< cds::gc::DHP, typename ll::LazyList_DHP_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_DHP_less_stdAlloc; + typedef MichaelHashSet< rcu_gpi, typename ll::LazyList_RCU_GPI_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_GPI_less_stdAlloc; + typedef MichaelHashSet< rcu_gpb, typename ll::LazyList_RCU_GPB_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_GPB_less_stdAlloc; + typedef MichaelHashSet< rcu_gpt, typename ll::LazyList_RCU_GPT_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_GPT_less_stdAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef MichaelHashSet< rcu_shb, typename ll::LazyList_RCU_SHB_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_SHB_less_stdAlloc; + typedef MichaelHashSet< rcu_sht, typename ll::LazyList_RCU_SHT_less_stdAlloc, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_SHT_less_stdAlloc; +#endif + + typedef MichaelHashSet< cds::gc::HP, typename ll::LazyList_HP_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_HP_less_stdAlloc_seqcst; + typedef MichaelHashSet< cds::gc::DHP, typename ll::LazyList_DHP_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_DHP_less_stdAlloc_seqcst; + typedef MichaelHashSet< rcu_gpi, typename ll::LazyList_RCU_GPI_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_GPI_less_stdAlloc_seqcst; + typedef MichaelHashSet< rcu_gpb, typename ll::LazyList_RCU_GPB_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_GPB_less_stdAlloc_seqcst; + typedef MichaelHashSet< rcu_gpt, typename ll::LazyList_RCU_GPT_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_GPT_less_stdAlloc_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef MichaelHashSet< rcu_shb, typename ll::LazyList_RCU_SHB_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_SHB_less_stdAlloc_seqcst; + typedef MichaelHashSet< rcu_sht, typename ll::LazyList_RCU_SHT_less_stdAlloc_seqcst, traits_MichaelSet_stdAlloc > MichaelSet_Lazy_RCU_SHT_less_stdAlloc_seqcst; +#endif + + typedef MichaelHashSet< cds::gc::HP, typename ll::LazyList_HP_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_HP_cmp_michaelAlloc; + typedef MichaelHashSet< cds::gc::DHP, typename ll::LazyList_DHP_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_DHP_cmp_michaelAlloc; + typedef MichaelHashSet< rcu_gpi, typename ll::LazyList_RCU_GPI_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_RCU_GPI_cmp_michaelAlloc; + typedef MichaelHashSet< rcu_gpb, typename ll::LazyList_RCU_GPB_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_RCU_GPB_cmp_michaelAlloc; + typedef MichaelHashSet< rcu_gpt, typename ll::LazyList_RCU_GPT_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_RCU_GPT_cmp_michaelAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef MichaelHashSet< rcu_shb, typename ll::LazyList_RCU_SHB_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_RCU_SHB_cmp_michaelAlloc; + typedef MichaelHashSet< rcu_sht, typename ll::LazyList_RCU_SHT_cmp_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_RCU_SHT_cmp_michaelAlloc; +#endif + + typedef MichaelHashSet< cds::gc::HP, typename ll::LazyList_HP_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_HP_less_michaelAlloc; + typedef MichaelHashSet< cds::gc::DHP, typename ll::LazyList_DHP_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_DHP_less_michaelAlloc; + typedef MichaelHashSet< rcu_gpi, typename ll::LazyList_RCU_GPI_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_RCU_GPI_less_michaelAlloc; + typedef MichaelHashSet< rcu_gpb, typename ll::LazyList_RCU_GPB_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_RCU_GPB_less_michaelAlloc; + typedef MichaelHashSet< rcu_gpt, typename ll::LazyList_RCU_GPT_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_RCU_GPT_less_michaelAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef MichaelHashSet< rcu_shb, typename ll::LazyList_RCU_SHB_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_RCU_SHB_less_michaelAlloc; + typedef MichaelHashSet< rcu_sht, typename ll::LazyList_RCU_SHT_less_michaelAlloc, traits_MichaelSet_michaelAlloc > MichaelSet_Lazy_RCU_SHT_less_michaelAlloc; +#endif + }; + +} // namespace set + + +#endif // #ifndef CDSUNIT_SET_TYPE_MICHAEL_H diff --git a/test/stress/set/set_type_michael_list.h b/test/stress/set/set_type_michael_list.h new file mode 100644 index 00000000..5ba2d555 --- /dev/null +++ b/test/stress/set/set_type_michael_list.h @@ -0,0 +1,144 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_MICHAEL_LIST_H +#define CDSUNIT_SET_TYPE_MICHAEL_LIST_H + +#include "set_type.h" + +#include +#include +#include + +namespace set { + + template + struct michael_list_type + { + typedef typename set_type_base< Key, Val >::key_val key_val; + typedef typename set_type_base< Key, Val >::compare compare; + typedef typename set_type_base< Key, Val >::less less; + + struct traits_MichaelList_cmp_stdAlloc: + public cc::michael_list::make_traits< + co::compare< compare > + >::type + {}; + typedef cc::MichaelList< cds::gc::HP, key_val, traits_MichaelList_cmp_stdAlloc > MichaelList_HP_cmp_stdAlloc; + typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_cmp_stdAlloc > MichaelList_DHP_cmp_stdAlloc; + typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_cmp_stdAlloc > MichaelList_RCU_GPI_cmp_stdAlloc; + typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_cmp_stdAlloc > MichaelList_RCU_GPB_cmp_stdAlloc; + typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_cmp_stdAlloc > MichaelList_RCU_GPT_cmp_stdAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_cmp_stdAlloc > MichaelList_RCU_SHB_cmp_stdAlloc; + typedef cc::MichaelList< rcu_sht, key_val, traits_MichaelList_cmp_stdAlloc > MichaelList_RCU_SHT_cmp_stdAlloc; +#endif + + struct traits_MichaelList_cmp_stdAlloc_seqcst : public traits_MichaelList_cmp_stdAlloc + { + typedef co::v::sequential_consistent memory_model; + }; + typedef cc::MichaelList< cds::gc::HP, key_val, traits_MichaelList_cmp_stdAlloc_seqcst > MichaelList_HP_cmp_stdAlloc_seqcst; + typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_cmp_stdAlloc_seqcst > MichaelList_DHP_cmp_stdAlloc_seqcst; + typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_cmp_stdAlloc_seqcst > MichaelList_RCU_GPI_cmp_stdAlloc_seqcst; + typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_cmp_stdAlloc_seqcst > MichaelList_RCU_GPB_cmp_stdAlloc_seqcst; + typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_cmp_stdAlloc_seqcst > MichaelList_RCU_GPT_cmp_stdAlloc_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_cmp_stdAlloc_seqcst > MichaelList_RCU_SHB_cmp_stdAlloc_seqcst; + typedef cc::MichaelList< rcu_sht, key_val, traits_MichaelList_cmp_stdAlloc_seqcst > MichaelList_RCU_SHT_cmp_stdAlloc_seqcst; +#endif + + struct traits_MichaelList_less_stdAlloc : + public cc::michael_list::make_traits< + co::less< less > + >::type + {}; + typedef cc::MichaelList< cds::gc::HP, key_val, traits_MichaelList_less_stdAlloc > MichaelList_HP_less_stdAlloc; + typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_less_stdAlloc > MichaelList_DHP_less_stdAlloc; + typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_less_stdAlloc > MichaelList_RCU_GPI_less_stdAlloc; + typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_less_stdAlloc > MichaelList_RCU_GPB_less_stdAlloc; + typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_less_stdAlloc > MichaelList_RCU_GPT_less_stdAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_less_stdAlloc > MichaelList_RCU_SHB_less_stdAlloc; + typedef cc::MichaelList< rcu_sht, key_val, traits_MichaelList_less_stdAlloc > MichaelList_RCU_SHT_less_stdAlloc; +#endif + + struct traits_MichaelList_less_stdAlloc_seqcst : + public cc::michael_list::make_traits< + co::less< less > + ,co::memory_model< co::v::sequential_consistent > + >::type + {}; + typedef cc::MichaelList< cds::gc::HP, key_val, traits_MichaelList_less_stdAlloc_seqcst > MichaelList_HP_less_stdAlloc_seqcst; + typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_less_stdAlloc_seqcst > MichaelList_DHP_less_stdAlloc_seqcst; + typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_less_stdAlloc_seqcst > MichaelList_RCU_GPI_less_stdAlloc_seqcst; + typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_less_stdAlloc_seqcst > MichaelList_RCU_GPB_less_stdAlloc_seqcst; + typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_less_stdAlloc_seqcst > MichaelList_RCU_GPT_less_stdAlloc_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_less_stdAlloc_seqcst > MichaelList_RCU_SHB_less_stdAlloc_seqcst; + typedef cc::MichaelList< rcu_sht, key_val, traits_MichaelList_less_stdAlloc_seqcst > MichaelList_RCU_SHT_less_stdAlloc_seqcst; +#endif + + struct traits_MichaelList_cmp_michaelAlloc : + public cc::michael_list::make_traits< + co::compare< compare >, + co::allocator< memory::MichaelAllocator > + >::type + {}; + typedef cc::MichaelList< cds::gc::HP, key_val, traits_MichaelList_cmp_michaelAlloc > MichaelList_HP_cmp_michaelAlloc; + typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_cmp_michaelAlloc > MichaelList_DHP_cmp_michaelAlloc; + typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_cmp_michaelAlloc > MichaelList_RCU_GPI_cmp_michaelAlloc; + typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_cmp_michaelAlloc > MichaelList_RCU_GPB_cmp_michaelAlloc; + typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_cmp_michaelAlloc > MichaelList_RCU_GPT_cmp_michaelAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_cmp_michaelAlloc > MichaelList_RCU_SHB_cmp_michaelAlloc; + typedef cc::MichaelList< rcu_sht, key_val, traits_MichaelList_cmp_michaelAlloc > MichaelList_RCU_SHT_cmp_michaelAlloc; +#endif + + struct traits_MichaelList_less_michaelAlloc : + public cc::michael_list::make_traits< + co::less< less >, + co::allocator< memory::MichaelAllocator > + >::type + {}; + typedef cc::MichaelList< cds::gc::HP, key_val, traits_MichaelList_less_michaelAlloc > MichaelList_HP_less_michaelAlloc; + typedef cc::MichaelList< cds::gc::DHP, key_val, traits_MichaelList_less_michaelAlloc > MichaelList_DHP_less_michaelAlloc; + typedef cc::MichaelList< rcu_gpi, key_val, traits_MichaelList_less_michaelAlloc > MichaelList_RCU_GPI_less_michaelAlloc; + typedef cc::MichaelList< rcu_gpb, key_val, traits_MichaelList_less_michaelAlloc > MichaelList_RCU_GPB_less_michaelAlloc; + typedef cc::MichaelList< rcu_gpt, key_val, traits_MichaelList_less_michaelAlloc > MichaelList_RCU_GPT_less_michaelAlloc; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef cc::MichaelList< rcu_shb, key_val, traits_MichaelList_less_michaelAlloc > MichaelList_RCU_SHB_less_michaelAlloc; + typedef cc::MichaelList< rcu_sht, key_val, traits_MichaelList_less_michaelAlloc > MichaelList_RCU_SHT_less_michaelAlloc; +#endif + }; + +} // namespace set + +#endif // #ifndef CDSUNIT_SET_TYPE_MICHAEL_LIST_H diff --git a/test/stress/set/set_type_skip_list.h b/test/stress/set/set_type_skip_list.h new file mode 100644 index 00000000..05a474a2 --- /dev/null +++ b/test/stress/set/set_type_skip_list.h @@ -0,0 +1,228 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_SKIP_LIST_H +#define CDSUNIT_SET_TYPE_SKIP_LIST_H + +#include "set_type.h" + +#include +#include +#include + +#include + +namespace set { + + template + class SkipListSet : public cc::SkipListSet + { + typedef cc::SkipListSet base_class; + public: + template + SkipListSet( Config const& /*cfg*/ ) + {} + + // 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_SkipListSet; + + template + struct set_type< tag_SkipListSet, Key, Val >: public set_type_base< Key, Val > + { + typedef set_type_base< Key, Val > base_class; + typedef typename base_class::key_val key_val; + typedef typename base_class::compare compare; + typedef typename base_class::less less; + typedef typename base_class::hash hash; + + class traits_SkipListSet_less_pascal: public cc::skip_list::make_traits < + co::less< less > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + ,co::item_counter< cds::atomicity::item_counter > + >::type + {}; + typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_pascal > SkipListSet_hp_less_pascal; + typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_pascal > SkipListSet_dhp_less_pascal; + typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_gpi_less_pascal; + typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_gpb_less_pascal; + typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_gpt_less_pascal; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_shb_less_pascal; + typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_pascal > SkipListSet_rcu_sht_less_pascal; +#endif + + class traits_SkipListSet_less_pascal_seqcst: public cc::skip_list::make_traits < + co::less< less > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + ,co::memory_model< co::v::sequential_consistent > + ,co::item_counter< cds::atomicity::item_counter > + >::type + {}; + typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_hp_less_pascal_seqcst; + typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_dhp_less_pascal_seqcst; + typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_gpi_less_pascal_seqcst; + typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_gpb_less_pascal_seqcst; + typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_gpt_less_pascal_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_shb_less_pascal_seqcst; + typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_pascal_seqcst > SkipListSet_rcu_sht_less_pascal_seqcst; +#endif + + class traits_SkipListSet_less_pascal_stat: public cc::skip_list::make_traits < + co::less< less > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + ,co::stat< cc::skip_list::stat<> > + ,co::item_counter< cds::atomicity::item_counter > + >::type + {}; + typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_hp_less_pascal_stat; + typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_dhp_less_pascal_stat; + typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_gpi_less_pascal_stat; + typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_gpb_less_pascal_stat; + typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_gpt_less_pascal_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_shb_less_pascal_stat; + typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_pascal_stat > SkipListSet_rcu_sht_less_pascal_stat; +#endif + + class traits_SkipListSet_cmp_pascal: public cc::skip_list::make_traits < + co::compare< compare > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + ,co::item_counter< cds::atomicity::item_counter > + >::type + {}; + typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_hp_cmp_pascal; + typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_dhp_cmp_pascal; + typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_gpi_cmp_pascal; + typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_gpb_cmp_pascal; + typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_gpt_cmp_pascal; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_shb_cmp_pascal; + typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_pascal > SkipListSet_rcu_sht_cmp_pascal; +#endif + + class traits_SkipListSet_cmp_pascal_stat: public cc::skip_list::make_traits < + co::compare< compare > + ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal > + ,co::stat< cc::skip_list::stat<> > + ,co::item_counter< cds::atomicity::item_counter > + >::type + {}; + typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_hp_cmp_pascal_stat; + typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_dhp_cmp_pascal_stat; + typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_gpi_cmp_pascal_stat; + typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_gpb_cmp_pascal_stat; + typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_gpt_cmp_pascal_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_shb_cmp_pascal_stat; + typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_pascal_stat > SkipListSet_rcu_sht_cmp_pascal_stat; +#endif + + class traits_SkipListSet_less_xorshift: public cc::skip_list::make_traits < + co::less< less > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + ,co::item_counter< cds::atomicity::item_counter > + >::type + {}; + typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_xorshift > SkipListSet_hp_less_xorshift; + typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_xorshift > SkipListSet_dhp_less_xorshift; + typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_gpi_less_xorshift; + typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_gpb_less_xorshift; + typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_gpt_less_xorshift; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_shb_less_xorshift; + typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_xorshift > SkipListSet_rcu_sht_less_xorshift; +#endif + + class traits_SkipListSet_less_xorshift_stat: public cc::skip_list::make_traits < + co::less< less > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + ,co::stat< cc::skip_list::stat<> > + ,co::item_counter< cds::atomicity::item_counter > + >::type + {}; + typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_hp_less_xorshift_stat; + typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_dhp_less_xorshift_stat; + typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_gpi_less_xorshift_stat; + typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_gpb_less_xorshift_stat; + typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_gpt_less_xorshift_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_shb_less_xorshift_stat; + typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_less_xorshift_stat > SkipListSet_rcu_sht_less_xorshift_stat; +#endif + + class traits_SkipListSet_cmp_xorshift: public cc::skip_list::make_traits < + co::compare< compare > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + ,co::item_counter< cds::atomicity::item_counter > + >::type + {}; + typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_hp_cmp_xorshift; + typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_dhp_cmp_xorshift; + typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_gpi_cmp_xorshift; + typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_gpb_cmp_xorshift; + typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_gpt_cmp_xorshift; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_shb_cmp_xorshift; + typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_xorshift > SkipListSet_rcu_sht_cmp_xorshift; +#endif + + class traits_SkipListSet_cmp_xorshift_stat: public cc::skip_list::make_traits < + co::compare< compare > + ,cc::skip_list::random_level_generator< cc::skip_list::xorshift > + ,co::stat< cc::skip_list::stat<> > + ,co::item_counter< cds::atomicity::item_counter > + >::type + {}; + typedef SkipListSet< cds::gc::HP, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_hp_cmp_xorshift_stat; + typedef SkipListSet< cds::gc::DHP, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_dhp_cmp_xorshift_stat; + typedef SkipListSet< rcu_gpi, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_gpi_cmp_xorshift_stat; + typedef SkipListSet< rcu_gpb, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_gpb_cmp_xorshift_stat; + typedef SkipListSet< rcu_gpt, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_gpt_cmp_xorshift_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SkipListSet< rcu_shb, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_shb_cmp_xorshift_stat; + typedef SkipListSet< rcu_sht, key_val, traits_SkipListSet_cmp_xorshift_stat > SkipListSet_rcu_sht_cmp_xorshift_stat; +#endif + }; + + template + static inline void print_stat( cds_test::property_stream& o, SkipListSet const& s ) + { + o << s.statistics(); + } + +} // namespace set + +#endif // #ifndef CDSUNIT_SET_TYPE_SKIP_LIST_H diff --git a/test/stress/set/set_type_split_list.h b/test/stress/set/set_type_split_list.h new file mode 100644 index 00000000..ad7e7c11 --- /dev/null +++ b/test/stress/set/set_type_split_list.h @@ -0,0 +1,526 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_SPLIT_LIST_H +#define CDSUNIT_SET_TYPE_SPLIT_LIST_H + +#include "set_type.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +namespace set { + + template + class SplitListSet : public cc::SplitListSet< GC, T, Traits > + { + typedef cc::SplitListSet< GC, T, Traits > base_class; + public: + template + SplitListSet( Config const& cfg ) + : base_class( cfg.s_nSetSize, cfg.s_nLoadFactor ) + {} + + // 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_SplitListSet; + + template + struct set_type< tag_SplitListSet, Key, Val >: public set_type_base< Key, Val > + { + typedef set_type_base< Key, Val > base_class; + typedef typename base_class::key_val key_val; + typedef typename base_class::compare compare; + typedef typename base_class::less less; + typedef typename base_class::hash hash; + + // *************************************************************************** + // SplitListSet based on MichaelList + + struct traits_SplitList_Michael_dyn_cmp : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + co::compare< compare > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_HP_dyn_cmp; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_DHP_dyn_cmp; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_RCU_GPI_dyn_cmp; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_RCU_GPB_dyn_cmp; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_RCU_GPT_dyn_cmp; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_RCU_SHB_dyn_cmp; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_dyn_cmp > SplitList_Michael_RCU_SHT_dyn_cmp; +#endif + + struct traits_SplitList_Michael_dyn_cmp_stat : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,co::stat< cc::split_list::stat<> > + ,cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + co::compare< compare > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_HP_dyn_cmp_stat; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_DHP_dyn_cmp_stat; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_RCU_GPI_dyn_cmp_stat; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_RCU_GPB_dyn_cmp_stat; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_RCU_GPT_dyn_cmp_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_RCU_SHB_dyn_cmp_stat; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_dyn_cmp_stat > SplitList_Michael_RCU_SHT_dyn_cmp_stat; +#endif + + struct traits_SplitList_Michael_dyn_cmp_seqcst : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,co::memory_model< co::v::sequential_consistent > + ,cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + co::compare< compare > + ,co::memory_model< co::v::sequential_consistent > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_HP_dyn_cmp_seqcst; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_DHP_dyn_cmp_seqcst; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_RCU_GPI_dyn_cmp_seqcst; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_RCU_GPB_dyn_cmp_seqcst; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_RCU_GPT_dyn_cmp_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_RCU_SHB_dyn_cmp_seqcst; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_dyn_cmp_seqcst > SplitList_Michael_RCU_SHT_dyn_cmp_seqcst; +#endif + + struct traits_SplitList_Michael_st_cmp : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,cc::split_list::dynamic_bucket_table< false > + ,co::hash< hash > + ,cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + co::compare< compare > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_HP_st_cmp; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_DHP_st_cmp; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_RCU_GPI_st_cmp; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_RCU_GPB_st_cmp; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_RCU_GPT_st_cmp; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_RCU_SHB_st_cmp; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_st_cmp > SplitList_Michael_RCU_SHT_st_cmp; +#endif + + struct traits_SplitList_Michael_st_cmp_seqcst : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,cc::split_list::dynamic_bucket_table< false > + ,co::memory_model< co::v::sequential_consistent > + ,cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + co::compare< compare > + ,co::memory_model< co::v::sequential_consistent > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_st_cmp_seqcst> SplitList_Michael_HP_st_cmp_seqcst; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_st_cmp_seqcst> SplitList_Michael_DHP_st_cmp_seqcst; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_st_cmp_seqcst> SplitList_Michael_RCU_GPI_st_cmp_seqcst; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_st_cmp_seqcst> SplitList_Michael_RCU_GPB_st_cmp_seqcst; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_st_cmp_seqcst> SplitList_Michael_RCU_GPT_st_cmp_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_st_cmp_seqcst> SplitList_Michael_RCU_SHB_st_cmp_seqcst; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_st_cmp_seqcst> SplitList_Michael_RCU_SHT_st_cmp_seqcst; +#endif + + //HP + less + struct traits_SplitList_Michael_dyn_less : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + co::less< less > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_HP_dyn_less; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_DHP_dyn_less; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_RCU_GPI_dyn_less; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_RCU_GPB_dyn_less; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_RCU_GPT_dyn_less; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_RCU_SHB_dyn_less; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_dyn_less > SplitList_Michael_RCU_SHT_dyn_less; +#endif + + struct traits_SplitList_Michael_dyn_less_seqcst : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,co::memory_model< co::v::sequential_consistent > + ,cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + co::less< less > + ,co::memory_model< co::v::sequential_consistent > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_dyn_less_seqcst > SplitList_Michael_HP_dyn_less_seqcst; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_dyn_less_seqcst > SplitList_Michael_DHP_dyn_less_seqcst; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_dyn_less_seqcst > SplitList_Michael_RCU_GPI_dyn_less_seqcst; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_dyn_less_seqcst > SplitList_Michael_RCU_GPB_dyn_less_seqcst; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_dyn_less_seqcst > SplitList_Michael_RCU_GPT_dyn_less_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_dyn_less_seqcst > SplitList_Michael_RCU_SHB_dyn_less_seqcst; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_dyn_less_seqcst > SplitList_Michael_RCU_SHT_dyn_less_seqcst; +#endif + + struct traits_SplitList_Michael_st_less : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,cc::split_list::dynamic_bucket_table< false > + ,co::hash< hash > + ,cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + co::less< less > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_HP_st_less; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_DHP_st_less; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_RCU_GPI_st_less; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_RCU_GPB_st_less; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_RCU_GPT_st_less; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_RCU_SHB_st_less; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_st_less > SplitList_Michael_RCU_SHT_st_less; +#endif + + struct traits_SplitList_Michael_st_less_stat : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,cc::split_list::dynamic_bucket_table< false > + ,co::hash< hash > + ,co::stat< cc::split_list::stat<>> + ,cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + co::less< less > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_HP_st_less_stat; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_DHP_st_less_stat; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_RCU_GPI_st_less_stat; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_RCU_GPB_st_less_stat; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_RCU_GPT_st_less_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_RCU_SHB_st_less_stat; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_st_less_stat > SplitList_Michael_RCU_SHT_st_less_stat; +#endif + + struct traits_SplitList_Michael_st_less_seqcst : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,cc::split_list::dynamic_bucket_table< false > + ,co::memory_model< co::v::sequential_consistent > + ,cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + co::less< less > + ,co::memory_model< co::v::sequential_consistent > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Michael_st_less_seqcst > SplitList_Michael_HP_st_less_seqcst; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Michael_st_less_seqcst > SplitList_Michael_DHP_st_less_seqcst; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Michael_st_less_seqcst > SplitList_Michael_RCU_GPI_st_less_seqcst; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Michael_st_less_seqcst > SplitList_Michael_RCU_GPB_st_less_seqcst; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Michael_st_less_seqcst > SplitList_Michael_RCU_GPT_st_less_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Michael_st_less_seqcst > SplitList_Michael_RCU_SHB_st_less_seqcst; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Michael_st_less_seqcst > SplitList_Michael_RCU_SHT_st_less_seqcst; +#endif + + // *************************************************************************** + // SplitListSet based on LazyList + + struct traits_SplitList_Lazy_dyn_cmp : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + co::compare< compare > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_HP_dyn_cmp; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_DHP_dyn_cmp; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_GPI_dyn_cmp; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_GPB_dyn_cmp; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_GPT_dyn_cmp; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_SHB_dyn_cmp; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_SHT_dyn_cmp; +#endif + + struct traits_SplitList_Lazy_dyn_cmp_stat : public traits_SplitList_Lazy_dyn_cmp + { + typedef cc::split_list::stat<> stat; + }; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_HP_dyn_cmp_stat; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_DHP_dyn_cmp_stat; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_RCU_GPI_dyn_cmp_stat; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_RCU_GPB_dyn_cmp_stat; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_dyn_cmp_stat > SplitList_Lazy_RCU_GPT_dyn_cmp_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_SHB_dyn_cmp_stat; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_dyn_cmp > SplitList_Lazy_RCU_SHT_dyn_cmp_stat; +#endif + + struct traits_SplitList_Lazy_dyn_cmp_seqcst : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,co::memory_model< co::v::sequential_consistent > + ,cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + co::compare< compare > + ,co::memory_model< co::v::sequential_consistent > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_HP_dyn_cmp_seqcst; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_DHP_dyn_cmp_seqcst; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_RCU_GPI_dyn_cmp_seqcst; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_RCU_GPB_dyn_cmp_seqcst; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_RCU_GPT_dyn_cmp_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_RCU_SHB_dyn_cmp_seqcst; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_dyn_cmp_seqcst > SplitList_Lazy_RCU_SHT_dyn_cmp_seqcst; +#endif + + struct traits_SplitList_Lazy_st_cmp : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,cc::split_list::dynamic_bucket_table< false > + ,co::hash< hash > + ,cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + co::compare< compare > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_HP_st_cmp; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_DHP_st_cmp; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_RCU_GPI_st_cmp; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_RCU_GPB_st_cmp; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_RCU_GPT_st_cmp; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_RCU_SHB_st_cmp; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_st_cmp > SplitList_Lazy_RCU_SHT_st_cmp; +#endif + + struct traits_SplitList_Lazy_st_cmp_seqcst : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,cc::split_list::dynamic_bucket_table< false > + ,co::memory_model< co::v::sequential_consistent > + ,cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + co::compare< compare > + ,co::memory_model< co::v::sequential_consistent > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_st_cmp_seqcst > SplitList_Lazy_HP_st_cmp_seqcst; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_st_cmp_seqcst > SplitList_Lazy_DHP_st_cmp_seqcst; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_st_cmp_seqcst > SplitList_Lazy_RCU_GPI_st_cmp_seqcst; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_st_cmp_seqcst > SplitList_Lazy_RCU_GPB_st_cmp_seqcst; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_st_cmp_seqcst > SplitList_Lazy_RCU_GPT_st_cmp_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_st_cmp_seqcst > SplitList_Lazy_RCU_SHB_st_cmp_seqcst; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_st_cmp_seqcst > SplitList_Lazy_RCU_SHT_st_cmp_seqcst; +#endif + + struct traits_SplitList_Lazy_dyn_less : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + co::less< less > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_HP_dyn_less; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_DHP_dyn_less; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_RCU_GPI_dyn_less; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_RCU_GPB_dyn_less; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_RCU_GPT_dyn_less; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_RCU_SHB_dyn_less; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_dyn_less > SplitList_Lazy_RCU_SHT_dyn_less; +#endif + + struct traits_SplitList_Lazy_dyn_less_seqcst : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,co::memory_model< co::v::sequential_consistent > + ,cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + co::less< less > + ,co::memory_model< co::v::sequential_consistent > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_dyn_less_seqcst > SplitList_Lazy_HP_dyn_less_seqcst; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_dyn_less_seqcst > SplitList_Lazy_DHP_dyn_less_seqcst; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_dyn_less_seqcst > SplitList_Lazy_RCU_GPI_dyn_less_seqcst; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_dyn_less_seqcst > SplitList_Lazy_RCU_GPB_dyn_less_seqcst; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_dyn_less_seqcst > SplitList_Lazy_RCU_GPT_dyn_less_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_dyn_less_seqcst > SplitList_Lazy_RCU_SHB_dyn_less_seqcst; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_dyn_less_seqcst > SplitList_Lazy_RCU_SHT_dyn_less_seqcst; +#endif + + struct traits_SplitList_Lazy_st_less : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,cc::split_list::dynamic_bucket_table< false > + ,co::hash< hash > + ,cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + co::less< less > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_HP_st_less; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_DHP_st_less; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_RCU_GPI_st_less; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_RCU_GPB_st_less; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_RCU_GPT_st_less; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_RCU_SHB_st_less; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_st_less > SplitList_Lazy_RCU_SHT_st_less; +#endif + + struct traits_SplitList_Lazy_st_less_seqcst : + public cc::split_list::make_traits< + cc::split_list::ordered_list + ,co::hash< hash > + ,cc::split_list::dynamic_bucket_table< false > + ,co::memory_model< co::v::sequential_consistent > + ,cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + co::less< less > + ,co::memory_model< co::v::sequential_consistent > + >::type + > + >::type + {}; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_st_less_seqcst > SplitList_Lazy_HP_st_less_seqcst; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_st_less_seqcst > SplitList_Lazy_DHP_st_less_seqcst; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_st_less_seqcst > SplitList_Lazy_RCU_GPI_st_less_seqcst; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_st_less_seqcst > SplitList_Lazy_RCU_GPB_st_less_seqcst; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_st_less_seqcst > SplitList_Lazy_RCU_GPT_st_less_seqcst; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_st_less_seqcst > SplitList_Lazy_RCU_SHB_st_less_seqcst; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_st_less_seqcst > SplitList_Lazy_RCU_SHT_st_less_seqcst; +#endif + + struct traits_SplitList_Lazy_st_less_stat : public traits_SplitList_Lazy_st_less + { + typedef cc::split_list::stat<> stat; + }; + typedef SplitListSet< cds::gc::HP, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_HP_st_less_stat; + typedef SplitListSet< cds::gc::DHP, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_DHP_st_less_stat; + typedef SplitListSet< rcu_gpi, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_RCU_GPI_st_less_stat; + typedef SplitListSet< rcu_gpb, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_RCU_GPB_st_less_stat; + typedef SplitListSet< rcu_gpt, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_RCU_GPT_st_less_stat; +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + typedef SplitListSet< rcu_shb, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_RCU_SHB_st_less_stat; + typedef SplitListSet< rcu_sht, key_val, traits_SplitList_Lazy_st_less_stat > SplitList_Lazy_RCU_SHT_st_less_stat; +#endif + }; + + template + static inline void print_stat( cds_test::property_stream& o, SplitListSet const& s ) + { + o << s.statistics(); + } + +} // namespace set + +#endif // #ifndef CDSUNIT_SET_TYPE_SPLIT_LIST_H diff --git a/test/stress/set/set_type_std.h b/test/stress/set/set_type_std.h new file mode 100644 index 00000000..565dea5e --- /dev/null +++ b/test/stress/set/set_type_std.h @@ -0,0 +1,245 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_STD_H +#define CDSUNIT_SET_TYPE_STD_H + +#include +#include +#include //unique_lock + +#include "set2/set_type.h" + +namespace set2 { + + struct tag_StdSet; + + template ::other + > + class StdHashSet + : public std::unordered_set< + Value + , Hash + , EqualTo + , Alloc + > + { + public: + Lock m_lock; + typedef std::unique_lock scoped_lock; + typedef std::unordered_set< + Value + , Hash + , EqualTo + , Alloc + > base_class; + + public: + typedef typename base_class::value_type value_type; + + template + StdHashSet( Config const& ) + {} + + template + bool contains( const Key& key ) + { + scoped_lock al( m_lock ); + return base_class::find( value_type(key) ) != base_class::end(); + } + + template + bool insert( Key const& key ) + { + scoped_lock al( m_lock ); + std::pair pRet = base_class::insert( value_type( key )); + return pRet.second; + } + + template + bool insert( Key const& key, Func func ) + { + scoped_lock al( m_lock ); + std::pair pRet = base_class::insert( value_type( key )); + if ( pRet.second ) { + func( *pRet.first ); + return true; + } + return false; + } + + template + std::pair ensure( const T& key, Func func ) + { + scoped_lock al( m_lock ); + std::pair pRet = base_class::insert( value_type( key )); + if ( pRet.second ) { + func( true, *pRet.first, key ); + return std::make_pair( true, true ); + } + else { + func( false, *pRet.first, key ); + return std::make_pair( true, false ); + } + } + + template + bool erase( const Key& key ) + { + scoped_lock al( m_lock ); + return base_class::erase( value_type(key) ) != 0; + } + + template + bool erase( const T& key, Func func ) + { + scoped_lock al( m_lock ); + typename base_class::iterator it = base_class::find( value_type(key) ); + if ( it != base_class::end() ) { + func( *it ); + return base_class::erase( it ) != base_class::end(); + } + return false; + } + + std::ostream& dump( std::ostream& stm ) { return stm; } + + // 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 = true; + }; + + template ::other + > + class StdSet: public std::set + { + Lock m_lock; + typedef std::unique_lock scoped_lock; + typedef std::set base_class; + public: + typedef typename base_class::key_type value_type; + + template + StdSet( Config const& ) + {} + + template + bool contains( const Key& key ) + { + value_type v( key ); + scoped_lock al( m_lock ); + return base_class::find( v ) != base_class::end(); + } + + bool insert( value_type const& v ) + { + scoped_lock al( m_lock ); + return base_class::insert( v ).second; + } + + template + bool insert( Key const& key, Func func ) + { + scoped_lock al( m_lock ); + std::pair pRet = base_class::insert( value_type( key )); + if ( pRet.second ) { + func( *pRet.first ); + return true; + } + return false; + } + + template + std::pair ensure( const T& key, Func func ) + { + scoped_lock al( m_lock ); + std::pair pRet = base_class::insert( value_type( key )); + if ( pRet.second ) { + func( true, *pRet.first, key ); + return std::make_pair( true, true ); + } + else { + func( false, *pRet.first, key ); + return std::make_pair( true, false ); + } + } + + template + bool erase( const Key& key ) + { + scoped_lock al( m_lock ); + return base_class::erase( value_type(key) ) != 0; + } + + template + bool erase( const T& key, Func func ) + { + scoped_lock al( m_lock ); + typename base_class::iterator it = base_class::find( value_type(key) ); + if ( it != base_class::end() ) { + func( *it ); + + base_class::erase( it ); + return true; + } + return false; + } + + std::ostream& dump( std::ostream& stm ) { return stm; } + + // for testing + static CDS_CONSTEXPR bool const c_bExtractSupported = false; + static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false; + }; + + template + struct set_type< tag_StdSet, Key, Val >: public set_type_base< Key, Val > + { + typedef set_type_base< Key, Val > base_class; + typedef typename base_class::key_val key_val; + typedef typename base_class::less less; + typedef typename base_class::hash hash; + typedef typename base_class::equal_to equal_to; + + typedef StdSet< key_val, less, cds::sync::spin > StdSet_Spin; + typedef StdSet< key_val, less, std::mutex > StdSet_Mutex; + typedef StdSet< key_val, less, lock::NoLock> StdSet_NoLock; + + typedef StdHashSet< key_val, hash, less, equal_to, cds::sync::spin > StdHashSet_Spin; + typedef StdHashSet< key_val, hash, less, equal_to, std::mutex > StdHashSet_Mutex; + typedef StdHashSet< key_val, hash, less, equal_to, lock::NoLock > StdHashSet_NoLock; + }; + +} // namespace set2 + +#endif // #ifndef CDSUNIT_SET_TYPE_STD_H diff --git a/test/stress/set/set_type_striped.h b/test/stress/set/set_type_striped.h new file mode 100644 index 00000000..797a4334 --- /dev/null +++ b/test/stress/set/set_type_striped.h @@ -0,0 +1,619 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef CDSUNIT_SET_TYPE_STRIPED_H +#define CDSUNIT_SET_TYPE_STRIPED_H + +#include "set2/set_type.h" + +#include +#include +#include +#include +#include + +#include +#if BOOST_VERSION >= 104800 +# include +# include +# include +# include +# include +# include +#endif +#include + +namespace set2 { + + struct tag_StripedSet; + + template + 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; + typedef typename base_class::compare compare; + typedef typename base_class::less less; + typedef typename base_class::equal_to equal_to; + typedef typename base_class::hash hash; + typedef typename base_class::hash2 hash2; + + + // *************************************************************************** + // StripedSet + + // for sequential containers + template + class StripedHashSet_seq: + public cc::StripedSet< BucketEntry, + co::mutex_policy< cc::striped_set::striping<> > + ,co::resizing_policy > + , Options... + > + { + typedef cc::StripedSet< BucketEntry, + co::mutex_policy< cc::striped_set::striping<> > + ,co::resizing_policy > + , Options... + > base_class; + typedef typename base_class::resizing_policy resizing_policy_t; + + resizing_policy_t m_placeHolder; + public: + template + StripedHashSet_seq( Config const& cfg ) + : base_class( cfg.c_nSetSize / cfg.c_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nLoadFactor )) ) + {} + + /* + template + 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; + static CDS_CONSTEXPR bool const c_bEraseExactKey = false; + }; + + template + class StripedHashSet_seq_rational: + public cc::StripedSet< BucketEntry, + co::mutex_policy< cc::striped_set::striping<> > + ,co::resizing_policy > + , Options... + > + { + typedef cc::StripedSet< BucketEntry, + co::mutex_policy< cc::striped_set::striping<> > + ,co::resizing_policy > + , Options... + > base_class; + typedef typename base_class::resizing_policy resizing_policy_t; + + resizing_policy_t m_placeHolder; + public: + template + 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 + 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; + static CDS_CONSTEXPR bool const c_bEraseExactKey = false; + }; + + // for non-sequential ordered containers + template + class StripedHashSet_ord: + public cc::StripedSet< BucketEntry, + co::resizing_policy > + ,co::mutex_policy< cc::striped_set::striping<> > + , Options... + > + { + typedef cc::StripedSet< BucketEntry, + co::resizing_policy > + ,co::mutex_policy< cc::striped_set::striping<> > + , Options... + > base_class; + typedef typename base_class::resizing_policy resizing_policy_t; + + resizing_policy_t m_placeHolder; + public: + template + StripedHashSet_ord( Config const& cfg ) + : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nMaxLoadFactor * 1024 )) ) + {} + + /* + template + 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; + static CDS_CONSTEXPR bool const c_bEraseExactKey = false; + }; + + template + class StripedHashSet_ord_rational: + public cc::StripedSet< BucketEntry, + co::resizing_policy > + ,co::mutex_policy< cc::striped_set::striping<> > + , Options... + > + { + typedef cc::StripedSet< BucketEntry, + co::resizing_policy > + ,co::mutex_policy< cc::striped_set::striping<> > + , Options... + > base_class; + typedef typename base_class::resizing_policy resizing_policy_t; + + resizing_policy_t m_placeHolder; + public: + template + StripedHashSet_ord_rational( Config const& cfg ) // LoadFactor = 1 / nDenominator + : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( 1024, cfg.c_nLoadFactor ))) + {} + + /* + template + 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; + static CDS_CONSTEXPR bool const c_bEraseExactKey = false; + }; + + typedef StripedHashSet_seq< + std::list< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_list; + + typedef StripedHashSet_seq_rational< + std::list< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_rational_list; + + typedef StripedHashSet_seq< + std::vector< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_vector; + + typedef StripedHashSet_seq_rational< + std::vector< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_rational_vector; + +#if BOOST_VERSION >= 104800 + typedef StripedHashSet_seq< + boost::container::slist< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_boost_slist; + + typedef StripedHashSet_seq_rational< + boost::container::slist< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_rational_boost_slist; + + typedef StripedHashSet_seq< + boost::container::list< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_boost_list; + + typedef StripedHashSet_seq_rational< + boost::container::list< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_rational_boost_list; + + typedef StripedHashSet_seq< + boost::container::vector< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_boost_vector; + + typedef StripedHashSet_seq_rational< + boost::container::vector< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_rational_boost_vector; + + typedef StripedHashSet_seq< + boost::container::stable_vector< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_boost_stable_vector; + + typedef StripedHashSet_seq_rational< + boost::container::stable_vector< key_val > + , co::hash< hash2 > + , co::less< less > + > StripedSet_rational_boost_stable_vector; +#endif + + typedef StripedHashSet_ord< + std::set< key_val, less > + , co::hash< hash2 > + > StripedSet_set; + + typedef StripedHashSet_ord_rational< + std::set< key_val, less > + , co::hash< hash2 > + > StripedSet_rational_set; + + typedef StripedHashSet_ord< + std::unordered_set< key_val, hash, equal_to > + , co::hash< hash2 > + > StripedSet_hashset; + + typedef StripedHashSet_ord_rational< + std::unordered_set< key_val, hash, equal_to > + , co::hash< hash2 > + > StripedSet_rational_hashset; + +#if BOOST_VERSION >= 104800 + typedef StripedHashSet_ord< + boost::container::set< key_val, less > + , co::hash< hash2 > + > StripedSet_boost_set; + + typedef StripedHashSet_ord_rational< + boost::container::set< key_val, less > + , co::hash< hash2 > + > StripedSet_rational_boost_set; + + typedef StripedHashSet_ord< + boost::container::flat_set< key_val, less > + , co::hash< hash2 > + > StripedSet_boost_flat_set; + + typedef StripedHashSet_ord_rational< + boost::container::flat_set< key_val, less > + , co::hash< hash2 > + > StripedSet_rational_boost_flat_set; +#endif + + typedef StripedHashSet_ord< + boost::unordered_set< key_val, hash, equal_to > + , co::hash< hash2 > + > StripedSet_boost_unordered_set; + + typedef StripedHashSet_ord_rational< + boost::unordered_set< key_val, hash, equal_to > + , co::hash< hash2 > + > StripedSet_rational_boost_unordered_set; + + + // *************************************************************************** + // RefinableSet + + // for sequential containers + template + class RefinableHashSet_seq: + public cc::StripedSet< BucketEntry, + co::mutex_policy< cc::striped_set::refinable<> > + ,co::resizing_policy > + , Options... + > + { + typedef cc::StripedSet< BucketEntry, + co::mutex_policy< cc::striped_set::refinable<> > + ,co::resizing_policy > + , Options... + > base_class; + typedef typename base_class::resizing_policy resizing_policy_t; + + resizing_policy_t m_placeHolder; + public: + template + RefinableHashSet_seq( Config const& cfg ) + : base_class( cfg.c_nSetSize / cfg.c_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nLoadFactor )) ) + {} + + /* + template + 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 RefinableHashSet_seq_rational: + public cc::StripedSet< BucketEntry, + co::mutex_policy< cc::striped_set::refinable<> > + ,co::resizing_policy > + , Options... + > + { + typedef cc::StripedSet< BucketEntry, + co::mutex_policy< cc::striped_set::refinable<> > + ,co::resizing_policy > + , Options... + > base_class; + typedef typename base_class::resizing_policy resizing_policy_t; + + resizing_policy_t m_placeHolder; + public: + template + 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 + 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 + template + class RefinableHashSet_ord: + public cc::StripedSet< BucketEntry, + co::resizing_policy > + ,co::mutex_policy< cc::striped_set::refinable<> > + , Options... + > + { + typedef cc::StripedSet< BucketEntry, + co::resizing_policy > + ,co::mutex_policy< cc::striped_set::refinable<> > + , Options... + > base_class; + typedef typename base_class::resizing_policy resizing_policy_t; + + resizing_policy_t m_placeHolder; + public: + template + RefinableHashSet_ord( Config const& cfg ) + : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.c_nMaxLoadFactor * 1024 )) ) + {} + + /* + template + 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 RefinableHashSet_ord_rational: + public cc::StripedSet< BucketEntry, + co::resizing_policy > + ,co::mutex_policy< cc::striped_set::refinable<> > + , Options... + > + { + typedef cc::StripedSet< BucketEntry, + co::resizing_policy > + ,co::mutex_policy< cc::striped_set::refinable<> > + , Options... + > base_class; + typedef typename base_class::resizing_policy resizing_policy_t; + + resizing_policy_t m_placeHolder; + public: + template + RefinableHashSet_ord_rational( Config const& cfg ) // LoadFactor = 1 / nDenominator + : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( 1024, cfg.c_nLoadFactor ))) + {} + + /* + template + 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< + std::list< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_list; + + typedef RefinableHashSet_seq_rational< + std::list< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_rational_list; + + typedef RefinableHashSet_seq< + std::vector< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_vector; + + typedef RefinableHashSet_seq_rational< + std::vector< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_rational_vector; + +#if BOOST_VERSION >= 104800 + typedef RefinableHashSet_seq< + boost::container::slist< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_boost_slist; + + typedef RefinableHashSet_seq_rational< + boost::container::slist< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_rational_boost_slist; + + typedef RefinableHashSet_seq< + boost::container::list< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_boost_list; + + typedef RefinableHashSet_seq_rational< + boost::container::list< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_rational_boost_list; + + typedef RefinableHashSet_seq< + boost::container::vector< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_boost_vector; + + typedef RefinableHashSet_seq_rational< + boost::container::vector< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_rational_boost_vector; + + typedef RefinableHashSet_seq< + boost::container::stable_vector< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_boost_stable_vector; + + typedef RefinableHashSet_seq_rational< + boost::container::stable_vector< key_val > + , co::hash< hash2 > + , co::less< less > + > RefinableSet_rational_boost_stable_vector; +#endif + + typedef RefinableHashSet_ord< + std::set< key_val, less > + , co::hash< hash2 > + > RefinableSet_set; + + typedef RefinableHashSet_ord_rational< + std::set< key_val, less > + , co::hash< hash2 > + > RefinableSet_rational_set; + + typedef RefinableHashSet_ord< + std::unordered_set< key_val, hash, equal_to > + , co::hash< hash2 > + > RefinableSet_hashset; + + typedef RefinableHashSet_ord_rational< + std::unordered_set< key_val, hash, equal_to > + , co::hash< hash2 > + > RefinableSet_rational_hashset; + +#if BOOST_VERSION >= 104800 + typedef RefinableHashSet_ord< + boost::container::set< key_val, less > + , co::hash< hash2 > + > RefinableSet_boost_set; + + typedef RefinableHashSet_ord_rational< + boost::container::set< key_val, less > + , co::hash< hash2 > + > RefinableSet_rational_boost_set; + + typedef RefinableHashSet_ord< + boost::container::flat_set< key_val, less > + , co::hash< hash2 > + > RefinableSet_boost_flat_set; + + typedef RefinableHashSet_ord_rational< + boost::container::flat_set< key_val, less > + , co::hash< hash2 > + > RefinableSet_rational_boost_flat_set; +#endif + + typedef RefinableHashSet_ord< + boost::unordered_set< key_val, hash, equal_to > + , co::hash< hash2 > + > RefinableSet_boost_unordered_set; + + typedef RefinableHashSet_ord_rational< + boost::unordered_set< key_val, hash, equal_to > + , co::hash< hash2 > + > RefinableSet_rational_boost_unordered_set; + }; + +} // namespace set2 + +#endif // #ifndef CDSUNIT_SET_TYPE_STRIPED_H -- 2.34.1