CDSUNIT_SET_SOURCES := $(CDSUNIT_SET_SOURCES:%.cpp=../%.cpp)
CDSUNIT_SET_OBJS := $(CDSUNIT_SET_SOURCES:%.cpp=%.o)
-include ../projects/source.unit.pqueue.mk
-CDSUNIT_PQUEUE_SOURCES := $(CDSUNIT_PQUEUE_SOURCES:%.cpp=../%.cpp)
-CDSUNIT_PQUEUE_OBJS := $(CDSUNIT_PQUEUE_SOURCES:%.cpp=%.o)
-
include ../projects/source.unit.misc.mk
CDSUNIT_MISC_SOURCES := $(CDSUNIT_MISC_SOURCES:%.cpp=../%.cpp)
CDSUNIT_MISC_OBJS := $(CDSUNIT_MISC_SOURCES:%.cpp=%.o)
-TEST_OBJ_FILE := $(CDSUNIT_COMMON_FILE) $(CDSUNIT_MAP_OBJS) $(CDSUNIT_SET_OBJS) $(CDSUNIT_PQUEUE_OBJS) \
+TEST_OBJ_FILE := $(CDSUNIT_COMMON_FILE) $(CDSUNIT_MAP_OBJS) $(CDSUNIT_SET_OBJS) \
$(CDSUNIT_STACK_OBJS) $(CDSUNIT_MISC_OBJS)
TEST_OBJ_FILE_DEPS := $(TEST_OBJ_FILE:%.o=%.d)
CDSUNIT_MAP_EXE=$(BIN_PATH)/cdsu-map
CDSUNIT_SET_EXE=$(BIN_PATH)/cdsu-set
-CDSUNIT_PQUEUE_EXE=$(BIN_PATH)/cdsu-pqueue
CDSUNIT_MISC_EXE=$(BIN_PATH)/cdsu-misc
-CDSUNIT_EXE_FILES= $(CDSUNIT_MAP_EXE) $(CDSUNIT_SET_EXE) $(CDSUNIT_PQUEUE_EXE) $(CDSUNIT_MISC_EXE)
+CDSUNIT_EXE_FILES= $(CDSUNIT_MAP_EXE) $(CDSUNIT_SET_EXE) $(CDSUNIT_MISC_EXE)
unit-map: $(CDSUNIT_MAP_EXE)
unit-set: $(CDSUNIT_SET_EXE)
-unit-pqueue: $(CDSUNIT_PQUEUE_EXE)
ifeq ($(platform),mingw)
make_test : $(BIN_PATH)/test-hdr $(CDSUNIT_EXE_FILES)
$(CDSUNIT_SET_EXE) : $(CDSUNIT_SET_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
$(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_SET_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_LIBS) $(LDLIBS)
-$(CDSUNIT_PQUEUE_EXE) : $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
- $(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_LIBS) $(LDLIBS)
-
$(CDSUNIT_MISC_EXE) : $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
$(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_LIBS) $(LDLIBS)
CDSUNIT_MAP_EXE_DBG=$(CDSUNIT_MAP_EXE)-d
CDSUNIT_SET_EXE_DBG=$(CDSUNIT_SET_EXE)-d
-CDSUNIT_PQUEUE_EXE_DBG=$(CDSUNIT_PQUEUE_EXE)-d
CDSUNIT_MISC_EXE_DBG=$(CDSUNIT_MISC_EXE)-d
-CDSUNIT_EXE_DBG_FILES= $(CDSUNIT_MAP_EXE_DBG) $(CDSUNIT_SET_EXE_DBG) $(CDSUNIT_PQUEUE_EXE_DBG) \
- $(CDSUNIT_MISC_EXE_DBG)
+CDSUNIT_EXE_DBG_FILES= $(CDSUNIT_MAP_EXE_DBG) $(CDSUNIT_SET_EXE_DBG) $(CDSUNIT_MISC_EXE_DBG)
unit-map-dbg: $(CDSUNIT_MAP_EXE_DBG)
unit-set-dbg: $(CDSUNIT_SET_EXE_DBG)
-unit-pqueue-dbg: $(CDSUNIT_PQUEUE_EXE_DBG)
ifeq ($(platform),mingw)
make_debug_test : $(BIN_PATH)/test-hdr-debug $(CDSUNIT_EXE_DBG_FILES)
$(CDSUNIT_SET_EXE_DBG) : $(CDSUNIT_SET_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
$(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_SET_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_DEBUG_LIBS) $(LDLIBS)
-$(CDSUNIT_PQUEUE_EXE_DBG) : $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
- $(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_PQUEUE_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_DEBUG_LIBS) $(LDLIBS)
-
$(CDSUNIT_MISC_EXE_DBG) : $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS)
$(CXX) $(LD_OPTS) -L$(BIN_PATH) $(CDSUNIT_MISC_OBJS) $(CDSUNIT_COMMON_FILE) $(TEST_COMMON_OBJS) -o $@ $(LD_BOOST_THREAD_LIB) $(LD_TEST_COMMON_DEBUG_LIBS) $(LDLIBS)
{408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239}\r
EndProjectSection\r
EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit-pqueue", "unit-pqueue.vcxproj", "{20B6C380-E96A-4CFF-BC17-D88AAE581919}"\r
- ProjectSection(ProjectDependencies) = postProject\r
- {61179F2F-07E1-490D-B64D-D85A90B6EF81} = {61179F2F-07E1-490D-B64D-D85A90B6EF81}\r
- {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239}\r
- EndProjectSection\r
-EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit-map-insdel-item", "unit-map-insdel-item.vcxproj", "{7521DD92-56FF-4ECA-93E5-CCE50862354B}"\r
ProjectSection(ProjectDependencies) = postProject\r
{61179F2F-07E1-490D-B64D-D85A90B6EF81} = {61179F2F-07E1-490D-B64D-D85A90B6EF81}\r
ProjectSection(SolutionItems) = preProject\r
..\..\..\test\include\cds_test\check_size.h = ..\..\..\test\include\cds_test\check_size.h\r
..\..\..\test\include\cds_test\fixture.h = ..\..\..\test\include\cds_test\fixture.h\r
+ ..\..\..\test\include\cds_test\stat_ellenbintree_out.h = ..\..\..\test\include\cds_test\stat_ellenbintree_out.h\r
+ ..\..\..\test\include\cds_test\stat_skiplist_out.h = ..\..\..\test\include\cds_test\stat_skiplist_out.h\r
..\..\..\test\include\cds_test\stress_test.h = ..\..\..\test\include\cds_test\stress_test.h\r
..\..\..\test\include\cds_test\thread.h = ..\..\..\test\include\cds_test\thread.h\r
EndProjectSection\r
EndProjectSection\r
EndProject\r
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "stress", "stress", "{10E1FAF2-904D-405E-8AB5-6878A1B03346}"\r
- ProjectSection(SolutionItems) = preProject\r
- ..\..\..\test\stress\michael_alloc.h = ..\..\..\test\stress\michael_alloc.h\r
- EndProjectSection\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress-framework", "stress-framework.vcxproj", "{A34CED07-A442-4FA1-81C4-F8B9CD3C832B}"\r
EndProject\r
{408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239}\r
EndProjectSection\r
EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress-pqueue", "stress-pqueue.vcxproj", "{51AC349E-B365-4FCF-8778-17A1534E4584}"\r
+EndProject\r
Global\r
GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
Debug|Win32 = Debug|Win32\r
{6F834EAD-7B94-4979-A0F1-A662E3D30145}.Release|Win32.Build.0 = Release|Win32\r
{6F834EAD-7B94-4979-A0F1-A662E3D30145}.Release|x64.ActiveCfg = Release|x64\r
{6F834EAD-7B94-4979-A0F1-A662E3D30145}.Release|x64.Build.0 = Release|x64\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.Debug|Win32.ActiveCfg = Debug|Win32\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.Debug|Win32.Build.0 = Debug|Win32\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.Debug|x64.ActiveCfg = Debug|x64\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.Debug|x64.Build.0 = Debug|x64\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.DebugVLD|Win32.ActiveCfg = DebugVLD|Win32\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.DebugVLD|Win32.Build.0 = DebugVLD|Win32\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.DebugVLD|x64.ActiveCfg = DebugVLD|x64\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.DebugVLD|x64.Build.0 = DebugVLD|x64\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.Release|Win32.ActiveCfg = Release|Win32\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.Release|Win32.Build.0 = Release|Win32\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.Release|x64.ActiveCfg = Release|x64\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919}.Release|x64.Build.0 = Release|x64\r
{7521DD92-56FF-4ECA-93E5-CCE50862354B}.Debug|Win32.ActiveCfg = Debug|Win32\r
{7521DD92-56FF-4ECA-93E5-CCE50862354B}.Debug|Win32.Build.0 = Debug|Win32\r
{7521DD92-56FF-4ECA-93E5-CCE50862354B}.Debug|x64.ActiveCfg = Debug|x64\r
{50B2EC4B-A118-4E7B-ABC7-2EA8B685A58C}.Release|Win32.Build.0 = Release|Win32\r
{50B2EC4B-A118-4E7B-ABC7-2EA8B685A58C}.Release|x64.ActiveCfg = Release|x64\r
{50B2EC4B-A118-4E7B-ABC7-2EA8B685A58C}.Release|x64.Build.0 = Release|x64\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.Debug|Win32.Build.0 = Debug|Win32\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.Debug|x64.ActiveCfg = Debug|x64\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.Debug|x64.Build.0 = Debug|x64\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.DebugVLD|Win32.ActiveCfg = DebugVLD|Win32\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.DebugVLD|Win32.Build.0 = DebugVLD|Win32\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.DebugVLD|x64.ActiveCfg = DebugVLD|x64\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.DebugVLD|x64.Build.0 = DebugVLD|x64\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.Release|Win32.ActiveCfg = Release|Win32\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.Release|Win32.Build.0 = Release|Win32\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.Release|x64.ActiveCfg = Release|x64\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584}.Release|x64.Build.0 = Release|x64\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
{E5E9DB4A-7816-45D4-A116-6BBBA0EE8EE7} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
{A38E5597-6916-4480-A343-C9846EF544E4} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
{6F834EAD-7B94-4979-A0F1-A662E3D30145} = {B8C24D26-A3BF-4DA6-B64C-142CBA4BFE75}\r
- {20B6C380-E96A-4CFF-BC17-D88AAE581919} = {B30CA283-1796-4763-92C3-2E4848D443F7}\r
{7521DD92-56FF-4ECA-93E5-CCE50862354B} = {6BB7A27F-FC59-4267-B6FA-D034176D1459}\r
{CA6F0834-0628-4CD7-8800-AEABCD636360} = {6BB7A27F-FC59-4267-B6FA-D034176D1459}\r
{DE256E91-EE96-412E-82EE-DD7BD1A1130D} = {A64449B7-90FB-4E2B-A686-9EFC0E298644}\r
{A34CED07-A442-4FA1-81C4-F8B9CD3C832B} = {10E1FAF2-904D-405E-8AB5-6878A1B03346}\r
{5E1C3684-9463-4A98-BAFC-9BD51F179BB6} = {10E1FAF2-904D-405E-8AB5-6878A1B03346}\r
{50B2EC4B-A118-4E7B-ABC7-2EA8B685A58C} = {10E1FAF2-904D-405E-8AB5-6878A1B03346}\r
+ {51AC349E-B365-4FCF-8778-17A1534E4584} = {10E1FAF2-904D-405E-8AB5-6878A1B03346}\r
EndGlobalSection\r
GlobalSection(DPCodeReviewSolutionGUID) = preSolution\r
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup Label="ProjectConfigurations">\r
+ <ProjectConfiguration Include="DebugVLD|Win32">\r
+ <Configuration>DebugVLD</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="DebugVLD|x64">\r
+ <Configuration>DebugVLD</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Debug|Win32">\r
+ <Configuration>Debug</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Release|Win32">\r
+ <Configuration>Release</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Debug|x64">\r
+ <Configuration>Debug</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Release|x64">\r
+ <Configuration>Release</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="..\..\..\test\stress\pqueue\item.h" />\r
+ <ClInclude Include="..\..\..\test\stress\pqueue\pqueue_type.h" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="..\..\..\test\stress\main.cpp">\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CDSUNIT_USE_URCU;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">CDSUNIT_USE_URCU;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CDSUNIT_USE_URCU;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CDSUNIT_USE_URCU;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">CDSUNIT_USE_URCU;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CDSUNIT_USE_URCU;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\stress\pqueue\pop.cpp" />\r
+ <ClCompile Include="..\..\..\test\stress\pqueue\push.cpp" />\r
+ <ClCompile Include="..\..\..\test\stress\pqueue\push_pop.cpp" />\r
+ </ItemGroup>\r
+ <PropertyGroup Label="Globals">\r
+ <ProjectGuid>{51AC349E-B365-4FCF-8778-17A1534E4584}</ProjectGuid>\r
+ <Keyword>Win32Proj</Keyword>\r
+ <RootNamespace>stress_pqueue</RootNamespace>\r
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
+ <ProjectName>stress-pqueue</ProjectName>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ <PlatformToolset>v140</PlatformToolset>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+ <ImportGroup Label="ExtensionSettings">\r
+ </ImportGroup>\r
+ <ImportGroup Label="Shared">\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <PropertyGroup Label="UserMacros" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <LinkIncremental>true</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ <TargetName>$(ProjectName)_d</TargetName>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">\r
+ <LinkIncremental>true</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ <TargetName>$(ProjectName)_d</TargetName>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <LinkIncremental>true</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ <TargetName>$(ProjectName)_d</TargetName>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">\r
+ <LinkIncremental>true</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ <TargetName>$(ProjectName)_d</TargetName>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <LinkIncremental>false</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <LinkIncremental>false</LinkIncremental>\r
+ <OutDir>$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\</OutDir>\r
+ <IntDir>$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
+ </PropertyGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <ClCompile>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtestd.lib;stress-framework_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">\r
+ <ClCompile>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtestd.lib;stress-framework_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <ClCompile>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtestd.lib;stress-framework_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">\r
+ <ClCompile>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtestd.lib;stress-framework_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <ClCompile>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <Optimization>MaxSpeed</Optimization>\r
+ <FunctionLevelLinking>true</FunctionLevelLinking>\r
+ <IntrinsicFunctions>true</IntrinsicFunctions>\r
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+ <OptimizeReferences>true</OptimizeReferences>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB32);$(GTEST_ROOT)/lib/x86;$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtest.lib;stres-framework.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <ClCompile>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+ <Optimization>MaxSpeed</Optimization>\r
+ <FunctionLevelLinking>true</FunctionLevelLinking>\r
+ <IntrinsicFunctions>true</IntrinsicFunctions>\r
+ <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ </ClCompile>\r
+ <Link>\r
+ <SubSystem>Console</SubSystem>\r
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+ <OptimizeReferences>true</OptimizeReferences>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>$(GTEST_LIB64);$(GTEST_ROOT)/lib/x64;$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;%(AdditionalLibraryDirectories);$(OutDir)</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>gtest.lib;stres-framework.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+ <ImportGroup Label="ExtensionTargets">\r
+ </ImportGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup>\r
+ <Filter Include="Source Files">\r
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
+ </Filter>\r
+ <Filter Include="Header Files">\r
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
+ </Filter>\r
+ <Filter Include="Resource Files">\r
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r
+ </Filter>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="..\..\..\test\stress\pqueue\pqueue_type.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\test\stress\pqueue\item.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="..\..\..\test\stress\main.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\stress\pqueue\pop.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\stress\pqueue\push.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\stress\pqueue\push_pop.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup Label="ProjectConfigurations">\r
- <ProjectConfiguration Include="DebugVLD|Win32">\r
- <Configuration>DebugVLD</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="DebugVLD|x64">\r
- <Configuration>DebugVLD</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|Win32">\r
- <Configuration>Debug</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|x64">\r
- <Configuration>Debug</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|Win32">\r
- <Configuration>Release</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|x64">\r
- <Configuration>Release</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="..\..\..\tests\unit\pqueue\ellen_bintree_pqueue.h" />\r
- <ClInclude Include="..\..\..\tests\unit\pqueue\pqueue_defs.h" />\r
- <ClInclude Include="..\..\..\tests\unit\pqueue\pqueue_item.h" />\r
- <ClInclude Include="..\..\..\tests\unit\pqueue\pqueue_type.h" />\r
- <ClInclude Include="..\..\..\tests\unit\pqueue\skiplist_pqueue.h" />\r
- <ClInclude Include="..\..\..\tests\unit\pqueue\std_pqueue.h" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="..\..\..\tests\unit\pqueue\pop.cpp" />\r
- <ClCompile Include="..\..\..\tests\unit\pqueue\push.cpp" />\r
- <ClCompile Include="..\..\..\tests\unit\pqueue\push_pop.cpp" />\r
- </ItemGroup>\r
- <PropertyGroup Label="Globals">\r
- <ProjectGuid>{20B6C380-E96A-4cff-BC17-D88AAE581919}</ProjectGuid>\r
- <RootNamespace>unitpqueue</RootNamespace>\r
- <Keyword>Win32Proj</Keyword>\r
- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="Configuration">\r
- <ConfigurationType>Application</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
- <ImportGroup Label="ExtensionSettings">\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- </ImportGroup>\r
- <PropertyGroup Label="UserMacros" />\r
- <PropertyGroup>\r
- <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">false</LinkIncremental>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">false</LinkIncremental>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\..\..\bin\vc.$(PlatformToolset)\$(Platform)-release\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\..\..\obj\vc.$(PlatformToolset)\$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>\r
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'" />\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'" />\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />\r
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>\r
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />\r
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />\r
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_d</TargetName>\r
- <TargetName Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">$(ProjectName)_d</TargetName>\r
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)_d</TargetName>\r
- <TargetName Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">$(ProjectName)_d</TargetName>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <MinimalRebuild>true</MinimalRebuild>\r
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <TargetMachine>MachineX86</TargetMachine>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <MinimalRebuild>true</MinimalRebuild>\r
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <TargetMachine>MachineX86</TargetMachine>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <MinimalRebuild>true</MinimalRebuild>\r
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <TargetMachine>MachineX64</TargetMachine>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>Disabled</Optimization>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;CDS_USE_VLD;WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <MinimalRebuild>true</MinimalRebuild>\r
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites_d.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <TargetMachine>MachineX64</TargetMachine>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>MaxSpeed</Optimization>\r
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\r
- <IntrinsicFunctions>true</IntrinsicFunctions>\r
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
- <FunctionLevelLinking>true</FunctionLevelLinking>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage32/lib;$(BOOST_PATH)/stage/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <OptimizeReferences>true</OptimizeReferences>\r
- <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
- <TargetMachine>MachineX86</TargetMachine>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalOptions>/bigobj /Zc:inline %(AdditionalOptions)</AdditionalOptions>\r
- <Optimization>MaxSpeed</Optimization>\r
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\r
- <IntrinsicFunctions>true</IntrinsicFunctions>\r
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\r
- <AdditionalIncludeDirectories>$(SolutionDir)..\..\..;$(SolutionDir)..\..\..\tests\unit;$(SolutionDir)..\..\..\tests;$(BOOST_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_SCL_SECURE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
- <FunctionLevelLinking>true</FunctionLevelLinking>\r
- <PrecompiledHeader>\r
- </PrecompiledHeader>\r
- <WarningLevel>Level3</WarningLevel>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <DisableSpecificWarnings>4520</DisableSpecificWarnings>\r
- </ClCompile>\r
- <Link>\r
- <AdditionalDependencies>unit-prerequisites.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
- <AdditionalLibraryDirectories>$(BOOST_PATH)/stage64/lib;$(BOOST_PATH)/bin;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
- <GenerateDebugInformation>true</GenerateDebugInformation>\r
- <SubSystem>Console</SubSystem>\r
- <OptimizeReferences>true</OptimizeReferences>\r
- <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
- <TargetMachine>MachineX64</TargetMachine>\r
- <OutputFile>$(TargetPath)</OutputFile>\r
- <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>\r
- </Link>\r
- </ItemDefinitionGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
- <ImportGroup Label="ExtensionTargets">\r
- </ImportGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-
-CDSUNIT_PQUEUE_SOURCES= \
- tests/unit/pqueue/pop.cpp \
- tests/unit/pqueue/push.cpp \
- tests/unit/pqueue/push_pop.cpp
--- /dev/null
+/*
+ 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_ELLENBINTREE_OUT_H
+#define CDSTEST_STAT_ELLENBINTREE_OUT_H
+
+//#include "ellen_bintree_update_desc_pool.h"
+#include <cds_test/stress_test.h>
+#include <cds/intrusive/details/ellen_bintree_base.h>
+
+namespace cds_test {
+ static inline property_stream& operator <<( property_stream& o, cds::intrusive::ellen_bintree::empty_stat const& /*s*/ )
+ {
+ return o;
+ }
+
+ static inline property_stream& operator <<( property_stream& o, cds::intrusive::ellen_bintree::stat<> const& s )
+ {
+ return o
+ //<< "\t\t Internal node allocated: " << ellen_bintree_pool::internal_node_counter::m_nAlloc.get() << "\n"
+ //<< "\t\t Internal node freed: " << ellen_bintree_pool::internal_node_counter::m_nFree.get() << "\n"
+ << CDSSTRESS_STAT_OUT( s, m_nInternalNodeCreated )
+ << CDSSTRESS_STAT_OUT( s, m_nInternalNodeDeleted )
+ << CDSSTRESS_STAT_OUT( s, m_nUpdateDescCreated )
+ << CDSSTRESS_STAT_OUT( s, m_nUpdateDescDeleted )
+ << CDSSTRESS_STAT_OUT( s, m_nInsertSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nInsertFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nInsertRetries )
+ << CDSSTRESS_STAT_OUT( s, m_nEnsureExist )
+ << CDSSTRESS_STAT_OUT( s, m_nEnsureNew )
+ << CDSSTRESS_STAT_OUT( s, m_nEnsureRetries )
+ << CDSSTRESS_STAT_OUT( s, m_nEraseSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nEraseFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nEraseRetries )
+ << CDSSTRESS_STAT_OUT( s, m_nFindSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nFindFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMinSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMinFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMinRetries )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMaxSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMaxFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMaxRetries )
+ << CDSSTRESS_STAT_OUT( s, m_nSearchRetry )
+ << CDSSTRESS_STAT_OUT( s, m_nHelpInsert )
+ << CDSSTRESS_STAT_OUT( s, m_nHelpDelete )
+ << CDSSTRESS_STAT_OUT( s, m_nHelpMark )
+ << CDSSTRESS_STAT_OUT( s, m_nHelpGuardSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nHelpGuardFailed );
+ }
+} // namespace cds_test
+
+#endif // #ifndef CDSTEST_STAT_ELLENBINTREE_OUT_H
--- /dev/null
+/*
+ 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_SKIPLIST_OUT_H
+#define CDSTEST_STAT_SKIPLIST_OUT_H
+
+#include <cds/intrusive/details/skip_list_base.h>
+
+namespace cds_test {
+
+ static inline property_stream& operator <<( property_stream& o, cds::intrusive::skip_list::empty_stat const& /*s*/ )
+ {
+ return o;
+ }
+
+ static inline property_stream& operator <<( property_stream& o, cds::intrusive::skip_list::stat<> const& s )
+ {
+ {
+ std::stringstream stm;
+ for ( unsigned int i = 0; i < sizeof( s.m_nNodeHeightAdd ) / sizeof( s.m_nNodeHeightAdd[0] ); ++i )
+ stm << " +" << s.m_nNodeHeightAdd[i].get() << "/-" << s.m_nNodeHeightDel[i].get();
+ o << CDSSTRESS_STAT_OUT_( "stat.level_ins_del", stm.str().substr( 1 ).c_str());
+ }
+
+ return o
+ << CDSSTRESS_STAT_OUT( s, m_nInsertSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nInsertFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nInsertRetries )
+ << CDSSTRESS_STAT_OUT( s, m_nUpdateExist )
+ << CDSSTRESS_STAT_OUT( s, m_nUpdateNew )
+ << CDSSTRESS_STAT_OUT( s, m_nUnlinkSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nUnlinkFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractRetries )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMinSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMinFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMinRetries )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMaxSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMaxFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractMaxRetries )
+ << CDSSTRESS_STAT_OUT( s, m_nEraseSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nEraseFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nEraseRetry )
+ << CDSSTRESS_STAT_OUT( s, m_nFindFastSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nFindFastFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nFindSlowSuccess )
+ << CDSSTRESS_STAT_OUT( s, m_nFindSlowFailed )
+ << CDSSTRESS_STAT_OUT( s, m_nRenewInsertPosition )
+ << CDSSTRESS_STAT_OUT( s, m_nLogicDeleteWhileInsert )
+ << CDSSTRESS_STAT_OUT( s, m_nNotFoundWhileInsert )
+ << CDSSTRESS_STAT_OUT( s, m_nFastErase )
+ << CDSSTRESS_STAT_OUT( s, m_nSlowErase )
+ << CDSSTRESS_STAT_OUT( s, m_nFastExtract )
+ << CDSSTRESS_STAT_OUT( s, m_nSlowExtract )
+ << CDSSTRESS_STAT_OUT( s, m_nEraseWhileFind )
+ << CDSSTRESS_STAT_OUT( s, m_nExtractWhileFind );
+ }
+
+} // namespace cds_test
+
+#endif // #ifndef CDSTEST_STAT_SKIPLIST_OUT_H
~thread_pool()
{
- for ( auto t : m_threads )
- delete t;
+ clear();
}
void add( thread * what )
std::chrono::milliseconds duration() const { return m_testDuration; }
+ void clear()
+ {
+ for ( auto t : m_threads )
+ delete t;
+ m_threads.clear();
+ m_bRunning = false;
+ m_bStopped = false;
+ m_doneCount = 0;
+ }
+
protected: // thread interface
size_t get_next_id()
{
${CMAKE_CURRENT_SOURCE_DIR}
)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pqueue)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/queue)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stack)
QueueSize=1024\r
PassCount=100000\r
\r
-[PQueue_Push]\r
+[pqueue_pop]\r
ThreadCount=4\r
QueueSize=10000\r
\r
-[PQueue_PushPop]\r
+[pqueue_push]\r
+ThreadCount=4\r
+QueueSize=10000\r
+\r
+[pqueue_push_pop]\r
PushThreadCount=4\r
PopThreadCount=4\r
QueueSize=10000\r
QueueSize=1024\r
PassCount=100000\r
\r
-[PQueue_Push]\r
+[pqueue_pop]\r
ThreadCount=8\r
QueueSize=1000000\r
\r
-[PQueue_PushPop]\r
+[pqueue_push]\r
+ThreadCount=8\r
+QueueSize=1000000\r
+\r
+[pqueue_push_pop]\r
PushThreadCount=4\r
PopThreadCount=4\r
QueueSize=500000\r
QueueSize=1024\r
PassCount=1000000\r
\r
-[PQueue_Push]\r
+[pqueue_pop]\r
ThreadCount=8\r
QueueSize=10000000\r
\r
-[PQueue_PushPop]\r
+[pqueue_push]\r
+ThreadCount=8\r
+QueueSize=10000000\r
+\r
+[pqueue_push_pop]\r
PushThreadCount=4\r
PopThreadCount=4\r
QueueSize=10000000\r
+++ /dev/null
-/*
- 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_MICHAEL_ALLOC_H
-#define CDSUNIT_MICHAEL_ALLOC_H
-
-#include <cds/memory/michael/allocator.h>
-#include <memory>
-
-namespace memory {
-
- typedef cds::memory::michael::Heap<
- cds::memory::michael::opt::check_bounds< cds::memory::michael::debug_bound_checking >
- > michael_heap;
- extern michael_heap s_MichaelHeap;
-
- template <class T>
- class MichaelAllocator
- {
- typedef std::allocator<T> std_allocator;
- public:
- // Declare typedefs from std::allocator
- typedef typename std_allocator::const_pointer const_pointer;
- typedef typename std_allocator::pointer pointer;
- typedef typename std_allocator::const_reference const_reference;
- typedef typename std_allocator::reference reference;
- typedef typename std_allocator::difference_type difference_type;
- typedef typename std_allocator::size_type size_type;
- typedef typename std_allocator::value_type value_type;
-
- // Allocation function
- pointer allocate( size_type _Count, const void* /*_Hint*/ = nullptr )
- {
- return reinterpret_cast<pointer>( s_MichaelHeap.alloc( sizeof(T) * _Count ));
- }
-
- // Deallocation function
- void deallocate( pointer _Ptr, size_type /*_Count*/ )
- {
- s_MichaelHeap.free( _Ptr );
- }
-
- pointer address( reference r ) const
- {
- return &r;
- }
- const_pointer address( const_reference r ) const
- {
- return &r;
- }
- void construct( pointer p, const T& val )
- {
- return new( p ) T( val );
- }
- void destroy( pointer p )
- {
- p->T::~T();
- }
-
- // Rebinding allocator to other type
- template <class Other>
- struct rebind {
- typedef MichaelAllocator<Other> other;
- };
- };
-} // namespace memory
-
-#endif // #ifndef CDSUNIT_MICHAEL_ALLOC_H
--- /dev/null
+set(PACKAGE_NAME stress-pqueue)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCDSUNIT_USE_URCU")
+
+set(CDSSTRESS_PQUEUE_SOURCES
+ ../main.cpp
+ pop.cpp
+ push.cpp
+ push_pop.cpp
+)
+
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+add_executable(${PACKAGE_NAME} ${CDSSTRESS_PQUEUE_SOURCES} $<TARGET_OBJECTS:${CDSSTRESS_FRAMEWORK_LIBRARY}>)
+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
--- /dev/null
+/*
+ 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 CDSSTRESS_PQUEUE_ITEM_H
+#define CDSSTRESS_PQUEUE_ITEM_H
+
+namespace pqueue {
+
+ struct simple_value {
+ typedef size_t key_type;
+
+ key_type key;
+
+ struct key_extractor {
+ void operator()( key_type& k, simple_value const& s ) const
+ {
+ k = s.key;
+ }
+ };
+
+ simple_value()
+ : key(0)
+ {}
+
+ simple_value( key_type n )
+ : key(n)
+ {}
+ };
+} // namespace pqueue
+
+namespace std {
+ template <class T> struct less;
+ template <class T> struct greater;
+
+ template <>
+ struct less<pqueue::simple_value>
+ {
+ bool operator()( pqueue::simple_value const& k1, pqueue::simple_value const& k2 ) const
+ {
+ return k1.key < k2.key;
+ }
+
+ bool operator()( pqueue::simple_value const& k1, size_t k2 ) const
+ {
+ return k1.key < k2;
+ }
+
+ bool operator()( size_t k1, pqueue::simple_value const& k2 ) const
+ {
+ return k1 < k2.key;
+ }
+
+ bool operator()( size_t k1, size_t k2 ) const
+ {
+ return k1 < k2;
+ }
+ };
+
+ template <>
+ struct greater<pqueue::simple_value>
+ {
+ bool operator()( pqueue::simple_value const& k1, pqueue::simple_value const& k2 ) const
+ {
+ return k1.key > k2.key;
+ }
+
+ bool operator()( pqueue::simple_value const& k1, size_t k2 ) const
+ {
+ return k1.key > k2;
+ }
+
+ bool operator()( size_t k1, pqueue::simple_value const& k2 ) const
+ {
+ return k1 > k2.key;
+ }
+
+ bool operator()( size_t k1, size_t k2 ) const
+ {
+ return k1 > k2;
+ }
+ };
+
+} // namespace std
+
+#endif // #ifndef CDSSTRESS_PQUEUE_ITEM_H
--- /dev/null
+/*
+ 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 "pqueue_type.h"
+#include "item.h"
+
+namespace {
+ static size_t s_nThreadCount = 8;
+ static size_t s_nQueueSize = 2000000;
+
+ class pqueue_pop: public cds_test::stress_fixture
+ {
+ typedef cds_test::stress_fixture base_class;
+
+ protected:
+ template <class PQueue>
+ class Producer: public cds_test::thread
+ {
+ typedef cds_test::thread base_class;
+
+ public:
+ Producer( cds_test::thread_pool& pool, PQueue& queue )
+ : base_class( pool )
+ , m_Queue( queue )
+ {}
+
+ Producer( Producer& src )
+ : base_class( src )
+ , m_Queue( src.m_Queue )
+ {}
+
+ virtual thread * clone()
+ {
+ return new Producer( *this );
+ }
+
+ virtual void test()
+ {
+ typedef typename PQueue::value_type value_type;
+ for ( array_type::const_iterator it = m_arr.begin(); it != m_arr.end(); ++it ) {
+ if ( !m_Queue.push( value_type( *it ) ))
+ ++m_nPushError;
+ }
+ }
+
+ void prepare( size_t nStart, size_t nEnd )
+ {
+ m_arr.reserve( nEnd - nStart );
+ for ( size_t i = nStart; i < nEnd; ++i )
+ m_arr.push_back( i );
+ shuffle( m_arr.begin(), m_arr.end() );
+ }
+
+ public:
+ PQueue& m_Queue;
+ size_t m_nPushError = 0;
+
+ typedef std::vector<size_t> array_type;
+ array_type m_arr;
+ };
+
+ template <class PQueue>
+ class Consumer: public cds_test::thread
+ {
+ typedef cds_test::thread base_class;
+
+ public:
+ Consumer( cds_test::thread_pool& pool, PQueue& queue )
+ : base_class( pool )
+ , m_Queue( queue )
+ {}
+
+ Consumer( Consumer& src )
+ : base_class( src )
+ , m_Queue( src.m_Queue )
+ {}
+
+ virtual thread * clone()
+ {
+ return new Consumer( *this );
+ }
+
+ virtual void test()
+ {
+ typedef typename PQueue::value_type value_type;
+ size_t nPrevKey;
+ value_type val;
+ if ( m_Queue.pop( val )) {
+ ++m_nPopSuccess;
+ nPrevKey = val.key;
+
+ while ( !m_Queue.empty() ) {
+ if ( m_Queue.pop( val )) {
+ ++m_nPopSuccess;
+ if ( val.key > nPrevKey )
+ ++m_nPopError;
+ else if ( val.key == nPrevKey )
+ ++m_nPopErrorEq;
+ nPrevKey = val.key;
+ }
+ else
+ ++m_nPopFailed;
+ }
+ }
+ else
+ ++m_nPopFailed;
+ }
+
+ public:
+ PQueue& m_Queue;
+ size_t m_nPopError = 0;
+ size_t m_nPopErrorEq = 0;
+ size_t m_nPopSuccess = 0;
+ size_t m_nPopFailed = 0;
+ };
+
+ protected:
+
+ template <class PQueue>
+ void test( PQueue& q )
+ {
+ size_t const nThreadItemCount = s_nQueueSize / s_nThreadCount;
+ s_nQueueSize = nThreadItemCount * s_nThreadCount;
+
+ cds_test::thread_pool& pool = get_pool();
+
+ propout() << std::make_pair( "thread_count", s_nThreadCount )
+ << std::make_pair( "push_count", s_nQueueSize );
+
+ // push
+ {
+ pool.add( new Producer<PQueue>( pool, q ), s_nThreadCount );
+
+ size_t nStart = 0;
+ for ( size_t i = 0; i < pool.size(); ++i ) {
+ static_cast<Producer<PQueue>&>( pool.get(i) ).prepare( nStart, nStart + nThreadItemCount );
+ nStart += nThreadItemCount;
+ }
+
+ std::chrono::milliseconds duration = pool.run();
+ propout() << std::make_pair( "producer_duration", duration );
+ }
+
+ // pop
+ {
+ pool.clear();
+ pool.add( new Consumer<PQueue>( pool, q ), s_nThreadCount );
+
+ std::chrono::milliseconds duration = pool.run();
+ propout() << std::make_pair( "consumer_duration", duration );
+
+ // Analyze result
+ size_t nTotalPopped = 0;
+ size_t nTotalError = 0;
+ size_t nTotalErrorEq = 0;
+ size_t nTotalFailed = 0;
+ for ( size_t i = 0; i < pool.size(); ++i ) {
+ Consumer<PQueue>& cons = static_cast<Consumer<PQueue>&>( pool.get(i));
+
+ nTotalPopped += cons.m_nPopSuccess;
+ nTotalError += cons.m_nPopError;
+ nTotalErrorEq += cons.m_nPopErrorEq;
+ nTotalFailed += cons.m_nPopFailed;
+ }
+
+ propout()
+ << std::make_pair( "total_popped", nTotalPopped )
+ << std::make_pair( "error_pop_double", nTotalErrorEq )
+ << std::make_pair( "error_priority_violation", nTotalError );
+
+ EXPECT_EQ( nTotalPopped, s_nQueueSize );
+ EXPECT_EQ( nTotalError, 0 );
+ EXPECT_EQ( nTotalErrorEq, 0 );
+ }
+
+ propout() << q.statistics();
+ }
+
+ public:
+ static void SetUpTestCase()\r
+ {\r
+ cds_test::config const& cfg = get_config( "pqueue_pop" );\r
+\r
+ s_nThreadCount = cfg.get_size_t( "ThreadCount", s_nThreadCount );
+ s_nQueueSize = cfg.get_size_t( "QueueSize", s_nQueueSize );
+
+ if ( s_nThreadCount == 0 )
+ s_nThreadCount = 1;
+ if ( s_nQueueSize == 0 )
+ s_nQueueSize = 1000;\r
+ }
+
+ //static void TearDownTestCase();
+ };
+
+#define CDSSTRESS_MSPriorityQueue( fixture_t, pqueue_t ) \
+ TEST_F( fixture_t, pqueue_t ) \
+ { \
+ typedef pqueue::Types<pqueue::simple_value>::pqueue_t pqueue_type; \
+ pqueue_type pq( s_nQueueSize ); \
+ test( pq ); \
+ }
+ CDSSTRESS_MSPriorityQueue( pqueue_pop, MSPriorityQueue_dyn_less )
+ CDSSTRESS_MSPriorityQueue( pqueue_pop, MSPriorityQueue_dyn_less_stat )
+ CDSSTRESS_MSPriorityQueue( pqueue_pop, MSPriorityQueue_dyn_cmp )
+ CDSSTRESS_MSPriorityQueue( pqueue_pop, MSPriorityQueue_dyn_mutex )
+
+#define CDSSTRESS_MSPriorityQueue_static( fixture_t, pqueue_t ) \
+ TEST_F( fixture_t, pqueue_t ) \
+ { \
+ typedef pqueue::Types<pqueue::simple_value>::pqueue_t pqueue_type; \
+ std::unique_ptr< pqueue_type > pq( new pqueue_type ); \
+ test( *pq.get() ); \
+ }
+ //CDSSTRESS_MSPriorityQueue( pqueue_pop, MSPriorityQueue_static_less )
+ //CDSSTRESS_MSPriorityQueue( pqueue_pop, MSPriorityQueue_static_less_stat )
+ //CDSSTRESS_MSPriorityQueue( pqueue_pop, MSPriorityQueue_static_cmp )
+ //CDSSTRESS_MSPriorityQueue( pqueue_pop, 1MSPriorityQueue_static_mutex )
+
+
+#define CDSSTRESS_PriorityQueue( fixture_t, pqueue_t ) \
+ TEST_F( fixture_t, pqueue_t ) \
+ { \
+ typedef pqueue::Types<pqueue::simple_value>::pqueue_t pqueue_type; \
+ pqueue_type pq; \
+ test( pq ); \
+ }
+ CDSSTRESS_PriorityQueue( pqueue_pop, FCPQueue_vector )
+ CDSSTRESS_PriorityQueue( pqueue_pop, FCPQueue_vector_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, FCPQueue_deque )
+ CDSSTRESS_PriorityQueue( pqueue_pop, FCPQueue_deque_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, FCPQueue_boost_deque )
+ CDSSTRESS_PriorityQueue( pqueue_pop, FCPQueue_boost_deque_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, FCPQueue_boost_stable_vector )
+ CDSSTRESS_PriorityQueue( pqueue_pop, FCPQueue_boost_stable_vector_stat )
+
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_HP_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_HP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_HP_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_HP_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_DHP_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_DHP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_DHP_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_DHP_min_stat )
+ // CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpi_max )
+ // CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpi_max_stat )
+ // CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpi_min )
+ // CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpi_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpb_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpb_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpb_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpb_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpt_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpt_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpt_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_gpt_min_stat )
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_shb_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_shb_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_shb_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_shb_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_sht_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_sht_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_sht_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, EllenBinTree_RCU_sht_min_stat )
+#endif
+
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_HP_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_HP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_HP_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_HP_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_DHP_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_DHP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_DHP_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_DHP_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_RCU_gpi_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_RCU_gpi_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_RCU_gpb_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_RCU_gpb_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_RCU_gpt_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_RCU_gpt_min )
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_RCU_shb_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_RCU_shb_min )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_RCU_sht_max )
+ CDSSTRESS_PriorityQueue( pqueue_pop, SkipList_RCU_sht_min )
+#endif
+
+ CDSSTRESS_PriorityQueue( pqueue_pop, StdPQueue_vector_spin )
+ CDSSTRESS_PriorityQueue( pqueue_pop, StdPQueue_vector_mutex )
+ CDSSTRESS_PriorityQueue( pqueue_pop, StdPQueue_deque_spin )
+ CDSSTRESS_PriorityQueue( pqueue_pop, StdPQueue_deque_mutex )
+
+} // namespace
--- /dev/null
+/*
+ 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 CDSSTRESS_PQUEUE_TYPES_H
+#define CDSSTRESS_PQUEUE_TYPES_H
+
+#include <cds/urcu/general_instant.h>
+#include <cds/urcu/general_buffered.h>
+#include <cds/urcu/general_threaded.h>
+#include <cds/urcu/signal_buffered.h>
+#include <cds/urcu/signal_threaded.h>
+
+#include <cds/container/mspriority_queue.h>
+#include <cds/container/fcpriority_queue.h>
+
+#include <cds/container/ellen_bintree_set_hp.h>
+#include <cds/container/ellen_bintree_set_dhp.h>
+#include <cds/container/ellen_bintree_set_rcu.h>
+
+#include <cds/container/skip_list_set_hp.h>
+#include <cds/container/skip_list_set_dhp.h>
+#include <cds/container/skip_list_set_rcu.h>
+
+#include <cds/sync/spinlock.h>
+
+#include <queue>
+#include <vector>
+#include <deque>
+#include <mutex> //unique_lock
+
+#include <boost/container/stable_vector.hpp>
+#include <boost/container/deque.hpp>
+
+#include <cds_test/stress_test.h>
+#include <cds_test/stat_ellenbintree_out.h>
+#include <cds_test/stat_skiplist_out.h>
+
+namespace pqueue {
+ namespace cc = cds::container;
+ namespace co = cds::opt;
+
+ namespace details {
+ template <typename T, typename Container, typename Lock, typename Less = std::less<typename Container::value_type> >
+ class StdPQueue
+ {
+ public:
+ typedef T value_type;
+ typedef std::priority_queue<value_type, Container, Less> pqueue_type;
+
+ private:
+ pqueue_type m_PQueue;
+ mutable Lock m_Lock;
+
+ typedef std::unique_lock<Lock> scoped_lock;
+
+ public:
+ bool push( value_type const& val )
+ {
+ scoped_lock l( m_Lock );
+ m_PQueue.push( val );
+ return true;
+ }
+
+ bool pop( value_type& dest )
+ {
+ scoped_lock l( m_Lock );
+ if ( !m_PQueue.empty() ) {
+ dest = m_PQueue.top();
+ m_PQueue.pop();
+ return true;
+ }
+ return false;
+ }
+
+ template <typename Q, typename MoveFunc>
+ bool pop_with( Q& dest, MoveFunc f )
+ {
+ scoped_lock l( m_Lock );
+ if ( !m_PQueue.empty() ) {
+ f( dest, m_PQueue.top() );
+ m_PQueue.pop();
+ return true;
+ }
+ return false;
+ }
+
+ void clear()
+ {
+ scoped_lock l( m_Lock );
+ while ( !m_PQueue.empty() )
+ m_PQueue.pop();
+ }
+
+ template <typename Func>
+ void clear_with( Func f )
+ {
+ scoped_lock l( m_Lock );
+ while ( !m_PQueue.empty() ) {
+ f( m_PQueue.top() );
+ m_PQueue.pop();
+ }
+ }
+
+ bool empty() const
+ {
+ return m_PQueue.empty();
+ }
+
+ size_t size() const
+ {
+ return m_PQueue.size();
+ }
+
+ cds::opt::none statistics() const
+ {
+ return cds::opt::none();
+ }
+ };
+
+ // EllenBinTree priority queue
+ template <typename GC>
+ struct EllenBinTreePQueue_pop_max
+ {
+ template <typename T, typename Tree>
+ bool operator()( T& dest, Tree& container ) const
+ {
+ typename Tree::guarded_ptr gp( container.extract_max() );
+ if ( gp )
+ dest = *gp;
+ return !gp.empty();
+ }
+ };
+
+ template <typename RCU>
+ struct EllenBinTreePQueue_pop_max< cds::urcu::gc<RCU> >
+ {
+ template <typename T, typename Tree>
+ bool operator()( T& dest, Tree& container ) const
+ {
+ typename Tree::exempt_ptr ep( container.extract_max() );
+ if ( ep )
+ dest = *ep;
+ return !ep.empty();
+ }
+ };
+
+ template <typename GC>
+ struct EllenBinTreePQueue_pop_min
+ {
+ template <typename T, typename Tree>
+ bool operator()( T& dest, Tree& container ) const
+ {
+ typename Tree::guarded_ptr gp( container.extract_min() );
+ if ( gp )
+ dest = *gp;
+ return !gp.empty();
+ }
+ };
+
+ template <typename RCU>
+ struct EllenBinTreePQueue_pop_min< cds::urcu::gc<RCU> >
+ {
+ template <typename T, typename Tree>
+ bool operator()( T& dest, Tree& container ) const
+ {
+ typename Tree::exempt_ptr ep( container.extract_min() );
+ if ( ep )
+ dest = *ep;
+ return !ep.empty();
+ }
+ };
+
+ template <typename GC, typename Key, typename T, typename Traits, bool Max = true>
+ class EllenBinTreePQueue : protected cds::container::EllenBinTreeSet< GC, Key, T, Traits >
+ {
+ typedef cds::container::EllenBinTreeSet< GC, Key, T, Traits > base_class;
+ template <typename GC2> friend struct EllenBinTreePQueue_pop_max;
+ template <typename GC2> friend struct EllenBinTreePQueue_pop_min;
+
+ public:
+ typedef T value_type;
+
+ bool push( value_type const& val )
+ {
+ return base_class::insert( val );
+ }
+
+ bool pop( value_type& dest )
+ {
+ return Max ? EllenBinTreePQueue_pop_max< typename base_class::gc >()(dest, *this)
+ : EllenBinTreePQueue_pop_min< typename base_class::gc >()(dest, *this);
+ }
+
+ void clear()
+ {
+ base_class::clear();
+ }
+
+ bool empty() const
+ {
+ return base_class::empty();
+ }
+
+ size_t size() const
+ {
+ return base_class::size();
+ }
+
+ typename base_class::stat const& statistics() const
+ {
+ return base_class::statistics();
+ }
+ };
+
+
+ // SkipList property queue
+ template <typename GC>
+ struct SkipListPQueue_pop_max
+ {
+ template <typename T, typename Set>
+ bool operator()( T& dest, Set& container ) const
+ {
+ typename Set::guarded_ptr gp( container.extract_max() );
+ if ( gp )
+ dest = *gp;
+ return !gp.empty();
+ }
+ };
+
+ template <typename RCU>
+ struct SkipListPQueue_pop_max< cds::urcu::gc<RCU> >
+ {
+ template <typename T, typename Set>
+ bool operator()( T& dest, Set& container ) const
+ {
+ typename Set::exempt_ptr ep( container.extract_max() );
+ if ( ep )
+ dest = *ep;
+ return !ep.empty();
+ }
+ };
+
+ template <typename GC>
+ struct SkipListPQueue_pop_min
+ {
+ template <typename T, typename Set>
+ bool operator()( T& dest, Set& container ) const
+ {
+ typename Set::guarded_ptr gp( container.extract_min() );
+ if ( gp )
+ dest = *gp;
+ return !gp.empty();
+ }
+ };
+
+ template <typename RCU>
+ struct SkipListPQueue_pop_min< cds::urcu::gc<RCU> >
+ {
+ template <typename T, typename Set>
+ bool operator()( T& dest, Set& container ) const
+ {
+ typename Set::exempt_ptr ep( container.extract_min() );
+ if ( ep )
+ dest = *ep;
+ return !ep.empty();
+ }
+ };
+
+ template <typename GC, typename T, typename Traits, bool Max = true>
+ class SkipListPQueue : protected cds::container::SkipListSet< GC, T, Traits >
+ {
+ typedef cds::container::SkipListSet< GC, T, Traits > base_class;
+ template <typename GC2> friend struct SkipListPQueue_pop_max;
+ template <typename GC2> friend struct SkipListPQueue_pop_min;
+
+ public:
+ typedef T value_type;
+
+ bool push( value_type const& val )
+ {
+ return base_class::insert( val );
+ }
+
+ bool pop( value_type& dest )
+ {
+ return Max ? SkipListPQueue_pop_max< typename base_class::gc >()(dest, *this)
+ : SkipListPQueue_pop_min< typename base_class::gc >()(dest, *this);
+ }
+
+ void clear()
+ {
+ base_class::clear();
+ }
+
+ bool empty() const
+ {
+ return base_class::empty();
+ }
+
+ size_t size() const
+ {
+ return base_class::size();
+ }
+
+ typename base_class::stat const& statistics() const
+ {
+ return base_class::statistics();
+ }
+ };
+
+ } // namespace details
+
+ template <typename Value>
+ struct Types
+ {
+ static size_t const c_nBoundedCapacity = 1024 * 1024 * 16;
+
+ typedef std::less<Value> less;
+
+ struct cmp {
+ int operator()( Value const& v1, Value const& v2 ) const
+ {
+ return less()( v1, v2 ) ? -1 : less()( v2, v1 ) ? 1 : 0;
+ }
+ };
+
+ 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
+
+
+ // MSPriorityQueue
+ struct traits_MSPriorityQueue_static_less : public
+ cc::mspriority_queue::make_traits <
+ co::buffer < co::v::static_buffer< char, c_nBoundedCapacity > >
+ > ::type
+ {};
+ typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_static_less > MSPriorityQueue_static_less;
+
+ struct traits_MSPriorityQueue_static_less_stat : public cc::mspriority_queue::traits
+ {
+ typedef co::v::static_buffer< char, c_nBoundedCapacity > buffer;
+ typedef cc::mspriority_queue::stat<> stat;
+ };
+ typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_static_less_stat > MSPriorityQueue_static_less_stat;
+
+ struct traits_MSPriorityQueue_static_cmp : public
+ cc::mspriority_queue::make_traits <
+ co::buffer< co::v::static_buffer< char, c_nBoundedCapacity > >
+ , co::compare < cmp >
+ > ::type
+ {};
+ typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_static_cmp > MSPriorityQueue_static_cmp;
+
+ struct traits_MSPriorityQueue_static_mutex : public
+ cc::mspriority_queue::make_traits<
+ co::buffer< co::v::static_buffer< char, c_nBoundedCapacity > >
+ , co::lock_type<std::mutex>
+ >::type
+ {};
+ typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_static_mutex > MSPriorityQueue_static_mutex;
+
+ struct traits_MSPriorityQueue_dyn_less : public
+ cc::mspriority_queue::make_traits<
+ co::buffer< co::v::dynamic_buffer< char > >
+ >::type
+ {};
+ typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_dyn_less > MSPriorityQueue_dyn_less;
+
+ struct traits_MSPriorityQueue_dyn_less_stat : public
+ cc::mspriority_queue::make_traits <
+ co::buffer< co::v::dynamic_buffer< char > >
+ , co::stat < cc::mspriority_queue::stat<> >
+ > ::type
+ {};
+ typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_dyn_less_stat > MSPriorityQueue_dyn_less_stat;
+
+ struct traits_MSPriorityQueue_dyn_cmp : public
+ cc::mspriority_queue::make_traits <
+ co::buffer< co::v::dynamic_buffer< char > >
+ , co::compare < cmp >
+ > ::type
+ {};
+ typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_dyn_cmp > MSPriorityQueue_dyn_cmp;
+
+ struct traits_MSPriorityQueue_dyn_mutex : public
+ cc::mspriority_queue::make_traits <
+ co::buffer< co::v::dynamic_buffer< char > >
+ , co::lock_type < std::mutex >
+ > ::type
+ {};
+ typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_dyn_mutex > MSPriorityQueue_dyn_mutex;
+
+
+ // Priority queue based on EllenBinTreeSet
+ struct traits_EllenBinTree_max :
+ public cc::ellen_bintree::make_set_traits<
+ cc::ellen_bintree::key_extractor< typename Value::key_extractor >
+ ,cc::opt::less< std::less<Value> >
+ ,co::stat< cc::ellen_bintree::stat<> >
+ >::type
+ {};
+ typedef details::EllenBinTreePQueue< cds::gc::HP, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_HP_max;
+ typedef details::EllenBinTreePQueue< cds::gc::DHP, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_DHP_max;
+ typedef details::EllenBinTreePQueue< rcu_gpi, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_RCU_gpi_max;
+ typedef details::EllenBinTreePQueue< rcu_gpb, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_RCU_gpb_max;
+ typedef details::EllenBinTreePQueue< rcu_gpt, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_RCU_gpt_max;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef details::EllenBinTreePQueue< rcu_shb, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_RCU_shb_max;
+ typedef details::EllenBinTreePQueue< rcu_sht, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_RCU_sht_max;
+#endif
+
+ struct traits_EllenBinTree_max_stat :
+ public cc::ellen_bintree::make_set_traits<
+ cc::ellen_bintree::key_extractor< typename Value::key_extractor >
+ ,cc::opt::less< std::less<Value> >
+ ,co::stat< cc::ellen_bintree::stat<> >
+ >::type
+ {};
+ typedef details::EllenBinTreePQueue< cds::gc::HP, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_HP_max_stat;
+ typedef details::EllenBinTreePQueue< cds::gc::DHP, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_DHP_max_stat;
+ typedef details::EllenBinTreePQueue< rcu_gpi, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_RCU_gpi_max_stat;
+ typedef details::EllenBinTreePQueue< rcu_gpb, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_RCU_gpb_max_stat;
+ typedef details::EllenBinTreePQueue< rcu_gpt, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_RCU_gpt_max_stat;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef details::EllenBinTreePQueue< rcu_shb, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_RCU_shb_max_stat;
+ typedef details::EllenBinTreePQueue< rcu_sht, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_RCU_sht_max_stat;
+#endif
+
+ struct traits_EllenBinTree_min :
+ public cc::ellen_bintree::make_set_traits<
+ cc::ellen_bintree::key_extractor< typename Value::key_extractor >
+ ,cc::opt::less< std::greater<Value> >
+ >::type
+ {};
+ typedef details::EllenBinTreePQueue< cds::gc::HP, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_HP_min;
+ typedef details::EllenBinTreePQueue< cds::gc::DHP, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_DHP_min;
+ typedef details::EllenBinTreePQueue< rcu_gpi, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_RCU_gpi_min;
+ typedef details::EllenBinTreePQueue< rcu_gpb, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_RCU_gpb_min;
+ typedef details::EllenBinTreePQueue< rcu_gpt, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_RCU_gpt_min;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef details::EllenBinTreePQueue< rcu_shb, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_RCU_shb_min;
+ typedef details::EllenBinTreePQueue< rcu_sht, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_RCU_sht_min;
+#endif
+
+ struct traits_EllenBinTree_min_stat :
+ public cc::ellen_bintree::make_set_traits<
+ cc::ellen_bintree::key_extractor< typename Value::key_extractor >
+ ,cc::opt::less< std::greater<Value> >
+ ,co::stat< cc::ellen_bintree::stat<> >
+ >::type
+ {};
+ typedef details::EllenBinTreePQueue< cds::gc::HP, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_HP_min_stat;
+ typedef details::EllenBinTreePQueue< cds::gc::DHP, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_DHP_min_stat;
+ typedef details::EllenBinTreePQueue< rcu_gpi, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_RCU_gpi_min_stat;
+ typedef details::EllenBinTreePQueue< rcu_gpb, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_RCU_gpb_min_stat;
+ typedef details::EllenBinTreePQueue< rcu_gpt, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_RCU_gpt_min_stat;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef details::EllenBinTreePQueue< rcu_shb, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_RCU_shb_min_stat;
+ typedef details::EllenBinTreePQueue< rcu_sht, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_RCU_sht_min_stat;
+#endif
+
+ // Priority queue based on SkipListSet
+ struct traits_SkipList_max :
+ public cc::skip_list::make_traits <
+ cc::opt::less < std::less<Value> >
+ > ::type
+ {};
+ typedef details::SkipListPQueue< cds::gc::HP, Value, traits_SkipList_max > SkipList_HP_max;
+ typedef details::SkipListPQueue< cds::gc::DHP, Value, traits_SkipList_max > SkipList_DHP_max;
+ typedef details::SkipListPQueue< rcu_gpi, Value, traits_SkipList_max > SkipList_RCU_gpi_max;
+ typedef details::SkipListPQueue< rcu_gpb, Value, traits_SkipList_max > SkipList_RCU_gpb_max;
+ typedef details::SkipListPQueue< rcu_gpt, Value, traits_SkipList_max > SkipList_RCU_gpt_max;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef details::SkipListPQueue< rcu_shb, Value, traits_SkipList_max > SkipList_RCU_shb_max;
+ typedef details::SkipListPQueue< rcu_sht, Value, traits_SkipList_max > SkipList_RCU_sht_max;
+#endif
+
+ struct traits_SkipList_max_stat :
+ public cc::skip_list::make_traits<
+ cc::opt::less< std::less<Value> >
+ ,co::stat< cc::skip_list::stat<> >
+ >::type
+ {};
+ typedef details::SkipListPQueue< cds::gc::HP, Value, traits_SkipList_max_stat > SkipList_HP_max_stat;
+ typedef details::SkipListPQueue< cds::gc::DHP, Value, traits_SkipList_max_stat > SkipList_DHP_max_stat;
+ typedef details::SkipListPQueue< rcu_gpi, Value, traits_SkipList_max_stat > SkipList_RCU_gpi_max_stat;
+ typedef details::SkipListPQueue< rcu_gpb, Value, traits_SkipList_max_stat > SkipList_RCU_gpb_max_stat;
+ typedef details::SkipListPQueue< rcu_gpt, Value, traits_SkipList_max_stat > SkipList_RCU_gpt_max_stat;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef details::SkipListPQueue< rcu_shb, Value, traits_SkipList_max_stat > SkipList_RCU_shb_max_stat;
+ typedef details::SkipListPQueue< rcu_sht, Value, traits_SkipList_max_stat > SkipList_RCU_sht_max_stat;
+#endif
+
+ struct traits_SkipList_min :
+ public cc::skip_list::make_traits<
+ cc::opt::less< std::greater<Value> >
+ >::type
+ {};
+ typedef details::SkipListPQueue< cds::gc::HP, Value, traits_SkipList_min, false > SkipList_HP_min;
+ typedef details::SkipListPQueue< cds::gc::DHP, Value, traits_SkipList_min, false > SkipList_DHP_min;
+ typedef details::SkipListPQueue< rcu_gpi, Value, traits_SkipList_min, false > SkipList_RCU_gpi_min;
+ typedef details::SkipListPQueue< rcu_gpb, Value, traits_SkipList_min, false > SkipList_RCU_gpb_min;
+ typedef details::SkipListPQueue< rcu_gpt, Value, traits_SkipList_min, false > SkipList_RCU_gpt_min;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef details::SkipListPQueue< rcu_shb, Value, traits_SkipList_min, false > SkipList_RCU_shb_min;
+ typedef details::SkipListPQueue< rcu_sht, Value, traits_SkipList_min, false > SkipList_RCU_sht_min;
+#endif
+
+ struct traits_SkipList_min_stat :
+ public cc::skip_list::make_traits<
+ cc::opt::less< std::greater<Value> >
+ ,co::stat< cc::skip_list::stat<> >
+ >::type
+ {};
+ typedef details::SkipListPQueue< cds::gc::HP, Value, traits_SkipList_min_stat, false > SkipList_HP_min_stat;
+ typedef details::SkipListPQueue< cds::gc::DHP, Value, traits_SkipList_min_stat, false > SkipList_DHP_min_stat;
+ typedef details::SkipListPQueue< rcu_gpi, Value, traits_SkipList_min_stat, false > SkipList_RCU_gpi_min_stat;
+ typedef details::SkipListPQueue< rcu_gpb, Value, traits_SkipList_min_stat, false > SkipList_RCU_gpb_min_stat;
+ typedef details::SkipListPQueue< rcu_gpt, Value, traits_SkipList_min_stat, false > SkipList_RCU_gpt_min_stat;
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ typedef details::SkipListPQueue< rcu_shb, Value, traits_SkipList_min_stat, false > SkipList_RCU_shb_min_stat;
+ typedef details::SkipListPQueue< rcu_sht, Value, traits_SkipList_min_stat, false > SkipList_RCU_sht_min_stat;
+#endif
+
+
+ // FCPriorityQueue
+ struct traits_FCPQueue_stat : public
+ cds::container::fcpqueue::make_traits <
+ cds::opt::stat < cds::container::fcpqueue::stat<> >
+ > ::type
+ {};
+
+ typedef cds::container::FCPriorityQueue< Value > FCPQueue_vector;
+ typedef cds::container::FCPriorityQueue< Value
+ ,std::priority_queue<Value>
+ ,traits_FCPQueue_stat
+ > FCPQueue_vector_stat;
+
+ typedef cds::container::FCPriorityQueue< Value
+ ,std::priority_queue<Value, std::deque<Value> >
+ > FCPQueue_deque;
+ typedef cds::container::FCPriorityQueue< Value
+ ,std::priority_queue<Value, std::deque<Value> >
+ ,traits_FCPQueue_stat
+ > FCPQueue_deque_stat;
+
+ typedef cds::container::FCPriorityQueue< Value
+ ,std::priority_queue<Value, boost::container::deque<Value> >
+ > FCPQueue_boost_deque;
+ typedef cds::container::FCPriorityQueue< Value
+ ,std::priority_queue<Value, boost::container::deque<Value> >
+ ,traits_FCPQueue_stat
+ > FCPQueue_boost_deque_stat;
+
+ typedef cds::container::FCPriorityQueue< Value
+ ,std::priority_queue<Value, boost::container::stable_vector<Value> >
+ > FCPQueue_boost_stable_vector;
+ typedef cds::container::FCPriorityQueue< Value
+ ,std::priority_queue<Value, boost::container::stable_vector<Value> >
+ ,traits_FCPQueue_stat
+ > FCPQueue_boost_stable_vector_stat;
+
+ /// Standard priority_queue
+ typedef details::StdPQueue< Value, std::vector<Value>, cds::sync::spin> StdPQueue_vector_spin;
+ typedef details::StdPQueue< Value, std::vector<Value>, std::mutex > StdPQueue_vector_mutex;
+ typedef details::StdPQueue< Value, std::deque<Value>, cds::sync::spin> StdPQueue_deque_spin;
+ typedef details::StdPQueue< Value, std::deque<Value>, std::mutex > StdPQueue_deque_mutex;
+ };
+
+
+ //template <typename Stat>
+ //static inline void check_statistics( Stat const& /*s*/ )
+ //{}
+
+ //static inline void check_statistics( cds::container::ellen_bintree::stat<> const& s )
+ //{
+ // CPPUNIT_CHECK_CURRENT( s.m_nInternalNodeCreated.get() == s.m_nInternalNodeDeleted.get() );
+ // CPPUNIT_CHECK_CURRENT( s.m_nUpdateDescCreated.get() == s.m_nUpdateDescDeleted.get() );
+ //}
+} // namespace pqueue
+
+
+// *********************************************
+// Priority queue statistics
+namespace cds_test {
+
+ static inline property_stream& operator <<( property_stream& o, cds::opt::none )
+ {
+ return o;
+ }
+
+ static inline property_stream& operator <<( property_stream& o, cds::container::fcpqueue::empty_stat const& )
+ {
+ return o;
+ }
+
+ static inline property_stream& operator <<( property_stream& o, cds::container::fcpqueue::stat<> const& s )
+ {
+ return o
+ << CDSSTRESS_STAT_OUT( s, m_nPush )
+ << CDSSTRESS_STAT_OUT( s, m_nPushMove )
+ << CDSSTRESS_STAT_OUT( s, m_nPop )
+ << CDSSTRESS_STAT_OUT( s, m_nFailedPop )
+ << CDSSTRESS_STAT_OUT_( "combining_factor", s.combining_factor() )
+ << CDSSTRESS_STAT_OUT( s, m_nOperationCount )
+ << CDSSTRESS_STAT_OUT( s, m_nCombiningCount )
+ << CDSSTRESS_STAT_OUT( s, m_nCompactPublicationList )
+ << CDSSTRESS_STAT_OUT( s, m_nDeactivatePubRecord )
+ << CDSSTRESS_STAT_OUT( s, m_nActivatePubRecord )
+ << CDSSTRESS_STAT_OUT( s, m_nPubRecordCreated )
+ << CDSSTRESS_STAT_OUT( s, m_nPubRecordDeteted )
+ << CDSSTRESS_STAT_OUT( s, m_nAcquirePubRecCount )
+ << CDSSTRESS_STAT_OUT( s, m_nReleasePubRecCount );
+ }
+
+ static inline property_stream& operator <<( property_stream& o, cds::container::mspriority_queue::empty_stat const& /*s*/ )
+ {
+ return o;
+ }
+
+ static inline property_stream& operator <<( property_stream& o, cds::container::mspriority_queue::stat<> const& s )
+ {
+ return o
+ << CDSSTRESS_STAT_OUT( s, m_nPushCount )
+ << CDSSTRESS_STAT_OUT( s, m_nPopCount )
+ << CDSSTRESS_STAT_OUT( s, m_nPushFailCount )
+ << CDSSTRESS_STAT_OUT( s, m_nPopFailCount )
+ << CDSSTRESS_STAT_OUT( s, m_nPushHeapifySwapCount )
+ << CDSSTRESS_STAT_OUT( s, m_nPopHeapifySwapCount );
+ }
+
+} // namespace cds_test
+
+#endif // #ifndef CDSSTRESS_PQUEUE_TYPES_H
--- /dev/null
+/*
+ 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 "pqueue_type.h"
+#include "item.h"
+
+namespace pqueue {
+
+ static size_t s_nThreadCount = 8;
+ static size_t s_nQueueSize = 2000000;
+
+ class pqueue_push: public cds_test::stress_fixture
+ {
+ typedef cds_test::stress_fixture base_class;
+
+ protected:
+ template <class PQueue>
+ class Producer: public cds_test::thread
+ {
+ typedef cds_test::thread base_class;
+
+ public:
+ Producer( cds_test::thread_pool& pool, PQueue& queue )
+ : base_class( pool )
+ , m_Queue( queue )
+ {}
+
+ Producer( Producer& src )
+ : base_class( src )
+ , m_Queue( src.m_Queue )
+ {}
+
+ virtual thread * clone()
+ {
+ return new Producer( *this );
+ }
+
+ virtual void test()
+ {
+ typedef typename PQueue::value_type value_type;
+
+ for ( auto it = m_arr.begin(); it != m_arr.end(); ++it ) {
+ if ( !m_Queue.push( value_type( *it ) ))
+ ++m_nPushError;
+ }
+ }
+
+ void prepare( size_t nStart, size_t nEnd )
+ {
+ m_arr.reserve( nEnd - nStart );
+ for ( size_t i = nStart; i < nEnd; ++i )
+ m_arr.push_back( i );
+ shuffle( m_arr.begin(), m_arr.end() );
+ }
+
+ public:
+ PQueue& m_Queue;
+ size_t m_nPushError = 0;
+ std::vector<size_t> m_arr;
+ };
+
+ protected:
+ template <class PQueue>
+ void analyze( PQueue& q )
+ {
+ cds_test::thread_pool& pool = get_pool();
+
+ for ( size_t i = 0; i < pool.size(); ++i ) {
+ Producer<PQueue>& prod = static_cast<Producer<PQueue>&>(pool.get( i ));
+ EXPECT_EQ( prod.m_nPushError, 0 ) << "producer=" << i;
+ }
+ EXPECT_FALSE( q.empty());
+
+ typedef std::vector<size_t> vector_type;
+ vector_type arr;
+ arr.reserve( s_nQueueSize );
+
+ size_t nPopped = 0;
+ typename PQueue::value_type val;
+ while ( q.pop( val )) {
+ nPopped++;
+ arr.push_back( val.key );
+ }
+
+ EXPECT_EQ( arr.size(), s_nQueueSize );
+ auto it = arr.begin();
+ size_t nPrev = *it;
+ ++it;
+ for ( auto itEnd = arr.end(); it != itEnd; ++it ) {
+ EXPECT_EQ( nPrev - 1, *it );
+ nPrev = *it;
+ }
+ }
+
+ template <class PQueue>
+ void test( PQueue& q )
+ {
+ cds_test::thread_pool& pool = get_pool();
+ pool.add( new Producer<PQueue>( pool, q ), s_nThreadCount );
+
+ size_t nStart = 0;
+ size_t nThreadItemCount = s_nQueueSize / s_nThreadCount;
+ s_nQueueSize = nThreadItemCount * s_nThreadCount;
+
+ for ( size_t i = 0; i < pool.size(); ++i ) {
+ static_cast<Producer<PQueue>&>(pool.get( i )).prepare( nStart, nStart + nThreadItemCount );
+ nStart += nThreadItemCount;
+ }
+
+ propout() << std::make_pair( "thread_count", s_nThreadCount )
+ << std::make_pair( "push_count", s_nQueueSize );
+
+ std::chrono::milliseconds duration = pool.run();
+ propout() << std::make_pair( "duration", duration );
+
+ analyze( q );
+
+ propout() << q.statistics();
+ }
+
+ public:
+ static void SetUpTestCase()\r
+ {\r
+ cds_test::config const& cfg = get_config( "pqueue_push" );\r
+\r
+ s_nThreadCount = cfg.get_size_t( "ThreadCount", s_nThreadCount );
+ s_nQueueSize = cfg.get_size_t( "QueueSize", s_nQueueSize );
+
+ if ( s_nThreadCount == 0 )
+ s_nThreadCount = 1;
+ if ( s_nQueueSize == 0 )
+ s_nQueueSize = 1000;\r
+ }
+
+ //static void TearDownTestCase();
+ };
+
+#define CDSSTRESS_MSPriorityQueue( fixture_t, pqueue_t ) \
+ TEST_F( fixture_t, pqueue_t ) \
+ { \
+ typedef pqueue::Types<pqueue::simple_value>::pqueue_t pqueue_type; \
+ pqueue_type pq( s_nQueueSize ); \
+ test( pq ); \
+ }
+ CDSSTRESS_MSPriorityQueue( pqueue_push, MSPriorityQueue_dyn_less )
+ CDSSTRESS_MSPriorityQueue( pqueue_push, MSPriorityQueue_dyn_less_stat )
+ CDSSTRESS_MSPriorityQueue( pqueue_push, MSPriorityQueue_dyn_cmp )
+ CDSSTRESS_MSPriorityQueue( pqueue_push, MSPriorityQueue_dyn_mutex )
+
+#define CDSSTRESS_MSPriorityQueue_static( fixture_t, pqueue_t ) \
+ TEST_F( fixture_t, pqueue_t ) \
+ { \
+ typedef pqueue::Types<pqueue::simple_value>::pqueue_t pqueue_type; \
+ std::unique_ptr< pqueue_type > pq( new pqueue_type ); \
+ test( *pq.get() ); \
+ }
+ //CDSSTRESS_MSPriorityQueue( pqueue_push, MSPriorityQueue_static_less )
+ //CDSSTRESS_MSPriorityQueue( pqueue_push, MSPriorityQueue_static_less_stat )
+ //CDSSTRESS_MSPriorityQueue( pqueue_push, MSPriorityQueue_static_cmp )
+ //CDSSTRESS_MSPriorityQueue( pqueue_push, 1MSPriorityQueue_static_mutex )
+
+
+#define CDSSTRESS_PriorityQueue( fixture_t, pqueue_t ) \
+ TEST_F( fixture_t, pqueue_t ) \
+ { \
+ typedef pqueue::Types<pqueue::simple_value>::pqueue_t pqueue_type; \
+ pqueue_type pq; \
+ test( pq ); \
+ }
+ CDSSTRESS_PriorityQueue( pqueue_push, FCPQueue_vector )
+ CDSSTRESS_PriorityQueue( pqueue_push, FCPQueue_vector_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, FCPQueue_deque )
+ CDSSTRESS_PriorityQueue( pqueue_push, FCPQueue_deque_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, FCPQueue_boost_deque )
+ CDSSTRESS_PriorityQueue( pqueue_push, FCPQueue_boost_deque_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, FCPQueue_boost_stable_vector )
+ CDSSTRESS_PriorityQueue( pqueue_push, FCPQueue_boost_stable_vector_stat )
+
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_HP_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_HP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_HP_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_HP_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_DHP_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_DHP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_DHP_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_DHP_min_stat )
+ // CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpi_max )
+ // CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpi_max_stat )
+ // CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpi_min )
+ // CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpi_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpb_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpb_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpb_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpb_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpt_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpt_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpt_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_gpt_min_stat )
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_shb_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_shb_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_shb_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_shb_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_sht_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_sht_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_sht_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, EllenBinTree_RCU_sht_min_stat )
+#endif
+
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_HP_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_HP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_HP_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_HP_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_DHP_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_DHP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_DHP_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_DHP_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_RCU_gpi_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_RCU_gpi_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_RCU_gpb_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_RCU_gpb_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_RCU_gpt_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_RCU_gpt_min )
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_RCU_shb_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_RCU_shb_min )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_RCU_sht_max )
+ CDSSTRESS_PriorityQueue( pqueue_push, SkipList_RCU_sht_min )
+#endif
+
+ CDSSTRESS_PriorityQueue( pqueue_push, StdPQueue_vector_spin )
+ CDSSTRESS_PriorityQueue( pqueue_push, StdPQueue_vector_mutex )
+ CDSSTRESS_PriorityQueue( pqueue_push, StdPQueue_deque_spin )
+ CDSSTRESS_PriorityQueue( pqueue_push, StdPQueue_deque_mutex )
+
+} // namespace queue
+
--- /dev/null
+/*
+ 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 "pqueue_type.h"
+#include "item.h"
+
+namespace {
+ static size_t s_nPushThreadCount = 4;
+ static size_t s_nPopThreadCount = 4;
+ static size_t s_nQueueSize = 2000000;
+
+ atomics::atomic<size_t> s_nProducerCount(0);
+
+ class pqueue_push_pop: public cds_test::stress_fixture
+ {
+ typedef cds_test::stress_fixture base_class;
+
+ public:
+ enum {
+ producer_thread,
+ consumer_thread
+ };
+
+ template <class PQueue>
+ class Producer: public cds_test::thread
+ {
+ typedef cds_test::thread base_class;
+
+ public:
+ Producer( cds_test::thread_pool& pool, PQueue& queue )
+ : base_class( pool, producer_thread )
+ , m_Queue( queue )
+ {}
+
+ Producer( Producer& src )
+ : base_class( src )
+ , m_Queue( src.m_Queue )
+ {}
+
+ virtual thread * clone()
+ {
+ return new Producer( *this );
+ }
+
+ virtual void test()
+ {
+ typedef typename PQueue::value_type value_type;
+
+ for ( auto it = m_arr.begin(); it != m_arr.end(); ++it ) {
+ if ( !m_Queue.push( value_type( *it )))
+ ++m_nPushError;
+ }
+
+ s_nProducerCount.fetch_sub( 1, atomics::memory_order_relaxed );
+ }
+
+ void prepare( size_t nStart, size_t nEnd )
+ {
+ m_arr.reserve( nEnd - nStart );
+ for ( size_t i = nStart; i < nEnd; ++i )
+ m_arr.push_back( i );
+ shuffle( m_arr.begin(), m_arr.end() );
+ }
+
+ public:
+ PQueue& m_Queue;
+ size_t m_nPushError = 0;
+
+ typedef std::vector<size_t> array_type;
+ array_type m_arr;
+ };
+
+ template <class PQueue>
+ class Consumer: public cds_test::thread
+ {
+ typedef cds_test::thread base_class;
+
+ public:
+ Consumer( cds_test::thread_pool& pool, PQueue& queue )
+ : base_class( pool, consumer_thread )
+ , m_Queue( queue )
+ {}
+
+ Consumer( Consumer& src )
+ : base_class( src )
+ , m_Queue( src.m_Queue )
+ {}
+
+ virtual thread * clone()
+ {
+ return new Consumer( *this );
+ }
+
+ virtual void test()
+ {
+ typename PQueue::value_type val;
+ while ( s_nProducerCount.load( atomics::memory_order_relaxed ) != 0 || !m_Queue.empty() ) {
+ if ( m_Queue.pop( val ))
+ ++m_nPopSuccess;
+ else
+ ++m_nPopFailed;
+ }
+ }
+
+ public:
+ PQueue& m_Queue;
+ size_t m_nPopSuccess = 0;
+ size_t m_nPopFailed = 0;
+
+ typedef std::vector<size_t> array_type;
+ array_type m_arr;
+ };
+
+ protected:
+
+ template <class PQueue>
+ void test( PQueue& q )
+ {
+ size_t const nThreadItemCount = s_nQueueSize / s_nPushThreadCount;
+ s_nQueueSize = nThreadItemCount * s_nPushThreadCount;
+
+ propout() << std::make_pair( "producer_count", s_nPushThreadCount )
+ << std::make_pair( "consunmer_count", s_nPopThreadCount )
+ << std::make_pair( "queue_size", s_nQueueSize );
+
+ cds_test::thread_pool& pool = get_pool();
+ pool.add( new Producer<PQueue>( pool, q ), s_nPushThreadCount );
+
+ size_t nStart = 0;
+ for ( size_t i = 0; i < pool.size(); ++i ) {
+ static_cast<Producer<PQueue>&>(pool.get( i )).prepare( nStart, nStart + nThreadItemCount );
+ nStart += nThreadItemCount;
+ }
+
+ pool.add( new Consumer<PQueue>( pool, q ), s_nPopThreadCount );
+
+ s_nProducerCount.store( s_nPushThreadCount, atomics::memory_order_release );
+
+ std::chrono::milliseconds duration = pool.run();
+ propout() << std::make_pair( "duration", duration );
+
+ // Analyze result
+ size_t nTotalPopped = 0;
+ size_t nPushFailed = 0;
+ size_t nPopFailed = 0;
+ for ( size_t i = 0; i < pool.size(); ++i ) {
+ cds_test::thread& t = pool.get(i);
+ if ( t.type() == consumer_thread ) {
+ Consumer<PQueue>& cons = static_cast<Consumer<PQueue>&>( t );
+ nTotalPopped += cons.m_nPopSuccess;
+ nPopFailed += cons.m_nPopFailed;
+ }
+ else {
+ assert( t.type() == producer_thread );
+ Producer<PQueue>& prod = static_cast<Producer<PQueue>&>(t);
+ nPushFailed += prod.m_nPushError;
+ EXPECT_EQ( prod.m_nPushError , 0 ) << "producer " << i;
+ }
+ }
+
+ propout() << std::make_pair( "total_popped", nTotalPopped )
+ << std::make_pair( "empty_pop", nPopFailed )
+ << std::make_pair( "push_error", nPushFailed );
+
+ EXPECT_EQ( nTotalPopped, s_nQueueSize );
+ EXPECT_EQ( nPushFailed, 0 );
+
+ //check_statistics( testQueue.statistics() );
+ propout() << q.statistics();
+ }
+
+ public:
+ static void SetUpTestCase()\r
+ {\r
+ cds_test::config const& cfg = get_config( "pqueue_push_pop" );\r
+\r
+ s_nPushThreadCount = cfg.get_size_t( "PushThreadCount", s_nPushThreadCount );
+ s_nPopThreadCount = cfg.get_size_t( "PopThreadCount", s_nPopThreadCount );
+ s_nQueueSize = cfg.get_size_t( "QueueSize", s_nQueueSize );
+
+ if ( s_nPushThreadCount == 0 )
+ s_nPushThreadCount = 1;
+ if ( s_nPopThreadCount == 0 )
+ s_nPopThreadCount = 1;
+ if ( s_nQueueSize == 0 )
+ s_nQueueSize = 1000;\r
+ }
+
+ //static void TearDownTestCase();
+ };
+
+#define CDSSTRESS_MSPriorityQueue( fixture_t, pqueue_t ) \
+ TEST_F( fixture_t, pqueue_t ) \
+ { \
+ typedef pqueue::Types<pqueue::simple_value>::pqueue_t pqueue_type; \
+ pqueue_type pq( s_nQueueSize ); \
+ test( pq ); \
+ }
+ CDSSTRESS_MSPriorityQueue( pqueue_push_pop, MSPriorityQueue_dyn_less )
+ CDSSTRESS_MSPriorityQueue( pqueue_push_pop, MSPriorityQueue_dyn_less_stat )
+ CDSSTRESS_MSPriorityQueue( pqueue_push_pop, MSPriorityQueue_dyn_cmp )
+ CDSSTRESS_MSPriorityQueue( pqueue_push_pop, MSPriorityQueue_dyn_mutex )
+
+#define CDSSTRESS_MSPriorityQueue_static( fixture_t, pqueue_t ) \
+ TEST_F( fixture_t, pqueue_t ) \
+ { \
+ typedef pqueue::Types<pqueue::simple_value>::pqueue_t pqueue_type; \
+ std::unique_ptr< pqueue_type > pq( new pqueue_type ); \
+ test( *pq.get() ); \
+ }
+ //CDSSTRESS_MSPriorityQueue( pqueue_push_pop, MSPriorityQueue_static_less )
+ //CDSSTRESS_MSPriorityQueue( pqueue_push_pop, MSPriorityQueue_static_less_stat )
+ //CDSSTRESS_MSPriorityQueue( pqueue_push_pop, MSPriorityQueue_static_cmp )
+ //CDSSTRESS_MSPriorityQueue( pqueue_push_pop, 1MSPriorityQueue_static_mutex )
+
+
+#define CDSSTRESS_PriorityQueue( fixture_t, pqueue_t ) \
+ TEST_F( fixture_t, pqueue_t ) \
+ { \
+ typedef pqueue::Types<pqueue::simple_value>::pqueue_t pqueue_type; \
+ pqueue_type pq; \
+ test( pq ); \
+ }
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, FCPQueue_vector )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, FCPQueue_vector_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, FCPQueue_deque )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, FCPQueue_deque_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, FCPQueue_boost_deque )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, FCPQueue_boost_deque_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, FCPQueue_boost_stable_vector )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, FCPQueue_boost_stable_vector_stat )
+
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_HP_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_HP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_HP_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_HP_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_DHP_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_DHP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_DHP_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_DHP_min_stat )
+ // CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpi_max )
+ // CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpi_max_stat )
+ // CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpi_min )
+ // CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpi_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpb_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpb_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpb_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpb_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpt_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpt_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpt_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_gpt_min_stat )
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_shb_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_shb_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_shb_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_shb_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_sht_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_sht_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_sht_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, EllenBinTree_RCU_sht_min_stat )
+#endif
+
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_HP_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_HP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_HP_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_HP_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_DHP_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_DHP_max_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_DHP_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_DHP_min_stat )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_RCU_gpi_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_RCU_gpi_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_RCU_gpb_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_RCU_gpb_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_RCU_gpt_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_RCU_gpt_min )
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_RCU_shb_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_RCU_shb_min )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_RCU_sht_max )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, SkipList_RCU_sht_min )
+#endif
+
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, StdPQueue_vector_spin )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, StdPQueue_vector_mutex )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, StdPQueue_deque_spin )
+ CDSSTRESS_PriorityQueue( pqueue_push_pop, StdPQueue_deque_mutex )
+
+} // namespace
add_test(NAME ${PACKAGE_NAME} COMMAND ${PACKAGE_NAME} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/map2)
-add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pqueue)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/set2)
+++ /dev/null
-set(PACKAGE_NAME cdsu-pqueue)
-
-set(CDSUNIT_PQUEUE_SOURCES
- pop.cpp
- push.cpp
- push_pop.cpp)
-
-add_executable(${PACKAGE_NAME} ${CDSUNIT_PQUEUE_SOURCES} $<TARGET_OBJECTS:${TEST_COMMON}>)
-target_link_libraries(${PACKAGE_NAME} ${CDS_SHARED_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
+++ /dev/null
-/*
- 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_STD_ELLEN_BINTREE_PQUEUE_H
-#define CDSUNIT_STD_ELLEN_BINTREE_PQUEUE_H
-
-#include <cds/container/ellen_bintree_set_hp.h>
-#include <cds/container/ellen_bintree_set_dhp.h>
-#include <cds/urcu/general_instant.h>
-#include <cds/urcu/general_buffered.h>
-#include <cds/urcu/general_threaded.h>
-#include <cds/urcu/signal_buffered.h>
-#include <cds/urcu/signal_threaded.h>
-#include <cds/container/ellen_bintree_set_rcu.h>
-
-namespace pqueue {
-
- template <typename GC>
- struct EllenBinTreePQueue_pop_max
- {
- template <typename T, typename Tree>
- bool operator()( T& dest, Tree& container ) const
- {
- typename Tree::guarded_ptr gp( container.extract_max());
- if ( gp )
- dest = *gp;
- return !gp.empty();
- }
- };
-
- template <typename RCU>
- struct EllenBinTreePQueue_pop_max< cds::urcu::gc<RCU> >
- {
- template <typename T, typename Tree>
- bool operator()( T& dest, Tree& container ) const
- {
- typename Tree::exempt_ptr ep( container.extract_max());
- if ( ep )
- dest = *ep;
- return !ep.empty();
- }
- };
-
- template <typename GC>
- struct EllenBinTreePQueue_pop_min
- {
- template <typename T, typename Tree>
- bool operator()( T& dest, Tree& container ) const
- {
- typename Tree::guarded_ptr gp( container.extract_min());
- if ( gp )
- dest = *gp;
- return !gp.empty();
- }
- };
-
- template <typename RCU>
- struct EllenBinTreePQueue_pop_min< cds::urcu::gc<RCU> >
- {
- template <typename T, typename Tree>
- bool operator()( T& dest, Tree& container ) const
- {
- typename Tree::exempt_ptr ep( container.extract_min());
- if ( ep )
- dest = *ep;
- return !ep.empty();
- }
- };
-
- template <typename GC, typename Key, typename T, typename Traits, bool Max=true>
- class EllenBinTreePQueue: protected cds::container::EllenBinTreeSet< GC, Key, T, Traits >
- {
- typedef cds::container::EllenBinTreeSet< GC, Key, T, Traits > base_class;
- typedef T value_type;
- template <typename GC2> friend struct EllenBinTreePQueue_pop_max;
- template <typename GC2> friend struct EllenBinTreePQueue_pop_min;
-
- public:
- bool push( value_type const& val )
- {
- return base_class::insert( val );
- }
-
- bool pop( value_type& dest )
- {
- return Max ? EllenBinTreePQueue_pop_max< typename base_class::gc >()( dest, *this )
- : EllenBinTreePQueue_pop_min< typename base_class::gc >()( dest, *this );
- }
-
- void clear()
- {
- base_class::clear();
- }
-
- bool empty() const
- {
- return base_class::empty();
- }
-
- size_t size() const
- {
- return base_class::size();
- }
-
- typename base_class::stat const& statistics() const
- {
- return base_class::statistics();
- }
- };
-
-} // namespace pqueue
-
-
-#endif // #ifndef CDSUNIT_STD_ELLEN_BINTREE_PQUEUE_H
+++ /dev/null
-/*
- 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 "cppunit/thread.h"
-#include "pqueue/pqueue_item.h"
-#include "pqueue/pqueue_type.h"
-
-#include <vector>
-#include <memory>
-
-namespace pqueue {
-
-#define TEST_CASE( Q ) void Q() { test< Types<pqueue::SimpleValue>::Q >(); }
-#define TEST_BOUNDED( Q ) void Q() { test_bounded< Types<pqueue::SimpleValue>::Q >(); }
-
- namespace {
- static size_t s_nThreadCount = 8;
- static size_t s_nQueueSize = 2000000;
- }
-} // namespace pqueue
-
-namespace pqueue {
-
- class PQueue_Pop: public CppUnitMini::TestCase
- {
-
- template <class PQueue>
- class Pusher: public CppUnitMini::TestThread
- {
- virtual TestThread * clone()
- {
- return new Pusher( *this );
- }
- public:
- PQueue& m_Queue;
- size_t m_nPushError;
-
- typedef std::vector<size_t> array_type;
- array_type m_arr;
-
- public:
- Pusher( CppUnitMini::ThreadPool& pool, PQueue& q )
- : CppUnitMini::TestThread( pool )
- , m_Queue( q )
- {}
- Pusher( Pusher& src )
- : CppUnitMini::TestThread( src )
- , m_Queue( src.m_Queue )
- {}
-
- PQueue_Pop& getTest()
- {
- return static_cast<PQueue_Pop&>( m_Pool.m_Test );
- }
-
- virtual void init()
- {
- cds::threading::Manager::attachThread();
- }
- virtual void fini()
- {
- cds::threading::Manager::detachThread();
- }
-
- virtual void test()
- {
- m_nPushError = 0;
-
- for ( array_type::const_iterator it = m_arr.begin(); it != m_arr.end(); ++it ) {
- if ( !m_Queue.push( SimpleValue( *it ) ))
- ++m_nPushError;
- }
- }
-
- void prepare( size_t nStart, size_t nEnd )
- {
- m_arr.reserve( nEnd - nStart );
- for ( size_t i = nStart; i < nEnd; ++i )
- m_arr.push_back( i );
- shuffle( m_arr.begin(), m_arr.end() );
- }
- };
-
- template <class PQueue>
- class Popper: public CppUnitMini::TestThread
- {
- virtual TestThread * clone()
- {
- return new Popper( *this );
- }
- public:
- PQueue& m_Queue;
- size_t m_nPopError;
- size_t m_nPopErrorEq;
- size_t m_nPopSuccess;
- size_t m_nPopFailed;
-
- public:
- Popper( CppUnitMini::ThreadPool& pool, PQueue& q )
- : CppUnitMini::TestThread( pool )
- , m_Queue( q )
- {}
- Popper( Popper& src )
- : CppUnitMini::TestThread( src )
- , m_Queue( src.m_Queue )
- {}
-
- PQueue_Pop& getTest()
- {
- return static_cast<PQueue_Pop&>( m_Pool.m_Test );
- }
-
- virtual void init()
- {
- cds::threading::Manager::attachThread();
- }
- virtual void fini()
- {
- cds::threading::Manager::detachThread();
- }
-
- virtual void test()
- {
- m_nPopError = 0;
- m_nPopErrorEq = 0;
- m_nPopSuccess = 0;
- m_nPopFailed = 0;
-
- size_t nPrevKey;
- SimpleValue val;
- if ( m_Queue.pop( val )) {
- ++m_nPopSuccess;
- nPrevKey = val.key;
-
- while ( !m_Queue.empty() ) {
- if ( m_Queue.pop( val )) {
- ++m_nPopSuccess;
- if ( val.key > nPrevKey )
- ++m_nPopError;
- else if ( val.key == nPrevKey )
- ++m_nPopErrorEq;
- nPrevKey = val.key;
- }
- else
- ++m_nPopFailed;
- }
- }
- else
- ++m_nPopFailed;
- }
- };
-
- protected:
- template <class PQueue>
- void test()
- {
- PQueue testQueue;
- test_with( testQueue );
- }
-
- template <class PQueue>
- void test_bounded()
- {
- std::unique_ptr<PQueue> pq( new PQueue(s_nQueueSize) );
- test_with( *pq.get() );
- }
-
- template <class PQueue>
- void test_with( PQueue& testQueue )
- {
- size_t const nThreadItemCount = s_nQueueSize / s_nThreadCount;
-
- // push
- {
- CppUnitMini::ThreadPool pool( *this );
- pool.add( new Pusher<PQueue>( pool, testQueue ), s_nThreadCount );
-
- size_t nStart = 0;
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- Pusher<PQueue> * pThread = static_cast<Pusher<PQueue> *>(*it);
- pThread->prepare( nStart, nStart + nThreadItemCount );
- nStart += nThreadItemCount;
- }
-
- CPPUNIT_MSG( " Push, thread count=" << s_nThreadCount << ", item count=" << nThreadItemCount * s_nThreadCount << " ..." );
- pool.run();
- CPPUNIT_MSG( " Duration=" << pool.avgDuration() );
- }
-
- // pop
- {
- CppUnitMini::ThreadPool pool( *this );
- pool.add( new Popper<PQueue>( pool, testQueue ), s_nThreadCount );
-
- CPPUNIT_MSG( " Pop, thread count=" << s_nThreadCount << ", item count=" << nThreadItemCount * s_nThreadCount << " ..." );
- pool.run();
- CPPUNIT_MSG( " Duration=" << pool.avgDuration() );
-
- // Analyze result
- size_t nTotalPopped = 0;
- size_t nTotalError = 0;
- size_t nTotalErrorEq = 0;
- size_t nTotalFailed = 0;
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- Popper<PQueue> * pThread = static_cast<Popper<PQueue> *>(*it);
-
- nTotalPopped += pThread->m_nPopSuccess;
- nTotalError += pThread->m_nPopError;
- nTotalErrorEq += pThread->m_nPopErrorEq;
- nTotalFailed += pThread->m_nPopFailed;
- }
-
- CPPUNIT_MSG( " Total: popped=" << nTotalPopped << ", empty pop=" << nTotalFailed
- << "\n Errors: pop equal=" << nTotalErrorEq << ", priority violation=" << nTotalError
- );
- CPPUNIT_CHECK( nTotalPopped == nThreadItemCount * s_nThreadCount );
- CPPUNIT_CHECK( nTotalError == 0 );
- CPPUNIT_CHECK( nTotalErrorEq == 0 );
- }
-
- CPPUNIT_MSG( testQueue.statistics() );
- }
-
- void setUpParams( const CppUnitMini::TestCfg& cfg ) {
- s_nThreadCount = cfg.getULong("ThreadCount", (unsigned long) s_nThreadCount );
- s_nQueueSize = cfg.getULong("QueueSize", (unsigned long) s_nQueueSize );
- }
-
- protected:
-#include "pqueue/pqueue_defs.h"
- CDSUNIT_DECLARE_MSPriorityQueue
- CDSUNIT_DECLARE_EllenBinTree
- CDSUNIT_DECLARE_SkipList
- CDSUNIT_DECLARE_FCPriorityQueue
- CDSUNIT_DECLARE_StdPQueue
-
- CPPUNIT_TEST_SUITE_(PQueue_Pop, "PQueue_Push")
- CDSUNIT_TEST_MSPriorityQueue
- CDSUNIT_TEST_EllenBinTree
- CDSUNIT_TEST_SkipList
- CDSUNIT_TEST_FCPriorityQueue
- CDUNIT_TEST_StdPQueue
- CPPUNIT_TEST_SUITE_END();
- };
-
-} // namespace queue
-
-CPPUNIT_TEST_SUITE_REGISTRATION(pqueue::PQueue_Pop);
+++ /dev/null
-/*
- 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_PQUEUE_PQUEUE_DEFS_H
-#define CDSUNIT_PQUEUE_PQUEUE_DEFS_H
-
-// MSPriorityQueue
-#define CDSUNIT_DECLARE_MSPriorityQueue \
- TEST_BOUNDED(MSPriorityQueue_static_less) \
- TEST_BOUNDED(MSPriorityQueue_static_less_stat) \
- TEST_BOUNDED(MSPriorityQueue_static_cmp) \
- TEST_BOUNDED(MSPriorityQueue_static_mutex) \
- TEST_BOUNDED(MSPriorityQueue_dyn_less) \
- TEST_BOUNDED(MSPriorityQueue_dyn_less_stat) \
- TEST_BOUNDED(MSPriorityQueue_dyn_cmp) \
- TEST_BOUNDED(MSPriorityQueue_dyn_mutex)
-#define CDSUNIT_TEST_MSPriorityQueue \
- CPPUNIT_TEST(MSPriorityQueue_static_less) \
- CPPUNIT_TEST(MSPriorityQueue_static_less_stat) \
- CPPUNIT_TEST(MSPriorityQueue_static_cmp) \
- CPPUNIT_TEST(MSPriorityQueue_static_mutex) \
- CPPUNIT_TEST(MSPriorityQueue_dyn_less) \
- CPPUNIT_TEST(MSPriorityQueue_dyn_less_stat) \
- CPPUNIT_TEST(MSPriorityQueue_dyn_cmp) \
- CPPUNIT_TEST(MSPriorityQueue_dyn_mutex)
-
-
-// EllenBinTree
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-# define CDSUNIT_DECLARE_EllenBinTree_RCU_signal \
- TEST_CASE(EllenBinTree_RCU_shb_max) \
- TEST_CASE(EllenBinTree_RCU_shb_max_stat) \
- TEST_CASE(EllenBinTree_RCU_shb_min) \
- TEST_CASE(EllenBinTree_RCU_shb_min_stat) \
- TEST_CASE(EllenBinTree_RCU_sht_max) \
- TEST_CASE(EllenBinTree_RCU_sht_max_stat) \
- TEST_CASE(EllenBinTree_RCU_sht_min) \
- TEST_CASE(EllenBinTree_RCU_sht_min_stat)
-# define CDSUNIT_TEST_EllenBinTree_RCU_signal \
- CPPUNIT_TEST(EllenBinTree_RCU_shb_max) \
- CPPUNIT_TEST(EllenBinTree_RCU_shb_max_stat) \
- CPPUNIT_TEST(EllenBinTree_RCU_shb_min) \
- CPPUNIT_TEST(EllenBinTree_RCU_shb_min_stat) \
- CPPUNIT_TEST(EllenBinTree_RCU_sht_max) \
- CPPUNIT_TEST(EllenBinTree_RCU_sht_max_stat) \
- CPPUNIT_TEST(EllenBinTree_RCU_sht_min) \
- CPPUNIT_TEST(EllenBinTree_RCU_sht_min_stat)
-#else
-# define CDSUNIT_DECLARE_EllenBinTree_RCU_signal
-# define CDSUNIT_TEST_EllenBinTree_RCU_signal
-#endif
-
-#define CDSUNIT_DECLARE_EllenBinTree \
- TEST_CASE(EllenBinTree_HP_max) \
- TEST_CASE(EllenBinTree_HP_max_stat) \
- TEST_CASE(EllenBinTree_HP_min) \
- TEST_CASE(EllenBinTree_HP_min_stat) \
- TEST_CASE(EllenBinTree_DHP_max) \
- TEST_CASE(EllenBinTree_DHP_max_stat) \
- TEST_CASE(EllenBinTree_DHP_min) \
- TEST_CASE(EllenBinTree_DHP_min_stat) \
- TEST_CASE(EllenBinTree_RCU_gpi_max) \
- TEST_CASE(EllenBinTree_RCU_gpi_max_stat) \
- TEST_CASE(EllenBinTree_RCU_gpi_min) \
- TEST_CASE(EllenBinTree_RCU_gpi_min_stat) \
- TEST_CASE(EllenBinTree_RCU_gpb_max) \
- TEST_CASE(EllenBinTree_RCU_gpb_max_stat) \
- TEST_CASE(EllenBinTree_RCU_gpb_min) \
- TEST_CASE(EllenBinTree_RCU_gpb_min_stat) \
- TEST_CASE(EllenBinTree_RCU_gpt_max) \
- TEST_CASE(EllenBinTree_RCU_gpt_max_stat) \
- TEST_CASE(EllenBinTree_RCU_gpt_min) \
- TEST_CASE(EllenBinTree_RCU_gpt_min_stat) \
- CDSUNIT_DECLARE_EllenBinTree_RCU_signal
-#define CDSUNIT_TEST_EllenBinTree \
- CPPUNIT_TEST(EllenBinTree_HP_max) \
- CPPUNIT_TEST(EllenBinTree_HP_max_stat) \
- CPPUNIT_TEST(EllenBinTree_HP_min) \
- CPPUNIT_TEST(EllenBinTree_HP_min_stat) \
- CPPUNIT_TEST(EllenBinTree_DHP_max) \
- CPPUNIT_TEST(EllenBinTree_DHP_max_stat) \
- CPPUNIT_TEST(EllenBinTree_DHP_min) \
- CPPUNIT_TEST(EllenBinTree_DHP_min_stat) \
- /*CPPUNIT_TEST(EllenBinTree_RCU_gpi_max)*/ \
- /*CPPUNIT_TEST(EllenBinTree_RCU_gpi_max_stat)*/ \
- /*CPPUNIT_TEST(EllenBinTree_RCU_gpi_min)*/ \
- /*CPPUNIT_TEST(EllenBinTree_RCU_gpi_min_stat)*/ \
- CPPUNIT_TEST(EllenBinTree_RCU_gpb_max) \
- CPPUNIT_TEST(EllenBinTree_RCU_gpb_max_stat) \
- CPPUNIT_TEST(EllenBinTree_RCU_gpb_min) \
- CPPUNIT_TEST(EllenBinTree_RCU_gpb_min_stat) \
- CPPUNIT_TEST(EllenBinTree_RCU_gpt_max) \
- CPPUNIT_TEST(EllenBinTree_RCU_gpt_max_stat) \
- CPPUNIT_TEST(EllenBinTree_RCU_gpt_min) \
- CPPUNIT_TEST(EllenBinTree_RCU_gpt_min_stat) \
- CDSUNIT_TEST_EllenBinTree_RCU_signal
-
-
-// SkipList
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-# define CDSUNIT_DECLARE_SkipList_RCU_signal \
- TEST_CASE(SkipList_RCU_shb_max) \
- TEST_CASE(SkipList_RCU_shb_min) \
- TEST_CASE(SkipList_RCU_sht_max) \
- TEST_CASE(SkipList_RCU_sht_min)
-# define CDSUNIT_TEST_SkipList_RCU_signal \
- CPPUNIT_TEST(SkipList_RCU_shb_max) \
- CPPUNIT_TEST(SkipList_RCU_shb_min) \
- CPPUNIT_TEST(SkipList_RCU_sht_max) \
- CPPUNIT_TEST(SkipList_RCU_sht_min)
-#else
-# define CDSUNIT_DECLARE_SkipList_RCU_signal
-# define CDSUNIT_TEST_SkipList_RCU_signal
-#endif
-
-#define CDSUNIT_DECLARE_SkipList \
- TEST_CASE(SkipList_HP_max) \
- TEST_CASE(SkipList_HP_max_stat) \
- TEST_CASE(SkipList_HP_min) \
- TEST_CASE(SkipList_HP_min_stat) \
- TEST_CASE(SkipList_DHP_max) \
- TEST_CASE(SkipList_DHP_max_stat) \
- TEST_CASE(SkipList_DHP_min) \
- TEST_CASE(SkipList_DHP_min_stat) \
- TEST_CASE(SkipList_RCU_gpi_max) \
- TEST_CASE(SkipList_RCU_gpi_min) \
- TEST_CASE(SkipList_RCU_gpb_max) \
- TEST_CASE(SkipList_RCU_gpb_min) \
- TEST_CASE(SkipList_RCU_gpt_max) \
- TEST_CASE(SkipList_RCU_gpt_min) \
- CDSUNIT_DECLARE_SkipList_RCU_signal
-#define CDSUNIT_TEST_SkipList \
- CPPUNIT_TEST(SkipList_HP_max) \
- CPPUNIT_TEST(SkipList_HP_max_stat) \
- CPPUNIT_TEST(SkipList_HP_min) \
- CPPUNIT_TEST(SkipList_HP_min_stat) \
- CPPUNIT_TEST(SkipList_DHP_max) \
- CPPUNIT_TEST(SkipList_DHP_max_stat) \
- CPPUNIT_TEST(SkipList_DHP_min) \
- CPPUNIT_TEST(SkipList_DHP_min_stat) \
- CPPUNIT_TEST(SkipList_RCU_gpi_max) \
- CPPUNIT_TEST(SkipList_RCU_gpi_min) \
- CPPUNIT_TEST(SkipList_RCU_gpb_max) \
- CPPUNIT_TEST(SkipList_RCU_gpb_min) \
- CPPUNIT_TEST(SkipList_RCU_gpt_max) \
- CPPUNIT_TEST(SkipList_RCU_gpt_min) \
- CDSUNIT_TEST_SkipList_RCU_signal
-
-// FCPriorityQueue
-#define CDSUNIT_DECLARE_FCPriorityQueue \
- TEST_CASE(FCPQueue_vector) \
- TEST_CASE(FCPQueue_vector_stat) \
- TEST_CASE(FCPQueue_deque) \
- TEST_CASE(FCPQueue_deque_stat) \
- TEST_CASE(FCPQueue_boost_deque) \
- TEST_CASE(FCPQueue_boost_deque_stat) \
- TEST_CASE(FCPQueue_boost_stable_vector) \
- TEST_CASE(FCPQueue_boost_stable_vector_stat)
-
-#define CDSUNIT_TEST_FCPriorityQueue \
- CPPUNIT_TEST(FCPQueue_vector) \
- CPPUNIT_TEST(FCPQueue_vector_stat) \
- CPPUNIT_TEST(FCPQueue_deque) \
- CPPUNIT_TEST(FCPQueue_deque_stat) \
- CPPUNIT_TEST(FCPQueue_boost_deque) \
- CPPUNIT_TEST(FCPQueue_boost_deque_stat) \
- CPPUNIT_TEST(FCPQueue_boost_stable_vector) \
- CPPUNIT_TEST(FCPQueue_boost_stable_vector_stat)
-
-// Std::priority_queue
-#define CDSUNIT_DECLARE_StdPQueue \
- TEST_CASE(StdPQueue_vector_spin) \
- TEST_CASE(StdPQueue_vector_mutex) \
- TEST_CASE(StdPQueue_deque_spin) \
- TEST_CASE(StdPQueue_deque_mutex)
-#define CDUNIT_TEST_StdPQueue \
- CPPUNIT_TEST(StdPQueue_vector_spin) \
- CPPUNIT_TEST(StdPQueue_vector_mutex)\
- CPPUNIT_TEST(StdPQueue_deque_spin) \
- CPPUNIT_TEST(StdPQueue_deque_mutex)
-
-
-#endif // #ifndef CDSUNIT_PQUEUE_PQUEUE_DEFS_H
+++ /dev/null
-/*
- 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_PQUEUE_ITEM_H
-#define CDSUNIT_PQUEUE_ITEM_H
-
-namespace pqueue {
- struct SimpleValue {
- size_t key;
-
- typedef size_t key_type;
-
- struct key_extractor {
- void operator()( key_type& k, SimpleValue const& s ) const
- {
- k = s.key;
- }
- };
-
- SimpleValue(): key(0) {}
- SimpleValue( size_t n ): key(n) {}
- };
-}
-
-namespace std {
- template <>
- struct less<pqueue::SimpleValue>
- {
- bool operator()( pqueue::SimpleValue const& k1, pqueue::SimpleValue const& k2 ) const
- {
- return k1.key < k2.key;
- }
-
- bool operator()( pqueue::SimpleValue const& k1, size_t k2 ) const
- {
- return k1.key < k2;
- }
-
- bool operator()( size_t k1, pqueue::SimpleValue const& k2 ) const
- {
- return k1 < k2.key;
- }
-
- bool operator()( size_t k1, size_t k2 ) const
- {
- return k1 < k2;
- }
- };
-
- template <>
- struct greater<pqueue::SimpleValue>
- {
- bool operator()( pqueue::SimpleValue const& k1, pqueue::SimpleValue const& k2 ) const
- {
- return k1.key > k2.key;
- }
-
- bool operator()( pqueue::SimpleValue const& k1, size_t k2 ) const
- {
- return k1.key > k2;
- }
-
- bool operator()( size_t k1, pqueue::SimpleValue const& k2 ) const
- {
- return k1 > k2.key;
- }
-
- bool operator()( size_t k1, size_t k2 ) const
- {
- return k1 > k2;
- }
- };
-
-} // namespace std
-
-#endif // #ifndef CDSUNIT_PQUEUE_ITEM_H
+++ /dev/null
-/*
- 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_PQUEUE_TYPES_H
-#define CDSUNIT_PQUEUE_TYPES_H
-
-#include <cds/container/mspriority_queue.h>
-#include <cds/container/fcpriority_queue.h>
-
-#include "pqueue/std_pqueue.h"
-#include "pqueue/ellen_bintree_pqueue.h"
-#include "pqueue/skiplist_pqueue.h"
-
-#include <vector>
-#include <deque>
-#include <boost/container/stable_vector.hpp>
-#include <boost/container/deque.hpp>
-#include <cds/sync/spinlock.h>
-
-#include "print_ellenbintree_stat.h"
-#include "print_skip_list_stat.h"
-#include "print_mspriorityqueue_stat.h"
-
-namespace pqueue {
- namespace cc = cds::container;
- namespace co = cds::opt;
-
- template <typename Value>
- struct Types
- {
- static size_t const c_nBoundedCapacity = 1024 * 1024 * 16;
-
- typedef std::less<Value> less;
-
- struct cmp {
- int operator()( Value const& v1, Value const& v2 ) const
- {
- return less()( v1, v2 ) ? -1 : less()( v2, v1 ) ? 1 : 0;
- }
- };
-
- 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
-
-
- // MSPriorityQueue
- struct traits_MSPriorityQueue_static_less : public
- cc::mspriority_queue::make_traits <
- co::buffer < co::v::static_buffer< char, c_nBoundedCapacity > >
- > ::type
- {};
- typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_static_less > MSPriorityQueue_static_less;
-
- struct traits_MSPriorityQueue_static_less_stat : public cc::mspriority_queue::traits
- {
- typedef co::v::static_buffer< char, c_nBoundedCapacity > buffer;
- typedef cc::mspriority_queue::stat<> stat;
- };
- typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_static_less_stat > MSPriorityQueue_static_less_stat;
-
- struct traits_MSPriorityQueue_static_cmp : public
- cc::mspriority_queue::make_traits <
- co::buffer< co::v::static_buffer< char, c_nBoundedCapacity > >
- , co::compare < cmp >
- > ::type
- {};
- typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_static_cmp > MSPriorityQueue_static_cmp;
-
- struct traits_MSPriorityQueue_static_mutex : public
- cc::mspriority_queue::make_traits<
- co::buffer< co::v::static_buffer< char, c_nBoundedCapacity > >
- , co::lock_type<std::mutex>
- >::type
- {};
- typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_static_mutex > MSPriorityQueue_static_mutex;
-
- struct traits_MSPriorityQueue_dyn_less : public
- cc::mspriority_queue::make_traits<
- co::buffer< co::v::dynamic_buffer< char > >
- >::type
- {};
- typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_dyn_less > MSPriorityQueue_dyn_less;
-
- struct traits_MSPriorityQueue_dyn_less_stat : public
- cc::mspriority_queue::make_traits <
- co::buffer< co::v::dynamic_buffer< char > >
- , co::stat < cc::mspriority_queue::stat<> >
- > ::type
- {};
- typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_dyn_less_stat > MSPriorityQueue_dyn_less_stat;
-
- struct traits_MSPriorityQueue_dyn_cmp : public
- cc::mspriority_queue::make_traits <
- co::buffer< co::v::dynamic_buffer< char > >
- , co::compare < cmp >
- > ::type
- {};
- typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_dyn_cmp > MSPriorityQueue_dyn_cmp;
-
- struct traits_MSPriorityQueue_dyn_mutex : public
- cc::mspriority_queue::make_traits <
- co::buffer< co::v::dynamic_buffer< char > >
- , co::lock_type < std::mutex >
- > ::type
- {};
- typedef cc::MSPriorityQueue< Value, traits_MSPriorityQueue_dyn_mutex > MSPriorityQueue_dyn_mutex;
-
-
- // Priority queue based on EllenBinTreeSet
- struct traits_EllenBinTree_max :
- public cc::ellen_bintree::make_set_traits<
- cc::ellen_bintree::key_extractor< typename Value::key_extractor >
- ,cc::opt::less< std::less<Value> >
- ,co::stat< cc::ellen_bintree::stat<> >
- >::type
- {};
- typedef EllenBinTreePQueue< cds::gc::HP, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_HP_max;
- typedef EllenBinTreePQueue< cds::gc::DHP, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_DHP_max;
- typedef EllenBinTreePQueue< rcu_gpi, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_RCU_gpi_max;
- typedef EllenBinTreePQueue< rcu_gpb, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_RCU_gpb_max;
- typedef EllenBinTreePQueue< rcu_gpt, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_RCU_gpt_max;
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef EllenBinTreePQueue< rcu_shb, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_RCU_shb_max;
- typedef EllenBinTreePQueue< rcu_sht, typename Value::key_type, Value, traits_EllenBinTree_max > EllenBinTree_RCU_sht_max;
-#endif
-
- struct traits_EllenBinTree_max_stat :
- public cc::ellen_bintree::make_set_traits<
- cc::ellen_bintree::key_extractor< typename Value::key_extractor >
- ,cc::opt::less< std::less<Value> >
- ,co::stat< cc::ellen_bintree::stat<> >
- >::type
- {};
- typedef EllenBinTreePQueue< cds::gc::HP, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_HP_max_stat;
- typedef EllenBinTreePQueue< cds::gc::DHP, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_DHP_max_stat;
- typedef EllenBinTreePQueue< rcu_gpi, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_RCU_gpi_max_stat;
- typedef EllenBinTreePQueue< rcu_gpb, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_RCU_gpb_max_stat;
- typedef EllenBinTreePQueue< rcu_gpt, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_RCU_gpt_max_stat;
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef EllenBinTreePQueue< rcu_shb, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_RCU_shb_max_stat;
- typedef EllenBinTreePQueue< rcu_sht, typename Value::key_type, Value, traits_EllenBinTree_max_stat > EllenBinTree_RCU_sht_max_stat;
-#endif
-
- struct traits_EllenBinTree_min :
- public cc::ellen_bintree::make_set_traits<
- cc::ellen_bintree::key_extractor< typename Value::key_extractor >
- ,cc::opt::less< std::greater<Value> >
- >::type
- {};
- typedef EllenBinTreePQueue< cds::gc::HP, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_HP_min;
- typedef EllenBinTreePQueue< cds::gc::DHP, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_DHP_min;
- typedef EllenBinTreePQueue< rcu_gpi, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_RCU_gpi_min;
- typedef EllenBinTreePQueue< rcu_gpb, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_RCU_gpb_min;
- typedef EllenBinTreePQueue< rcu_gpt, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_RCU_gpt_min;
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef EllenBinTreePQueue< rcu_shb, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_RCU_shb_min;
- typedef EllenBinTreePQueue< rcu_sht, typename Value::key_type, Value, traits_EllenBinTree_min, false > EllenBinTree_RCU_sht_min;
-#endif
-
- struct traits_EllenBinTree_min_stat :
- public cc::ellen_bintree::make_set_traits<
- cc::ellen_bintree::key_extractor< typename Value::key_extractor >
- ,cc::opt::less< std::greater<Value> >
- ,co::stat< cc::ellen_bintree::stat<> >
- >::type
- {};
- typedef EllenBinTreePQueue< cds::gc::HP, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_HP_min_stat;
- typedef EllenBinTreePQueue< cds::gc::DHP, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_DHP_min_stat;
- typedef EllenBinTreePQueue< rcu_gpi, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_RCU_gpi_min_stat;
- typedef EllenBinTreePQueue< rcu_gpb, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_RCU_gpb_min_stat;
- typedef EllenBinTreePQueue< rcu_gpt, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_RCU_gpt_min_stat;
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef EllenBinTreePQueue< rcu_shb, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_RCU_shb_min_stat;
- typedef EllenBinTreePQueue< rcu_sht, typename Value::key_type, Value, traits_EllenBinTree_min_stat, false > EllenBinTree_RCU_sht_min_stat;
-#endif
-
- // Priority queue based on SkipListSet
- struct traits_SkipList_max :
- public cc::skip_list::make_traits <
- cc::opt::less < std::less<Value> >
- > ::type
- {};
- typedef SkipListPQueue< cds::gc::HP, Value, traits_SkipList_max > SkipList_HP_max;
- typedef SkipListPQueue< cds::gc::DHP, Value, traits_SkipList_max > SkipList_DHP_max;
- typedef SkipListPQueue< rcu_gpi, Value, traits_SkipList_max > SkipList_RCU_gpi_max;
- typedef SkipListPQueue< rcu_gpb, Value, traits_SkipList_max > SkipList_RCU_gpb_max;
- typedef SkipListPQueue< rcu_gpt, Value, traits_SkipList_max > SkipList_RCU_gpt_max;
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef SkipListPQueue< rcu_shb, Value, traits_SkipList_max > SkipList_RCU_shb_max;
- typedef SkipListPQueue< rcu_sht, Value, traits_SkipList_max > SkipList_RCU_sht_max;
-#endif
-
- struct traits_SkipList_max_stat :
- public cc::skip_list::make_traits<
- cc::opt::less< std::less<Value> >
- ,co::stat< cc::skip_list::stat<> >
- >::type
- {};
- typedef SkipListPQueue< cds::gc::HP, Value, traits_SkipList_max_stat > SkipList_HP_max_stat;
- typedef SkipListPQueue< cds::gc::DHP, Value, traits_SkipList_max_stat > SkipList_DHP_max_stat;
- typedef SkipListPQueue< rcu_gpi, Value, traits_SkipList_max_stat > SkipList_RCU_gpi_max_stat;
- typedef SkipListPQueue< rcu_gpb, Value, traits_SkipList_max_stat > SkipList_RCU_gpb_max_stat;
- typedef SkipListPQueue< rcu_gpt, Value, traits_SkipList_max_stat > SkipList_RCU_gpt_max_stat;
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef SkipListPQueue< rcu_shb, Value, traits_SkipList_max_stat > SkipList_RCU_shb_max_stat;
- typedef SkipListPQueue< rcu_sht, Value, traits_SkipList_max_stat > SkipList_RCU_sht_max_stat;
-#endif
-
- struct traits_SkipList_min :
- public cc::skip_list::make_traits<
- cc::opt::less< std::greater<Value> >
- >::type
- {};
- typedef SkipListPQueue< cds::gc::HP, Value, traits_SkipList_min, false > SkipList_HP_min;
- typedef SkipListPQueue< cds::gc::DHP, Value, traits_SkipList_min, false > SkipList_DHP_min;
- typedef SkipListPQueue< rcu_gpi, Value, traits_SkipList_min, false > SkipList_RCU_gpi_min;
- typedef SkipListPQueue< rcu_gpb, Value, traits_SkipList_min, false > SkipList_RCU_gpb_min;
- typedef SkipListPQueue< rcu_gpt, Value, traits_SkipList_min, false > SkipList_RCU_gpt_min;
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef SkipListPQueue< rcu_shb, Value, traits_SkipList_min, false > SkipList_RCU_shb_min;
- typedef SkipListPQueue< rcu_sht, Value, traits_SkipList_min, false > SkipList_RCU_sht_min;
-#endif
-
- struct traits_SkipList_min_stat :
- public cc::skip_list::make_traits<
- cc::opt::less< std::greater<Value> >
- ,co::stat< cc::skip_list::stat<> >
- >::type
- {};
- typedef SkipListPQueue< cds::gc::HP, Value, traits_SkipList_min_stat, false > SkipList_HP_min_stat;
- typedef SkipListPQueue< cds::gc::DHP, Value, traits_SkipList_min_stat, false > SkipList_DHP_min_stat;
- typedef SkipListPQueue< rcu_gpi, Value, traits_SkipList_min_stat, false > SkipList_RCU_gpi_min_stat;
- typedef SkipListPQueue< rcu_gpb, Value, traits_SkipList_min_stat, false > SkipList_RCU_gpb_min_stat;
- typedef SkipListPQueue< rcu_gpt, Value, traits_SkipList_min_stat, false > SkipList_RCU_gpt_min_stat;
-#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
- typedef SkipListPQueue< rcu_shb, Value, traits_SkipList_min_stat, false > SkipList_RCU_shb_min_stat;
- typedef SkipListPQueue< rcu_sht, Value, traits_SkipList_min_stat, false > SkipList_RCU_sht_min_stat;
-#endif
-
-
- // FCPriorityQueue
- struct traits_FCPQueue_stat : public
- cds::container::fcpqueue::make_traits <
- cds::opt::stat < cds::container::fcpqueue::stat<> >
- > ::type
- {};
-
- typedef cds::container::FCPriorityQueue< Value > FCPQueue_vector;
- typedef cds::container::FCPriorityQueue< Value
- ,std::priority_queue<Value>
- ,traits_FCPQueue_stat
- > FCPQueue_vector_stat;
-
- typedef cds::container::FCPriorityQueue< Value
- ,std::priority_queue<Value, std::deque<Value> >
- > FCPQueue_deque;
- typedef cds::container::FCPriorityQueue< Value
- ,std::priority_queue<Value, std::deque<Value> >
- ,traits_FCPQueue_stat
- > FCPQueue_deque_stat;
-
- typedef cds::container::FCPriorityQueue< Value
- ,std::priority_queue<Value, boost::container::deque<Value> >
- > FCPQueue_boost_deque;
- typedef cds::container::FCPriorityQueue< Value
- ,std::priority_queue<Value, boost::container::deque<Value> >
- ,traits_FCPQueue_stat
- > FCPQueue_boost_deque_stat;
-
- typedef cds::container::FCPriorityQueue< Value
- ,std::priority_queue<Value, boost::container::stable_vector<Value> >
- > FCPQueue_boost_stable_vector;
- typedef cds::container::FCPriorityQueue< Value
- ,std::priority_queue<Value, boost::container::stable_vector<Value> >
- ,traits_FCPQueue_stat
- > FCPQueue_boost_stable_vector_stat;
-
- /// Standard priority_queue
- typedef StdPQueue< Value, std::vector<Value>, cds::sync::spin> StdPQueue_vector_spin;
- typedef StdPQueue< Value, std::vector<Value>, std::mutex > StdPQueue_vector_mutex;
- typedef StdPQueue< Value, std::deque<Value>, cds::sync::spin> StdPQueue_deque_spin;
- typedef StdPQueue< Value, std::deque<Value>, std::mutex > StdPQueue_deque_mutex;
- };
-
-
- template <typename Stat>
- static inline void check_statistics( Stat const& /*s*/ )
- {}
-
- static inline void check_statistics( cds::container::ellen_bintree::stat<> const& s )
- {
- CPPUNIT_CHECK_CURRENT( s.m_nInternalNodeCreated.get() == s.m_nInternalNodeDeleted.get() );
- CPPUNIT_CHECK_CURRENT( s.m_nUpdateDescCreated.get() == s.m_nUpdateDescDeleted.get() );
- }
-} // namespace pqueue
-
-namespace std {
-
- static inline std::ostream& operator <<( std::ostream& o, cds::container::fcpqueue::empty_stat const& )
- {
- return o;
- }
-
- static inline std::ostream& operator <<( std::ostream& o, cds::container::fcpqueue::stat<> const& s )
- {
- return o << "\tStatistics:\n"
- << "\t Push: " << s.m_nPush.get() << "\n"
- << "\t Push move: " << s.m_nPushMove.get() << "\n"
- << "\t Pop: " << s.m_nPop.get() << "\n"
- << "\t Failed pop: " << s.m_nFailedPop.get() << "\n"
- << "\tFlat combining statistics:\n"
- << "\t Combining factor: " << s.combining_factor() << "\n"
- << "\t Operation count: " << s.m_nOperationCount.get() << "\n"
- << "\t Combine call count: " << s.m_nCombiningCount.get() << "\n"
- << "\t Compact pub-list: " << s.m_nCompactPublicationList.get() << "\n"
- << "\t Deactivate pub-record: " << s.m_nDeactivatePubRecord.get() << "\n"
- << "\t Activate pub-record: " << s.m_nActivatePubRecord.get() << "\n"
- << "\t Create pub-record: " << s.m_nPubRecordCreated.get() << "\n"
- << "\t Delete pub-record: " << s.m_nPubRecordDeteted.get() << "\n"
- << "\t Acquire pub-record: " << s.m_nAcquirePubRecCount.get()<< "\n"
- << "\t Release pub-record: " << s.m_nReleasePubRecCount.get()<< "\n";
- }
-
-} // namespace std
-
-#endif // #ifndef CDSUNIT_PQUEUE_TYPES_H
+++ /dev/null
-/*
- 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 "cppunit/thread.h"
-#include "pqueue/pqueue_item.h"
-#include "pqueue/pqueue_type.h"
-
-#include <vector>
-#include <memory>
-
-namespace pqueue {
-
-#define TEST_CASE( Q ) void Q() { test< Types<pqueue::SimpleValue>::Q >(); }
-#define TEST_BOUNDED( Q ) void Q() { test_bounded< Types<pqueue::SimpleValue>::Q >(); }
-
- namespace {
- static size_t s_nThreadCount = 8;
- static size_t s_nQueueSize = 2000000;
- }
-} // namespace pqueue
-
-namespace pqueue {
-
- class PQueue_Push: public CppUnitMini::TestCase
- {
- template <class PQueue>
- class Pusher: public CppUnitMini::TestThread
- {
- virtual TestThread * clone()
- {
- return new Pusher( *this );
- }
- public:
- PQueue& m_Queue;
- size_t m_nPushError;
-
- typedef std::vector<size_t> array_type;
- array_type m_arr;
-
- public:
- Pusher( CppUnitMini::ThreadPool& pool, PQueue& q )
- : CppUnitMini::TestThread( pool )
- , m_Queue( q )
- {}
- Pusher( Pusher& src )
- : CppUnitMini::TestThread( src )
- , m_Queue( src.m_Queue )
- {}
-
- PQueue_Push& getTest()
- {
- return static_cast<PQueue_Push&>( m_Pool.m_Test );
- }
-
- virtual void init()
- {
- cds::threading::Manager::attachThread();
- }
- virtual void fini()
- {
- cds::threading::Manager::detachThread();
- }
-
- virtual void test()
- {
- m_nPushError = 0;
-
- for ( array_type::const_iterator it = m_arr.begin(); it != m_arr.end(); ++it ) {
- if ( !m_Queue.push( SimpleValue( *it ) ))
- ++m_nPushError;
- }
- }
-
- void prepare( size_t nStart, size_t nEnd )
- {
- m_arr.reserve( nEnd - nStart );
- for ( size_t i = nStart; i < nEnd; ++i )
- m_arr.push_back( i );
- shuffle( m_arr.begin(), m_arr.end() );
- }
- };
-
- protected:
- template <class PQueue>
- void analyze( CppUnitMini::ThreadPool& pool, PQueue& testQueue )
- {
- size_t nThreadItems = s_nQueueSize / s_nThreadCount;
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- Pusher<PQueue> * pThread = static_cast<Pusher<PQueue> *>(*it);
- CPPUNIT_CHECK_EX( pThread->m_nPushError == 0, "Thread push error count=" << pThread->m_nPushError );
- }
- CPPUNIT_MSG( " Duration=" << pool.avgDuration() );
- CPPUNIT_ASSERT( !testQueue.empty() );
-
- typedef std::vector<size_t> vector_type;
- vector_type arr;
- arr.reserve( s_nQueueSize );
-
- cds::OS::Timer timer;
- CPPUNIT_MSG( " Pop (single-threaded)..." );
- size_t nPopped = 0;
- SimpleValue val;
- while ( testQueue.pop( val )) {
- nPopped++;
- arr.push_back( val.key );
- }
- CPPUNIT_MSG( " Duration=" << timer.duration() );
-
- CPPUNIT_CHECK( arr.size() == nThreadItems * s_nThreadCount );
- vector_type::const_iterator it = arr.begin();
- size_t nPrev = *it;
- ++it;
- size_t nErrCount = 0;
- for ( vector_type::const_iterator itEnd = arr.end(); it != itEnd; ++it ) {
- if ( nPrev - 1 != *it ) {
- if ( ++nErrCount < 10 ) {
- CPPUNIT_CHECK_EX( nPrev - 1 == *it, "Expected=" << nPrev - 1 << ", current=" << *it );
- }
- }
- nPrev = *it;
- }
-
- CPPUNIT_CHECK_EX( nErrCount == 0, "Error count=" << nErrCount );
- }
-
- template <class PQueue>
- void test()
- {
- PQueue testQueue;
-
- CppUnitMini::ThreadPool pool( *this );
- pool.add( new Pusher<PQueue>( pool, testQueue ), s_nThreadCount );
-
- size_t nStart = 0;
- size_t nThreadItemCount = s_nQueueSize / s_nThreadCount;
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- Pusher<PQueue> * pThread = static_cast<Pusher<PQueue> *>(*it);
- pThread->prepare( nStart, nStart + nThreadItemCount );
- nStart += nThreadItemCount;
- }
-
- CPPUNIT_MSG( " Push test, thread count=" << s_nThreadCount << ", item count=" << nThreadItemCount * s_nThreadCount << " ..." );
- pool.run();
-
- analyze( pool, testQueue );
-
- CPPUNIT_MSG( testQueue.statistics() );
- }
-
- template <class PQueue>
- void test_bounded()
- {
- size_t nStart = 0;
- size_t nThreadItemCount = s_nQueueSize / s_nThreadCount;
-
- std::unique_ptr<PQueue> pq( new PQueue(s_nQueueSize) );
-
- CppUnitMini::ThreadPool pool( *this );
- pool.add( new Pusher<PQueue>( pool, *pq ), s_nThreadCount );
-
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- Pusher<PQueue> * pThread = static_cast<Pusher<PQueue> *>(*it);
- pThread->prepare( nStart, nStart + nThreadItemCount );
- nStart += nThreadItemCount;
- }
-
- CPPUNIT_MSG( " Push test, thread count=" << s_nThreadCount << ", item count=" << nThreadItemCount * s_nThreadCount << " ..." );
- pool.run();
-
- analyze( pool, *pq );
-
- CPPUNIT_MSG( pq->statistics() );
- }
-
- void setUpParams( const CppUnitMini::TestCfg& cfg ) {
- s_nThreadCount = cfg.getULong("ThreadCount", (unsigned long) s_nThreadCount );
- s_nQueueSize = cfg.getULong("QueueSize", (unsigned long) s_nQueueSize );
- }
-
- protected:
-#include "pqueue/pqueue_defs.h"
- CDSUNIT_DECLARE_MSPriorityQueue
- CDSUNIT_DECLARE_EllenBinTree
- CDSUNIT_DECLARE_SkipList
- CDSUNIT_DECLARE_FCPriorityQueue
- CDSUNIT_DECLARE_StdPQueue
-
- CPPUNIT_TEST_SUITE(PQueue_Push)
- CDSUNIT_TEST_MSPriorityQueue
- CDSUNIT_TEST_EllenBinTree
- CDSUNIT_TEST_SkipList
- CDSUNIT_TEST_FCPriorityQueue
- CDUNIT_TEST_StdPQueue
- CPPUNIT_TEST_SUITE_END();
- };
-
-} // namespace queue
-
-CPPUNIT_TEST_SUITE_REGISTRATION(pqueue::PQueue_Push);
+++ /dev/null
-/*
- 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 "cppunit/thread.h"
-#include "pqueue/pqueue_item.h"
-#include "pqueue/pqueue_type.h"
-
-#include <vector>
-#include <memory>
-
-namespace pqueue {
-
-#define TEST_CASE( Q ) void Q() { test< Types<pqueue::SimpleValue>::Q >(); }
-#define TEST_BOUNDED( Q ) void Q() { test_bounded< Types<pqueue::SimpleValue>::Q >(); }
-
- namespace {
- static size_t s_nPushThreadCount = 4;
- static size_t s_nPopThreadCount = 4;
- static size_t s_nQueueSize = 2000000;
- }
-} // namespace pqueue
-
-namespace pqueue {
-
- class PQueue_PushPop: public CppUnitMini::TestCase
- {
-
- template <class PQueue>
- class Pusher: public CppUnitMini::TestThread
- {
- virtual TestThread * clone()
- {
- return new Pusher( *this );
- }
- public:
- PQueue& m_Queue;
- size_t m_nPushError;
-
- typedef std::vector<size_t> array_type;
- array_type m_arr;
-
- public:
- Pusher( CppUnitMini::ThreadPool& pool, PQueue& q )
- : CppUnitMini::TestThread( pool )
- , m_Queue( q )
- {}
- Pusher( Pusher& src )
- : CppUnitMini::TestThread( src )
- , m_Queue( src.m_Queue )
- {}
-
- PQueue_PushPop& getTest()
- {
- return static_cast<PQueue_PushPop&>( m_Pool.m_Test );
- }
-
- virtual void init()
- {
- cds::threading::Manager::attachThread();
- }
- virtual void fini()
- {
- cds::threading::Manager::detachThread();
- }
-
- virtual void test()
- {
- m_nPushError = 0;
-
- for ( array_type::const_iterator it = m_arr.begin(); it != m_arr.end(); ++it ) {
- if ( !m_Queue.push( SimpleValue( *it ) ))
- ++m_nPushError;
- }
-
- getTest().end_pusher();
- }
-
- void prepare( size_t nStart, size_t nEnd )
- {
- m_arr.reserve( nEnd - nStart );
- for ( size_t i = nStart; i < nEnd; ++i )
- m_arr.push_back( i );
- shuffle( m_arr.begin(), m_arr.end() );
- }
- };
-
- template <class PQueue>
- class Popper: public CppUnitMini::TestThread
- {
- virtual TestThread * clone()
- {
- return new Popper( *this );
- }
- public:
- PQueue& m_Queue;
- size_t m_nPopSuccess;
- size_t m_nPopFailed;
-
- typedef std::vector<size_t> array_type;
- array_type m_arr;
-
- public:
- Popper( CppUnitMini::ThreadPool& pool, PQueue& q )
- : CppUnitMini::TestThread( pool )
- , m_Queue( q )
- {}
- Popper( Popper& src )
- : CppUnitMini::TestThread( src )
- , m_Queue( src.m_Queue )
- {}
-
- PQueue_PushPop& getTest()
- {
- return static_cast<PQueue_PushPop&>( m_Pool.m_Test );
- }
-
- virtual void init()
- {
- cds::threading::Manager::attachThread();
- }
- virtual void fini()
- {
- cds::threading::Manager::detachThread();
- }
-
- virtual void test()
- {
- m_nPopSuccess = 0;
- m_nPopFailed = 0;
-
- SimpleValue val;
- while ( getTest().pushing() || !m_Queue.empty() ) {
- if ( m_Queue.pop( val ))
- ++m_nPopSuccess;
- else
- ++m_nPopFailed;
- }
- }
- };
-
- atomics::atomic<size_t> m_nPusherCount;
- void end_pusher()
- {
- m_nPusherCount.fetch_sub( 1, atomics::memory_order_relaxed );
- }
- bool pushing() const
- {
- return m_nPusherCount.load( atomics::memory_order_relaxed ) != 0;
- }
-
- protected:
- template <class PQueue>
- void test()
- {
- PQueue testQueue;
- test_with( testQueue );
- }
-
- template <class PQueue>
- void test_bounded()
- {
- std::unique_ptr<PQueue> pq( new PQueue(s_nQueueSize) );
- test_with( *pq.get() );
- }
-
- template <class PQueue>
- void test_with( PQueue& testQueue )
- {
- size_t const nThreadItemCount = s_nQueueSize / s_nPushThreadCount;
-
- CppUnitMini::ThreadPool pool( *this );
- pool.add( new Pusher<PQueue>( pool, testQueue ), s_nPushThreadCount );
-
- size_t nStart = 0;
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- Pusher<PQueue> * pThread = static_cast<Pusher<PQueue> *>(*it);
- pThread->prepare( nStart, nStart + nThreadItemCount );
- nStart += nThreadItemCount;
- }
-
- pool.add( new Popper<PQueue>( pool, testQueue ), s_nPopThreadCount );
-
- m_nPusherCount.store( s_nPushThreadCount, atomics::memory_order_release );
- CPPUNIT_MSG( " push thread count=" << s_nPushThreadCount << " pop thread count=" << s_nPopThreadCount
- << ", item count=" << nThreadItemCount * s_nPushThreadCount << " ..." );
- pool.run();
- CPPUNIT_MSG( " Duration=" << pool.avgDuration() );
-
- // Analyze result
- size_t nTotalPopped = 0;
- size_t nPushFailed = 0;
- size_t nPopFailed = 0;
- for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
- Popper<PQueue> * pPopper = dynamic_cast<Popper<PQueue> *>(*it);
- if ( pPopper ) {
- nTotalPopped += pPopper->m_nPopSuccess;
- nPopFailed += pPopper->m_nPopFailed;
- }
- else {
- Pusher<PQueue> * pPusher = dynamic_cast<Pusher<PQueue> *>(*it);
- assert( pPusher );
- nPushFailed += pPusher->m_nPushError;
- }
- }
-
- CPPUNIT_MSG( " Total: popped=" << nTotalPopped << ", empty pop=" << nPopFailed << ", push error=" << nPushFailed );
- CPPUNIT_CHECK( nTotalPopped == nThreadItemCount * s_nPushThreadCount );
- CPPUNIT_CHECK( nPushFailed == 0 );
-
- check_statistics( testQueue.statistics() );
- CPPUNIT_MSG( testQueue.statistics() );
- }
-
- void setUpParams( const CppUnitMini::TestCfg& cfg ) {
- s_nPushThreadCount = cfg.getULong("PushThreadCount", (unsigned long) s_nPushThreadCount );
- s_nPopThreadCount = cfg.getULong("PopThreadCount", (unsigned long) s_nPopThreadCount );
- s_nQueueSize = cfg.getULong("QueueSize", (unsigned long) s_nQueueSize );
- }
-
- protected:
-#include "pqueue/pqueue_defs.h"
- CDSUNIT_DECLARE_MSPriorityQueue
- CDSUNIT_DECLARE_EllenBinTree
- CDSUNIT_DECLARE_SkipList
- CDSUNIT_DECLARE_FCPriorityQueue
- CDSUNIT_DECLARE_StdPQueue
-
- CPPUNIT_TEST_SUITE(PQueue_PushPop)
- CDSUNIT_TEST_MSPriorityQueue
- CDSUNIT_TEST_EllenBinTree
- CDSUNIT_TEST_SkipList
- CDSUNIT_TEST_FCPriorityQueue
- CDUNIT_TEST_StdPQueue
- CPPUNIT_TEST_SUITE_END();
- };
-
-} // namespace queue
-
-CPPUNIT_TEST_SUITE_REGISTRATION(pqueue::PQueue_PushPop);
+++ /dev/null
-/*
- 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_SKIPLIST_PQUEUE_H
-#define CDSUNIT_SKIPLIST_PQUEUE_H
-
-#include <cds/container/skip_list_set_hp.h>
-#include <cds/container/skip_list_set_dhp.h>
-#include <cds/urcu/general_instant.h>
-#include <cds/urcu/general_buffered.h>
-#include <cds/urcu/general_threaded.h>
-#include <cds/urcu/signal_buffered.h>
-#include <cds/urcu/signal_threaded.h>
-#include <cds/container/skip_list_set_rcu.h>
-
-namespace pqueue {
-
- template <typename GC>
- struct SkipListPQueue_pop_max
- {
- template <typename T, typename Set>
- bool operator()( T& dest, Set& container ) const
- {
- typename Set::guarded_ptr gp( container.extract_max());
- if ( gp )
- dest = *gp;
- return !gp.empty();
- }
- };
-
- template <typename RCU>
- struct SkipListPQueue_pop_max< cds::urcu::gc<RCU> >
- {
- template <typename T, typename Set>
- bool operator()( T& dest, Set& container ) const
- {
- typename Set::exempt_ptr ep( container.extract_max());
- if ( ep )
- dest = *ep;
- return !ep.empty();
- }
- };
-
- template <typename GC>
- struct SkipListPQueue_pop_min
- {
- template <typename T, typename Set>
- bool operator()( T& dest, Set& container ) const
- {
- typename Set::guarded_ptr gp( container.extract_min());
- if ( gp )
- dest = *gp;
- return !gp.empty();
- }
- };
-
- template <typename RCU>
- struct SkipListPQueue_pop_min< cds::urcu::gc<RCU> >
- {
- template <typename T, typename Set>
- bool operator()( T& dest, Set& container ) const
- {
- typename Set::exempt_ptr ep( container.extract_min());
- if ( ep )
- dest = *ep;
- return !ep.empty();
- }
- };
-
- template <typename GC, typename T, typename Traits, bool Max=true>
- class SkipListPQueue: protected cds::container::SkipListSet< GC, T, Traits >
- {
- typedef cds::container::SkipListSet< GC, T, Traits > base_class;
- typedef T value_type;
- template <typename GC2> friend struct SkipListPQueue_pop_max;
- template <typename GC2> friend struct SkipListPQueue_pop_min;
-
- public:
- bool push( value_type const& val )
- {
- return base_class::insert( val );
- }
-
- bool pop( value_type& dest )
- {
- return Max ? SkipListPQueue_pop_max< typename base_class::gc >()( dest, *this )
- : SkipListPQueue_pop_min< typename base_class::gc >()( dest, *this );
- }
-
- void clear()
- {
- base_class::clear();
- }
-
- bool empty() const
- {
- return base_class::empty();
- }
-
- size_t size() const
- {
- return base_class::size();
- }
-
- typename base_class::stat const& statistics() const
- {
- return base_class::statistics();
- }
- };
-
-} // namespace pqueue
-
-#endif // #ifndef CDSUNIT_SKIPLIST_PQUEUE_H
+++ /dev/null
-/*
- 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_STD_PQUEUE_H
-#define CDSUNIT_STD_PQUEUE_H
-
-#include <queue>
-#include <mutex> //unique_lock
-
-namespace pqueue {
-
- struct dummy_stat {};
-
- template <typename T, typename Container, typename Lock, typename Less=std::less<typename Container::value_type> >
- class StdPQueue
- {
- typedef T value_type;
- typedef std::priority_queue<value_type, Container, Less> pqueue_type;
-
- pqueue_type m_PQueue;
- mutable Lock m_Lock;
-
- typedef std::unique_lock<Lock> scoped_lock;
-
- public:
- bool push( value_type const& val )
- {
- scoped_lock l( m_Lock );
- m_PQueue.push( val );
- return true;
- }
-
- bool pop( value_type& dest )
- {
- scoped_lock l( m_Lock );
- if ( !m_PQueue.empty() ) {
- dest = m_PQueue.top();
- m_PQueue.pop();
- return true;
- }
- return false;
- }
-
- template <typename Q, typename MoveFunc>
- bool pop_with( Q& dest, MoveFunc f )
- {
- scoped_lock l( m_Lock );
- if ( !m_PQueue.empty() ) {
- f( dest, m_PQueue.top());
- m_PQueue.pop();
- return true;
- }
- return false;
- }
-
- void clear()
- {
- scoped_lock l( m_Lock );
- while ( !m_PQueue.empty() )
- m_PQueue.pop();
- }
-
- template <typename Func>
- void clear_with( Func f )
- {
- scoped_lock l( m_Lock );
- while ( !m_PQueue.empty() ) {
- f( m_PQueue.top() );
- m_PQueue.pop();
- }
- }
-
- bool empty() const
- {
- return m_PQueue.empty();
- }
-
- size_t size() const
- {
- return m_PQueue.size();
- }
-
- dummy_stat statistics() const
- {
- return dummy_stat();
- }
- };
-
-} // namespace pqueue
-
-namespace std {
- static inline ostream& operator <<( ostream& o, pqueue::dummy_stat )
- {
- return o;
- }
-}
-
-#endif // #ifndef CDSUNIT_STD_PQUEUE_H