From 841156510f66ef0f40f1657ddff2591a5fb7d24b Mon Sep 17 00:00:00 2001 From: khizmax Date: Sun, 22 May 2016 12:07:31 +0300 Subject: [PATCH] Migrated map-find-string stress test to gtest --- .gitignore | 1 + projects/Win/vc14/cds.sln | 34 +- .../Win/vc14/stress-map-find_string.vcxproj | 287 +++++++++++++++ .../stress-map-find_string.vcxproj.filters | 60 ++++ projects/Win/vc14/unit-map-delodd.vcxproj | 328 ------------------ projects/Win/vc14/unit-map-find.vcxproj | 22 -- .../Win/vc14/unit-map-find.vcxproj.filters | 72 ---- projects/source.unit.map.mk | 10 - test/include/cds_test/hash_func.h | 21 +- test/stress/data/test-debug.conf | 4 +- test/stress/data/test-express.conf | 4 +- test/stress/data/test.conf | 6 +- test/stress/map/CMakeLists.txt | 2 + test/stress/map/find_string/CMakeLists.txt | 31 ++ .../map/find_string/map_find_string.cpp | 199 +++++++++++ test/stress/map/find_string/map_find_string.h | 286 +++++++++++++++ .../map_find_string_bronsonavltree.cpp | 38 ++ .../find_string/map_find_string_cuckoo.cpp | 41 +++ .../find_string/map_find_string_ellentree.cpp | 38 ++ .../map_find_string_feldman_hashset.cpp | 42 +++ .../find_string/map_find_string_michael.cpp | 39 +++ .../map/find_string/map_find_string_skip.cpp | 39 +++ .../map/find_string/map_find_string_split.cpp | 39 +++ .../map/find_string/map_find_string_std.cpp | 39 +++ .../find_string/map_find_string_striped.cpp | 38 ++ test/stress/map/map_type_cuckoo.h | 126 +++++++ test/stress/map/map_type_feldman_hashmap.h | 31 +- 27 files changed, 1401 insertions(+), 476 deletions(-) create mode 100644 projects/Win/vc14/stress-map-find_string.vcxproj create mode 100644 projects/Win/vc14/stress-map-find_string.vcxproj.filters delete mode 100644 projects/Win/vc14/unit-map-delodd.vcxproj create mode 100644 test/stress/map/find_string/CMakeLists.txt create mode 100644 test/stress/map/find_string/map_find_string.cpp create mode 100644 test/stress/map/find_string/map_find_string.h create mode 100644 test/stress/map/find_string/map_find_string_bronsonavltree.cpp create mode 100644 test/stress/map/find_string/map_find_string_cuckoo.cpp create mode 100644 test/stress/map/find_string/map_find_string_ellentree.cpp create mode 100644 test/stress/map/find_string/map_find_string_feldman_hashset.cpp create mode 100644 test/stress/map/find_string/map_find_string_michael.cpp create mode 100644 test/stress/map/find_string/map_find_string_skip.cpp create mode 100644 test/stress/map/find_string/map_find_string_split.cpp create mode 100644 test/stress/map/find_string/map_find_string_std.cpp create mode 100644 test/stress/map/find_string/map_find_string_striped.cpp diff --git a/.gitignore b/.gitignore index eb8ee396..63d79f25 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ /projects/Win/vc14/*.opendb /test/stress/data/dictionary.txt /projects/Win/vc14/cds.VC.db +/todo-2.2.txt diff --git a/projects/Win/vc14/cds.sln b/projects/Win/vc14/cds.sln index a36390d6..51c0350f 100644 --- a/projects/Win/vc14/cds.sln +++ b/projects/Win/vc14/cds.sln @@ -48,12 +48,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "map", "map", "{6BB7A27F-FC5 ..\..\..\tests\unit\map2\std_map.h = ..\..\..\tests\unit\map2\std_map.h EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit-map-delodd", "unit-map-delodd.vcxproj", "{3C598F96-FB84-4D42-9B43-F697F53B0221}" - ProjectSection(ProjectDependencies) = postProject - {61179F2F-07E1-490D-B64D-D85A90B6EF81} = {61179F2F-07E1-490D-B64D-D85A90B6EF81} - {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit-map-find", "unit-map-find.vcxproj", "{BA2A9239-0299-4069-BB0E-16DACE87ADE0}" ProjectSection(ProjectDependencies) = postProject {61179F2F-07E1-490D-B64D-D85A90B6EF81} = {61179F2F-07E1-490D-B64D-D85A90B6EF81} @@ -231,6 +225,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress-map-delodd", "stress EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress-map-find_int", "stress-map-find_int.vcxproj", "{3F36B97B-8028-4335-ADDD-20B6B81F87AF}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress-map-find_string", "stress-map-find_string.vcxproj", "{C127CD80-E8A7-47E4-B7EC-1709D2188982}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -277,18 +273,6 @@ Global {77350FDC-9E51-438B-9A8F-D2FEA11D46B2}.Release|Win32.Build.0 = Release|Win32 {77350FDC-9E51-438B-9A8F-D2FEA11D46B2}.Release|x64.ActiveCfg = Release|x64 {77350FDC-9E51-438B-9A8F-D2FEA11D46B2}.Release|x64.Build.0 = Release|x64 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.Debug|Win32.ActiveCfg = Debug|Win32 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.Debug|Win32.Build.0 = Debug|Win32 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.Debug|x64.ActiveCfg = Debug|x64 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.Debug|x64.Build.0 = Debug|x64 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.DebugVLD|Win32.ActiveCfg = DebugVLD|Win32 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.DebugVLD|Win32.Build.0 = DebugVLD|Win32 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.DebugVLD|x64.ActiveCfg = DebugVLD|x64 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.DebugVLD|x64.Build.0 = DebugVLD|x64 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.Release|Win32.ActiveCfg = Release|Win32 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.Release|Win32.Build.0 = Release|Win32 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.Release|x64.ActiveCfg = Release|x64 - {3C598F96-FB84-4D42-9B43-F697F53B0221}.Release|x64.Build.0 = Release|x64 {BA2A9239-0299-4069-BB0E-16DACE87ADE0}.Debug|Win32.ActiveCfg = Debug|Win32 {BA2A9239-0299-4069-BB0E-16DACE87ADE0}.Debug|Win32.Build.0 = Debug|Win32 {BA2A9239-0299-4069-BB0E-16DACE87ADE0}.Debug|x64.ActiveCfg = Debug|x64 @@ -601,6 +585,18 @@ Global {3F36B97B-8028-4335-ADDD-20B6B81F87AF}.Release|Win32.Build.0 = Release|Win32 {3F36B97B-8028-4335-ADDD-20B6B81F87AF}.Release|x64.ActiveCfg = Release|x64 {3F36B97B-8028-4335-ADDD-20B6B81F87AF}.Release|x64.Build.0 = Release|x64 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.Debug|Win32.ActiveCfg = Debug|Win32 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.Debug|Win32.Build.0 = Debug|Win32 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.Debug|x64.ActiveCfg = Debug|x64 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.Debug|x64.Build.0 = Debug|x64 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.DebugVLD|Win32.ActiveCfg = DebugVLD|Win32 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.DebugVLD|Win32.Build.0 = DebugVLD|Win32 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.DebugVLD|x64.ActiveCfg = DebugVLD|x64 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.DebugVLD|x64.Build.0 = DebugVLD|x64 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.Release|Win32.ActiveCfg = Release|Win32 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.Release|Win32.Build.0 = Release|Win32 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.Release|x64.ActiveCfg = Release|x64 + {C127CD80-E8A7-47E4-B7EC-1709D2188982}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -609,7 +605,6 @@ Global {61179F2F-07E1-490D-B64D-D85A90B6EF81} = {B30CA283-1796-4763-92C3-2E4848D443F7} {77350FDC-9E51-438B-9A8F-D2FEA11D46B2} = {B30CA283-1796-4763-92C3-2E4848D443F7} {6BB7A27F-FC59-4267-B6FA-D034176D1459} = {B30CA283-1796-4763-92C3-2E4848D443F7} - {3C598F96-FB84-4D42-9B43-F697F53B0221} = {6BB7A27F-FC59-4267-B6FA-D034176D1459} {BA2A9239-0299-4069-BB0E-16DACE87ADE0} = {6BB7A27F-FC59-4267-B6FA-D034176D1459} {CA25BDBF-B354-4597-B6D2-220ABBB0D2F4} = {6BB7A27F-FC59-4267-B6FA-D034176D1459} {7521DD92-56FF-4ECA-93E5-CCE50862354B} = {6BB7A27F-FC59-4267-B6FA-D034176D1459} @@ -640,6 +635,7 @@ Global {2C41747C-6CC6-4AE8-9EB8-EB8B954BBDB4} = {7D3EE35B-185D-40B5-88C2-7F9933426978} {DD432BE7-0CA8-47C6-B861-943A036C18EF} = {7D3EE35B-185D-40B5-88C2-7F9933426978} {3F36B97B-8028-4335-ADDD-20B6B81F87AF} = {7D3EE35B-185D-40B5-88C2-7F9933426978} + {C127CD80-E8A7-47E4-B7EC-1709D2188982} = {7D3EE35B-185D-40B5-88C2-7F9933426978} EndGlobalSection GlobalSection(DPCodeReviewSolutionGUID) = preSolution DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} diff --git a/projects/Win/vc14/stress-map-find_string.vcxproj b/projects/Win/vc14/stress-map-find_string.vcxproj new file mode 100644 index 00000000..35c63181 --- /dev/null +++ b/projects/Win/vc14/stress-map-find_string.vcxproj @@ -0,0 +1,287 @@ + + + + + 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 + 4503 + 4503 + 4503 + 4503 + + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + + + + + + + + {C127CD80-E8A7-47E4-B7EC-1709D2188982} + Win32Proj + stress_map_find_string + 8.1 + stress-map-find_string + + + + 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\map;$(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\map;$(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\map;$(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\map;$(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\map;$(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\map;$(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-map-find_string.vcxproj.filters b/projects/Win/vc14/stress-map-find_string.vcxproj.filters new file mode 100644 index 00000000..4d4f2b62 --- /dev/null +++ b/projects/Win/vc14/stress-map-find_string.vcxproj.filters @@ -0,0 +1,60 @@ + + + + + {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 + + + Source Files + + + Source Files + + + Source Files + + + + + + + + Header Files + + + \ No newline at end of file diff --git a/projects/Win/vc14/unit-map-delodd.vcxproj b/projects/Win/vc14/unit-map-delodd.vcxproj deleted file mode 100644 index 57b036c2..00000000 --- a/projects/Win/vc14/unit-map-delodd.vcxproj +++ /dev/null @@ -1,328 +0,0 @@ - - - - - DebugVLD - Win32 - - - DebugVLD - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - - - false - - - false - - - false - - - false - - - - false - - - false - - - - - - - {3C598F96-FB84-4d42-9B43-F697F53B0221} - unitmap - Win32Proj - 8.1 - - - - Application - Unicode - true - v140 - - - Application - Unicode - v140 - - - Application - Unicode - v140 - - - Application - Unicode - true - v140 - - - Application - Unicode - v140 - - - Application - Unicode - v140 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - false - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - $(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\ - false - 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)\ - false - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - - - AllRules.ruleset - - - $(ProjectName)_d - $(ProjectName)_d - $(ProjectName)_d - $(ProjectName)_d - - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - _SCL_SECURE_NO_WARNINGS;WIN32;NOMINMAX;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - MachineX86 - MultiplyDefinedSymbolOnly - - - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - _SCL_SECURE_NO_WARNINGS;CDS_USE_VLD;WIN32;NOMINMAX;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - MachineX86 - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - _SCL_SECURE_NO_WARNINGS;WIN32;NOMINMAX;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - MachineX64 - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - Disabled - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - _SCL_SECURE_NO_WARNINGS;CDS_USE_VLD;WIN32;NOMINMAX;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - 4520 - - - unit-prerequisites_d.lib;%(AdditionalDependencies) - $(TargetPath) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - MachineX64 - MultiplyDefinedSymbolOnly - - - - - /bigobj /Zc:inline %(AdditionalOptions) - MaxSpeed - AnySuitable - true - Speed - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - _SCL_SECURE_NO_WARNINGS;WIN32;NOMINMAX;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - 4520 - - - unit-prerequisites.lib;%(AdditionalDependencies) - $(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - true - true - MachineX86 - $(TargetPath) - MultiplyDefinedSymbolOnly - - - - - X64 - - - /bigobj /Zc:inline %(AdditionalOptions) - MaxSpeed - AnySuitable - true - Speed - $(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories) - _SCL_SECURE_NO_WARNINGS;WIN32;NOMINMAX;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - 4520 - - - unit-prerequisites.lib;%(AdditionalDependencies) - $(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories) - true - Console - true - true - MachineX64 - $(TargetPath) - MultiplyDefinedSymbolOnly - - - - - - \ No newline at end of file diff --git a/projects/Win/vc14/unit-map-find.vcxproj b/projects/Win/vc14/unit-map-find.vcxproj index 6bb55979..c97d6f08 100644 --- a/projects/Win/vc14/unit-map-find.vcxproj +++ b/projects/Win/vc14/unit-map-find.vcxproj @@ -27,26 +27,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -59,8 +39,6 @@ - - diff --git a/projects/Win/vc14/unit-map-find.vcxproj.filters b/projects/Win/vc14/unit-map-find.vcxproj.filters index bb9c849a..2d78482c 100644 --- a/projects/Win/vc14/unit-map-find.vcxproj.filters +++ b/projects/Win/vc14/unit-map-find.vcxproj.filters @@ -1,60 +1,6 @@  - - map_find_int - - - map_find_int - - - map_find_int - - - map_find_int - - - map_find_int - - - map_find_int - - - map_find_int - - - map_find_int - - - map_find_int - - - map_find_string - - - map_find_string - - - map_find_string - - - map_find_string - - - map_find_string - - - map_find_string - - - map_find_string - - - map_find_string - - - map_find_string - map_insfind_int @@ -82,34 +28,16 @@ map_insfind_int - - map_find_int - - - map_find_string - map_insfind_int - - map_find_int - - - map_find_string - map_insfind_int - - {05793356-5544-4e12-893f-5761dea6536e} - - - {c6ad8146-72e2-473c-aa04-3db455858146} - {ba26fa2b-d618-4dd8-97d6-7dc874d9acf4} diff --git a/projects/source.unit.map.mk b/projects/source.unit.map.mk index cfe0ed60..a54fbde3 100644 --- a/projects/source.unit.map.mk +++ b/projects/source.unit.map.mk @@ -1,15 +1,5 @@ CDSUNIT_MAP_SOURCES := \ - tests/unit/map2/map_find_string.cpp \ - tests/unit/map2/map_find_string_bronsonavltree.cpp \ - tests/unit/map2/map_find_string_cuckoo.cpp \ - tests/unit/map2/map_find_string_ellentree.cpp \ - tests/unit/map2/map_find_string_michael.cpp \ - tests/unit/map2/map_find_string_feldmanhashmap.cpp \ - tests/unit/map2/map_find_string_skip.cpp \ - tests/unit/map2/map_find_string_split.cpp \ - tests/unit/map2/map_find_string_striped.cpp \ - tests/unit/map2/map_find_string_std.cpp \ tests/unit/map2/map_insfind_int.cpp \ tests/unit/map2/map_insfind_int_bronsonavltree.cpp \ tests/unit/map2/map_insfind_int_cuckoo.cpp \ diff --git a/test/include/cds_test/hash_func.h b/test/include/cds_test/hash_func.h index 0595b1c5..9f1b9515 100644 --- a/test/include/cds_test/hash_func.h +++ b/test/include/cds_test/hash_func.h @@ -15,19 +15,20 @@ namespace cds_test { class city32 { public: typedef uint32_t hash_type; + typedef hash_type result_type; - hash_type operator()( void const * pBuf, size_t len ) + hash_type operator()( void const * pBuf, size_t len ) const { return CityHash32( reinterpret_cast( pBuf ), len ); } - hash_type operator()( std::string const& s ) + hash_type operator()( std::string const& s ) const { return CityHash32( s.c_str(), s.length() ); } template - hash_type operator()( T const& s ) + hash_type operator()( T const& s ) const { return CityHash32( reinterpret_cast( &s ), sizeof(s)); } @@ -44,19 +45,20 @@ namespace cds_test { class city64 { public: typedef uint64_t hash_type; + typedef hash_type result_type; - hash_type operator()( void const * pBuf, size_t len ) + hash_type operator()( void const * pBuf, size_t len ) const { return CityHash64( reinterpret_cast( pBuf ), len ); } - hash_type operator()( std::string const& s ) + hash_type operator()( std::string const& s ) const { return CityHash64( s.c_str(), s.length() ); } template - hash_type operator()( T const& s ) + hash_type operator()( T const& s ) const { return CityHash64( reinterpret_cast( &s ), sizeof(s)); } @@ -73,19 +75,20 @@ namespace cds_test { class city128 { public: typedef uint128 hash_type; + typedef hash_type result_type; - hash_type operator()( void const * pBuf, size_t len ) + hash_type operator()( void const * pBuf, size_t len ) const { return CityHash128( reinterpret_cast( pBuf ), len ); } - hash_type operator()( std::string const& s ) + hash_type operator()( std::string const& s ) const { return CityHash128( s.c_str(), s.length() ); } template - hash_type operator()( T const& s ) + hash_type operator()( T const& s ) const { return CityHash128( reinterpret_cast( &s ), sizeof(s)); } diff --git a/test/stress/data/test-debug.conf b/test/stress/data/test-debug.conf index f49868f9..edd7e37e 100644 --- a/test/stress/data/test-debug.conf +++ b/test/stress/data/test-debug.conf @@ -182,13 +182,13 @@ CuckooProbesetThreshold=0 FeldmanMapHeadBits=8 FeldmanMapArrayBits=4 -[Map_find_string] +[map_find_string] ThreadCount=2 MapSize=10000 PercentExists=50 PassCount=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 3450eaf5..25ec4450 100644 --- a/test/stress/data/test-express.conf +++ b/test/stress/data/test-express.conf @@ -176,13 +176,13 @@ CuckooProbesetThreshold=0 FeldmanMapHeadBits=8 FeldmanMapArrayBits=4 -[Map_find_string] +[map_find_string] ThreadCount=8 MapSize=100000 PercentExists=50 PassCount=2 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 0b3d3dcc..6e61bad3 100644 --- a/test/stress/data/test.conf +++ b/test/stress/data/test.conf @@ -175,13 +175,13 @@ CuckooProbesetThreshold=0 FeldmanMapHeadBits=10 FeldmanMapArrayBits=4 -[Map_find_string] +[map_find_string] ThreadCount=8 MapSize=2000000 PercentExists=50 -PassCount=1 +PassCount=2 MaxLoadFactor=4 -PrintGCStateFlag=1 + # *** Cuckoo map properties CuckooInitialSize=1024 CuckooProbesetSize=16 diff --git a/test/stress/map/CMakeLists.txt b/test/stress/map/CMakeLists.txt index 1f821d07..b1e9c1c6 100644 --- a/test/stress/map/CMakeLists.txt +++ b/test/stress/map/CMakeLists.txt @@ -3,6 +3,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCDSUNIT_USE_URCU") add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/delodd) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/find_int) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/find_string) #add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdel_find) #add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdel_func) #add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/insdel_string) @@ -11,4 +12,5 @@ add_custom_target( stress-map DEPENDS stress-map-delodd stress-map-find-int + stress-map-find-string ) diff --git a/test/stress/map/find_string/CMakeLists.txt b/test/stress/map/find_string/CMakeLists.txt new file mode 100644 index 00000000..784bec30 --- /dev/null +++ b/test/stress/map/find_string/CMakeLists.txt @@ -0,0 +1,31 @@ +set(PACKAGE_NAME stress-map-find-string) + +set(CDSSTRESS_MAP_FIND_STRING_SOURCES + ../../main.cpp + map_find_string.cpp + map_find_string_bronsonavltree.cpp + map_find_string_cuckoo.cpp + map_find_string_ellentree.cpp + map_find_string_feldman_hashset.cpp + map_find_string_michael.cpp + map_find_string_skip.cpp + map_find_string_split.cpp + map_find_string_std.cpp + map_find_string_striped.cpp +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. +) + +add_executable(${PACKAGE_NAME} ${CDSSTRESS_MAP_FIND_STRING_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/map/find_string/map_find_string.cpp b/test/stress/map/find_string/map_find_string.cpp new file mode 100644 index 00000000..068dd888 --- /dev/null +++ b/test/stress/map/find_string/map_find_string.cpp @@ -0,0 +1,199 @@ +/* + 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 "map_find_string.h" +#include + +namespace map { + + size_t Map_find_string::s_nThreadCount = 8; + size_t Map_find_string::s_nMapSize = 10000000; + size_t Map_find_string::s_nMaxLoadFactor = 8; + size_t Map_find_string::s_nPercentExists = 50; + size_t Map_find_string::s_nPassCount = 2; + + size_t Map_find_string::s_nCuckooInitialSize = 1024; + size_t Map_find_string::s_nCuckooProbesetSize = 16; + size_t Map_find_string::s_nCuckooProbesetThreshold = 0; + + size_t Map_find_string::s_nFeldmanMap_HeadBits = 10; + size_t Map_find_string::s_nFeldmanMap_ArrayBits = 4; + + + size_t Map_find_string::s_nLoadFactor = 1; + Map_find_string::value_vector Map_find_string::s_Data; + std::vector Map_find_string::s_arrString; + + void Map_find_string::setup_test_case() + { + cds_test::config const& cfg = get_config( "map_find_string" ); + + s_nMapSize = cfg.get_size_t( "MapSize", s_nMapSize ); + if ( s_nMapSize < 1000 ) + s_nMapSize = 1000; + + s_nThreadCount = cfg.get_size_t( "ThreadCount", s_nThreadCount ); + if ( s_nThreadCount == 0 ) + s_nThreadCount = 1; + + s_nPercentExists = cfg.get_size_t( "PercentExists", s_nPercentExists ); + if ( s_nPercentExists > 100 ) + s_nPercentExists = 100; + else if ( s_nPercentExists < 1 ) + s_nPercentExists = 1; + + s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor ); + if ( s_nMaxLoadFactor == 0 ) + s_nMaxLoadFactor = 1; + + s_nCuckooInitialSize = cfg.get_size_t( "CuckooInitialSize", s_nCuckooInitialSize ); + if ( s_nCuckooInitialSize < 256 ) + s_nCuckooInitialSize = 256; + + s_nCuckooProbesetSize = cfg.get_size_t( "CuckooProbesetSize", s_nCuckooProbesetSize ); + if ( s_nCuckooProbesetSize < 8 ) + s_nCuckooProbesetSize = 8; + + s_nCuckooProbesetThreshold = cfg.get_size_t( "CuckooProbesetThreshold", s_nCuckooProbesetThreshold ); + + s_nFeldmanMap_HeadBits = cfg.get_size_t( "FeldmanMapHeadBits", s_nFeldmanMap_HeadBits ); + if ( s_nFeldmanMap_HeadBits == 0 ) + s_nFeldmanMap_HeadBits = 2; + + s_nFeldmanMap_ArrayBits = cfg.get_size_t( "FeldmanMapArrayBits", s_nFeldmanMap_ArrayBits ); + if ( s_nFeldmanMap_ArrayBits == 0 ) + s_nFeldmanMap_ArrayBits = 2; + + s_arrString = load_dictionary(); + } + + void Map_find_string::TearDownTestCase() + { + s_arrString.clear(); + s_Data.clear(); + } + + void Map_find_string::SetUpTestCase() + { + setup_test_case(); + + s_Data.clear(); + + size_t nSize = s_arrString.size(); + if ( nSize > s_nMapSize ) + nSize = s_nMapSize; + s_Data.reserve( nSize ); + + size_t nActualSize = 0; + for ( size_t i = 0; i < nSize; ++i ) { + bool bExists = rand( 100 ) <= s_nPercentExists; + if ( bExists ) + ++nActualSize; + s_Data.push_back( { &s_arrString.at( i ), bExists } ); + } + s_nMapSize = nActualSize; + } + + template + void Map_find_string::fill_string_array() + { + typedef Hash hasher; + typedef typename hasher::result_type hash_type; + + std::map mapHash; + s_Data.clear(); + + size_t nSize = s_arrString.size(); + if ( nSize > s_nMapSize ) + nSize = s_nMapSize; + s_Data.reserve( nSize ); + + size_t nActualSize = 0; + size_t nDiffHash = 0; + hasher h; + for ( size_t i = 0; i < s_arrString.size(); ++i ) { + hash_type hash = h( s_arrString.at( i )); + if ( mapHash.insert( std::make_pair( hash, i ) ).second ) { + if ( ++nDiffHash >= nSize ) + break; + bool bExists = rand( 100 ) <= s_nPercentExists; + if ( bExists ) + ++nActualSize; + s_Data.push_back( { &s_arrString.at( i ), bExists } ); + } + } + s_nMapSize = nActualSize; + + } + + void Map_find_string_stdhash::SetUpTestCase() + { + setup_test_case(); + fill_string_array>(); + } + +#if CDS_BUILD_BITS == 64 + void Map_find_string_city32::SetUpTestCase() + { + setup_test_case(); + fill_string_array(); + } + + void Map_find_string_city64::SetUpTestCase() + { + setup_test_case(); + fill_string_array(); + } + + void Map_find_string_city128::SetUpTestCase() + { + setup_test_case(); + fill_string_array(); + } + +#endif + + std::vector Map_find_string::get_load_factors() + { + cds_test::config const& cfg = get_config( "map_find_string" ); + + 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, Map_find_string_LF, ::testing::ValuesIn( Map_find_string::get_load_factors() ) ); +} // namespace map diff --git a/test/stress/map/find_string/map_find_string.h b/test/stress/map/find_string/map_find_string.h new file mode 100644 index 00000000..056c2cb0 --- /dev/null +++ b/test/stress/map/find_string/map_find_string.h @@ -0,0 +1,286 @@ +/* + 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 "map_type.h" + +namespace map { + + class Map_find_string: public cds_test::stress_fixture + { + public: + static size_t s_nThreadCount; // thread count + static size_t s_nMapSize; // map size (count of searching item) + static size_t s_nPercentExists; // percent of existing keys in searching sequence + static size_t s_nPassCount; + static size_t s_nMaxLoadFactor; // maximum load factor + + static size_t s_nCuckooInitialSize; // initial size for CuckooMap + static size_t s_nCuckooProbesetSize; // CuckooMap probeset size (only for list-based probeset) + static size_t s_nCuckooProbesetThreshold; // CUckooMap probeset threshold (o - use default) + + static size_t s_nFeldmanMap_HeadBits; + static size_t s_nFeldmanMap_ArrayBits; + + static size_t s_nLoadFactor; // current load factor + + typedef std::string key_type; + struct value_type { + std::string const* pKey; + bool bExists ; // true - key in map, false - key not in map + }; + + typedef std::vector value_vector; + static std::vector s_arrString; + static value_vector s_Data; + + static void SetUpTestCase(); + static void TearDownTestCase(); + + static void setup_test_case(); + static std::vector get_load_factors(); + + private: + template + static bool check_result( Iterator const& it, Map const& map ) + { + return it != map.end(); + } + template + static bool check_result( bool b, Map const& ) + { + return b; + } + + template + class Worker: public cds_test::thread + { + typedef cds_test::thread base_class; + Map& m_Map; + + public: + struct Stat { + size_t nSuccess = 0; + size_t nFailed = 0; + }; + + Stat m_KeyExists; + Stat m_KeyNotExists; + + public: + Worker( cds_test::thread_pool& pool, Map& map ) + : base_class( pool ) + , m_Map( map ) + {} + + Worker( Worker& src ) + : base_class( src ) + , m_Map( src.m_Map ) + {} + + virtual thread * clone() + { + return new Worker( *this ); + } + virtual void test() + { + size_t const nPassCount = s_nPassCount; + + Map& rMap = m_Map; + for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) { + if ( id() & 1 ) { + auto itEnd = s_Data.cend(); + for ( auto it = s_Data.cbegin(); it != itEnd; ++it ) { + auto bFound = rMap.contains( *(it->pKey) ); + if ( it->bExists ) { + if ( check_result(bFound, rMap)) + ++m_KeyExists.nSuccess; + else + ++m_KeyExists.nFailed; + } + else { + if ( check_result(bFound, rMap)) + ++m_KeyNotExists.nFailed; + else + ++m_KeyNotExists.nSuccess; + } + } + } + else { + auto itEnd = s_Data.crend(); + for ( auto it = s_Data.crbegin(); it != itEnd; ++it ) { + auto bFound = rMap.contains( *(it->pKey) ); + if ( it->bExists ) { + if ( check_result(bFound, rMap)) + ++m_KeyExists.nSuccess; + else + ++m_KeyExists.nFailed; + } + else { + if ( check_result( bFound, rMap )) + ++m_KeyNotExists.nFailed; + else + ++m_KeyNotExists.nSuccess; + } + } + } + } + } + }; + + protected: + template + static void fill_string_array(); + + template + void test( Map& testMap ) + { + typedef Worker worker; + + // Fill the map + for ( size_t i = 0; i < s_Data.size(); ++i ) { + // All keys in arrData are unique, insert() must be successful + if ( s_Data[i].bExists ) + EXPECT_TRUE( check_result( testMap.insert( *(s_Data[i].pKey), s_Data[i] ), testMap )); + } + + propout() << std::make_pair( "thread_count", s_nThreadCount ) + << std::make_pair( "map_size", s_nMapSize ) + << std::make_pair( "percent_exist", s_nPercentExists ) + << std::make_pair( "pass_count", s_nPassCount ); + + cds_test::thread_pool& pool = get_pool(); + pool.add( new worker( pool, testMap ), s_nThreadCount ); + + std::chrono::milliseconds duration = pool.run(); + + propout() << std::make_pair( "duration", duration ); + + size_t nExistSuccess = 0; + size_t nExistFailed = 0; + size_t nMissingSuccess = 0; + size_t nMissingFailed = 0; + + // Postcondition: the number of success searching == the number of map item + for ( size_t i = 0; i < pool.size(); ++i ) { + worker& w = static_cast(pool.get( i )); + nExistSuccess += w.m_KeyExists.nSuccess; + nExistFailed += w.m_KeyExists.nFailed; + nMissingSuccess += w.m_KeyNotExists.nSuccess; + nMissingFailed += w.m_KeyNotExists.nFailed; + + EXPECT_EQ( w.m_KeyExists.nSuccess, s_nMapSize * s_nPassCount ) << "thread " << i; + EXPECT_EQ( w.m_KeyExists.nFailed, 0 ) << "thread " << i; + EXPECT_EQ( w.m_KeyNotExists.nSuccess, (s_Data.size() - s_nMapSize) * s_nPassCount ) << "thread " << i; + EXPECT_EQ( w.m_KeyNotExists.nFailed, 0 ) << "thread " << i; + } + + check_before_cleanup( testMap ); + + testMap.clear(); + additional_check( testMap ); + print_stat( propout(), testMap ); + additional_cleanup( testMap ); + } + + template + void run_test() + { + ASSERT_GT( s_Data.size(), 0 ); + + Map testMap( *this ); + test( testMap ); + } + }; + + class Map_find_string_stdhash: public Map_find_string + { + public: + static void SetUpTestCase(); + + template + void run_test() + { + Map_find_string::run_test(); + } + }; + +#if CDS_BUILD_BITS == 64 + class Map_find_string_city32: public Map_find_string + { + public: + static void SetUpTestCase(); + + template + void run_test() + { + Map_find_string::run_test(); + } + }; + + class Map_find_string_city64: public Map_find_string + { + public: + static void SetUpTestCase(); + + template + void run_test() + { + Map_find_string::run_test(); + } + }; + + class Map_find_string_city128: public Map_find_string + { + public: + static void SetUpTestCase(); + + template + void run_test() + { + Map_find_string::run_test(); + } + }; + +#endif // #if CDS_BUILD_BITS == 64 + + class Map_find_string_LF: public Map_find_string + , public ::testing::WithParamInterface + { + public: + template + void run_test() + { + s_nLoadFactor = GetParam(); + propout() << std::make_pair( "load_factor", s_nLoadFactor ); + Map_find_string::run_test(); + } + }; + +} // namespace map diff --git a/test/stress/map/find_string/map_find_string_bronsonavltree.cpp b/test/stress/map/find_string/map_find_string_bronsonavltree.cpp new file mode 100644 index 00000000..f36cf809 --- /dev/null +++ b/test/stress/map/find_string/map_find_string_bronsonavltree.cpp @@ -0,0 +1,38 @@ +/* + 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 "map_find_string.h" +#include "map_type_bronson_avltree.h" + +namespace map { + + CDSSTRESS_BronsonAVLTreeMap( Map_find_string, run_test, std::string, Map_find_string::value_type ) + +} // namespace map diff --git a/test/stress/map/find_string/map_find_string_cuckoo.cpp b/test/stress/map/find_string/map_find_string_cuckoo.cpp new file mode 100644 index 00000000..edb4b8fd --- /dev/null +++ b/test/stress/map/find_string/map_find_string_cuckoo.cpp @@ -0,0 +1,41 @@ +/* + 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 "map_find_string.h" +#include "map_type_cuckoo.h" + +namespace map { + + CDSSTRESS_CuckooMap( Map_find_string, run_test, std::string, Map_find_string::value_type ) +#if CDS_BUILD_BITS == 64 + CDSSTRESS_CuckooMap_city64( Map_find_string, run_test, std::string, Map_find_string::value_type ) +#endif + +} // namespace map diff --git a/test/stress/map/find_string/map_find_string_ellentree.cpp b/test/stress/map/find_string/map_find_string_ellentree.cpp new file mode 100644 index 00000000..39ad3aa8 --- /dev/null +++ b/test/stress/map/find_string/map_find_string_ellentree.cpp @@ -0,0 +1,38 @@ +/* + 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 "map_find_string.h" +#include "map_type_ellen_bintree.h" + +namespace map { + + CDSSTRESS_EllenBinTreeMap( Map_find_string, run_test, std::string, Map_find_string::value_type ) + +} // namespace map diff --git a/test/stress/map/find_string/map_find_string_feldman_hashset.cpp b/test/stress/map/find_string/map_find_string_feldman_hashset.cpp new file mode 100644 index 00000000..c12cb33d --- /dev/null +++ b/test/stress/map/find_string/map_find_string_feldman_hashset.cpp @@ -0,0 +1,42 @@ +/* + 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 "map_find_string.h" +#include "map_type_feldman_hashmap.h" + +namespace map { + + CDSSTRESS_FeldmanHashMap_stdhash( Map_find_string_stdhash, run_test, std::string, Map_find_string::value_type ) +#if CDS_BUILD_BITS == 64 + CDSSTRESS_FeldmanHashMap_city64( Map_find_string_city64, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_FeldmanHashMap_city128( Map_find_string_city128, run_test, std::string, Map_find_string::value_type ) +#endif + +} // namespace map diff --git a/test/stress/map/find_string/map_find_string_michael.cpp b/test/stress/map/find_string/map_find_string_michael.cpp new file mode 100644 index 00000000..a47eaa06 --- /dev/null +++ b/test/stress/map/find_string/map_find_string_michael.cpp @@ -0,0 +1,39 @@ +/* + 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 "map_find_string.h" +#include "map_type_michael.h" + +namespace map { + + CDSSTRESS_MichaelMap( Map_find_string_LF, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_MichaelMap_nogc( Map_find_string_LF, run_test, std::string, Map_find_string::value_type ) + +} // namespace map diff --git a/test/stress/map/find_string/map_find_string_skip.cpp b/test/stress/map/find_string/map_find_string_skip.cpp new file mode 100644 index 00000000..e9f3d6dc --- /dev/null +++ b/test/stress/map/find_string/map_find_string_skip.cpp @@ -0,0 +1,39 @@ +/* + 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 "map_find_string.h" +#include "map_type_skip_list.h" + +namespace map { + + CDSSTRESS_SkipListMap( Map_find_string, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_SkipListMap_nogc( Map_find_string, run_test, std::string, Map_find_string::value_type ) + +} // namespace map diff --git a/test/stress/map/find_string/map_find_string_split.cpp b/test/stress/map/find_string/map_find_string_split.cpp new file mode 100644 index 00000000..361a500e --- /dev/null +++ b/test/stress/map/find_string/map_find_string_split.cpp @@ -0,0 +1,39 @@ +/* + 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 "map_find_string.h" +#include "map_type_split_list.h" + +namespace map { + + CDSSTRESS_SplitListMap( Map_find_string_LF, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_SplitListMap_nogc( Map_find_string_LF, run_test, std::string, Map_find_string::value_type ) + +} // namespace map diff --git a/test/stress/map/find_string/map_find_string_std.cpp b/test/stress/map/find_string/map_find_string_std.cpp new file mode 100644 index 00000000..eb00c7e0 --- /dev/null +++ b/test/stress/map/find_string/map_find_string_std.cpp @@ -0,0 +1,39 @@ +/* + 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 "map_find_string.h" +#include "map_type_std.h" + +namespace map { + + CDSSTRESS_StdMap( Map_find_string, run_test, std::string, Map_find_string::value_type ) + CDSSTRESS_StdMap_nolock( Map_find_string, run_test, std::string, Map_find_string::value_type ) + +} // namespace map diff --git a/test/stress/map/find_string/map_find_string_striped.cpp b/test/stress/map/find_string/map_find_string_striped.cpp new file mode 100644 index 00000000..76d49b98 --- /dev/null +++ b/test/stress/map/find_string/map_find_string_striped.cpp @@ -0,0 +1,38 @@ +/* + 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 "map_find_string.h" +#include "map_type_striped.h" + +namespace map { + + CDSSTRESS_StripedMap( Map_find_string_LF, run_test, std::string, Map_find_string::value_type ) + +} // namespace map diff --git a/test/stress/map/map_type_cuckoo.h b/test/stress/map/map_type_cuckoo.h index dcdbb6a1..0fd760ce 100644 --- a/test/stress/map/map_type_cuckoo.h +++ b/test/stress/map/map_type_cuckoo.h @@ -34,6 +34,7 @@ #include "map_type.h" #include #include +#include namespace map { @@ -184,6 +185,104 @@ namespace map { typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_vector_ord_storehash; typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_vector_ord_storehash; +#if CDS_BUILD_BITS == 64 + + struct traits_CuckooMap_list_unord_city64: + public cc::cuckoo::make_traits < + cc::cuckoo::probeset_type< cc::cuckoo::list > + , co::equal_to< equal_to > + , co::hash< std::tuple< cds_test::city64, hash2 > > + > ::type + {}; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_list_unord_city64; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_list_unord_city64; + + struct traits_CuckooMap_list_unord_city64_stat: public traits_CuckooMap_list_unord_city64 + { + typedef cc::cuckoo::stat stat; + }; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_list_unord_city64_stat; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_list_unord_city64_stat; + + struct traits_CuckooMap_list_unord_city64_storehash: public traits_CuckooMap_list_unord_city64 + { + static CDS_CONSTEXPR const bool store_hash = true; + }; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_list_unord_city64_storehash; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_list_unord_city64_storehash; + + struct traits_CuckooMap_list_ord_city64: + public cc::cuckoo::make_traits < + cc::cuckoo::probeset_type< cc::cuckoo::list > + , co::compare< compare > + , co::hash< std::tuple< cds_test::city64, hash2 > > + >::type + {}; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_list_ord_city64; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_list_ord_city64; + + struct traits_CuckooMap_list_ord_city64_stat: public traits_CuckooMap_list_ord_city64 + { + typedef cc::cuckoo::stat stat; + }; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_list_ord_city64_stat; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_list_ord_city64_stat; + + struct traits_CuckooMap_list_ord_city64_storehash: public traits_CuckooMap_list_ord_city64 + { + static CDS_CONSTEXPR const bool store_hash = true; + }; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_list_ord_city64_storehash; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_list_ord_city64_storehash; + + struct traits_CuckooMap_vector_unord_city64: + public cc::cuckoo::make_traits < + cc::cuckoo::probeset_type< cc::cuckoo::vector<4> > + , co::equal_to< equal_to > + , co::hash< std::tuple< cds_test::city64, hash2 > > + >::type + {}; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_vector_unord_city64; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_vector_unord_city64; + + struct traits_CuckooMap_vector_unord_city64_stat: public traits_CuckooMap_vector_unord_city64 + { + typedef cc::cuckoo::stat stat; + }; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_vector_unord_city64_stat; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_vector_unord_city64_stat; + + struct traits_CuckooMap_vector_unord_city64_storehash: public traits_CuckooMap_vector_unord_city64 + { + static CDS_CONSTEXPR const bool store_hash = true; + }; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_vector_unord_city64_storehash; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_vector_unord_city64_storehash; + + struct traits_CuckooMap_vector_ord_city64: + public cc::cuckoo::make_traits < + cc::cuckoo::probeset_type< cc::cuckoo::vector<4> > + , co::compare< compare > + , co::hash< std::tuple< cds_test::city64, hash2 > > + >::type + {}; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_vector_ord_city64; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_vector_ord_city64; + + struct traits_CuckooMap_vector_ord_city64_stat: public traits_CuckooMap_vector_ord_city64 + { + typedef cc::cuckoo::stat stat; + }; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_vector_ord_city64_stat; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_vector_ord_city64_stat; + + struct traits_CuckooMap_vector_ord_city64_storehash: public traits_CuckooMap_vector_ord_city64 + { + static CDS_CONSTEXPR const bool store_hash = true; + }; + typedef CuckooMap< Key, Value, traits_CuckooStripedMap> CuckooStripedMap_vector_ord_city64_storehash; + typedef CuckooMap< Key, Value, traits_CuckooRefinableMap> CuckooRefinableMap_vector_ord_city64_storehash; +#endif // CDS_BUILD_BITS == 64 }; template @@ -235,4 +334,31 @@ namespace map { CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_vector_ord_storehash, key_type, value_type ) \ CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_vector_ord_storehash, key_type, value_type ) +#if CDS_BUILD_BITS == 64 +# define CDSSTRESS_CuckooMap_city64( fixture, test_case, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_list_unord_city64, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_list_unord_city64, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_list_unord_city64_stat, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_list_unord_city64_stat, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_list_unord_city64_storehash, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_list_unord_city64_storehash, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_list_ord_city64, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_list_ord_city64, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_list_ord_city64_stat, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_list_ord_city64_stat, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_list_ord_city64_storehash, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_list_ord_city64_storehash, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_vector_unord_city64, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_vector_unord_city64, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_vector_unord_city64_stat, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_vector_unord_city64_stat, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_vector_unord_city64_storehash, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_vector_unord_city64_storehash, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_vector_ord_city64, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_vector_ord_city64, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_vector_ord_city64_stat, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_vector_ord_city64_stat, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooStripedMap_vector_ord_city64_storehash, key_type, value_type ) \ + CDSSTRESS_CuckooMap_case( fixture, test_case, CuckooRefinableMap_vector_ord_city64_storehash, key_type, value_type ) +#endif #endif // ifndef CDSUNIT_MAP_TYPE_CUCKOO_H diff --git a/test/stress/map/map_type_feldman_hashmap.h b/test/stress/map/map_type_feldman_hashmap.h index fa5e9479..1cafd837 100644 --- a/test/stress/map/map_type_feldman_hashmap.h +++ b/test/stress/map/map_type_feldman_hashmap.h @@ -218,24 +218,28 @@ namespace map { CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_sht_stdhash_stat, key_type, value_type ) \ # if CDS_BUILD_BITS == 64 -# define CDSSTRESS_FeldmanHashMap_city_SHRCU( fixture, test_case, key_type, value_type ) \ +# define CDSSTRESS_FeldmanHashMap_city64_SHRCU( fixture, test_case, key_type, value_type ) \ + CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_shb_city64, key_type, value_type ) \ + CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_sht_city64, key_type, value_type ) \ + CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_shb_city64_stat, key_type, value_type ) \ + CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_sht_city64_stat, key_type, value_type ) \ + +# define CDSSTRESS_FeldmanHashMap_city128_SHRCU( fixture, test_case, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_shb_city64, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_sht_city64, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_shb_city64_stat, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_sht_city64_stat, key_type, value_type ) \ - CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_shb_city128, key_type, value_type ) \ - CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_sht_city128, key_type, value_type ) \ - CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_shb_city128_stat, key_type, value_type ) \ - CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_sht_city128_stat, key_type, value_type ) \ # else -# define CDSSTRESS_FeldmanHashMap_city_SHRCU( fixture, test_case, key_type, value_type ) +# define CDSSTRESS_FeldmanHashMap_city64_SHRCU( fixture, test_case, key_type, value_type ) +# define CDSSTRESS_FeldmanHashMap_city128_SHRCU( fixture, test_case, key_type, value_type ) # endif #else # define CDSSTRESS_FeldmanHashMap_fixed_SHRCU( fixture, test_case, key_type, value_type ) # define CDSSTRESS_FeldmanHashMap_stdhash_SHRCU( fixture, test_case, key_type, value_type ) -# define CDSSTRESS_FeldmanHashMap_city_SHRCU( fixture, test_case, key_type, value_type ) +# define CDSSTRESS_FeldmanHashMap_city64_SHRCU( fixture, test_case, key_type, value_type ) +# define CDSSTRESS_FeldmanHashMap_city128_SHRCU( fixture, test_case, key_type, value_type ) #endif #define CDSSTRESS_FeldmanHashMap_fixed( fixture, test_case, key_type, value_type ) \ @@ -266,7 +270,7 @@ namespace map { #if CDS_BUILD_BITS == 64 -# define CDSSTRESS_FeldmanHashMap_city( fixture, test_case, key_type, value_type ) \ +# define CDSSTRESS_FeldmanHashMap_city64( fixture, test_case, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_hp_city64, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_dhp_city64, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_gpi_city64, key_type, value_type ) \ @@ -277,6 +281,9 @@ namespace map { CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_gpi_city64_stat, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_gpb_city64_stat, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_gpt_city64_stat, key_type, value_type ) \ + CDSSTRESS_FeldmanHashMap_city64_SHRCU( fixture, test_case, key_type, value_type ) + +# define CDSSTRESS_FeldmanHashMap_city128( fixture, test_case, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_hp_city128, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_dhp_city128, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_gpi_city128, key_type, value_type ) \ @@ -287,9 +294,15 @@ namespace map { CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_gpi_city128_stat, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_gpb_city128_stat, key_type, value_type ) \ CDSSTRESS_FeldmanHashMap_case( fixture, test_case, FeldmanHashMap_rcu_gpt_city128_stat, key_type, value_type ) \ - CDSSTRESS_FeldmanHashMap_city_SHRCU( fixture, test_case, key_type, value_type ) + CDSSTRESS_FeldmanHashMap_city128_SHRCU( fixture, test_case, key_type, value_type ) + +# define CDSSTRESS_FeldmanHashMap_city( fixture, test_case, key_type, value_type ) \ + CDSSTRESS_FeldmanHashMap_city64( fixture, test_case, key_type, value_type ) \ + CDSSTRESS_FeldmanHashMap_city128( fixture, test_case, key_type, value_type ) #else +# define CDSSTRESS_FeldmanHashMap_city64( fixture, test_case, key_type, value_type ) +# define CDSSTRESS_FeldmanHashMap_city128( fixture, test_case, key_type, value_type ) # define CDSSTRESS_FeldmanHashMap_city( fixture, test_case, key_type, value_type ) #endif -- 2.34.1