2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
6 Source code repo: http://github.com/khizmax/libcds/
7 Download: http://sourceforge.net/projects/libcds/files/
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "map/hdr_feldman_hashmap.h"
32 #include <cds/urcu/signal_threaded.h>
33 #include <cds/container/feldman_hashmap_rcu.h>
34 #include "unit/print_feldman_hashset_stat.h"
37 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
39 typedef cds::urcu::gc< cds::urcu::signal_threaded<>> rcu_type;
43 void FeldmanHashMapHdrTest::rcu_sht_nohash()
45 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
46 typedef cc::FeldmanHashMap< rcu_type, size_t, Item > map_type;
48 test_rcu<map_type>(4, 2);
52 void FeldmanHashMapHdrTest::rcu_sht_stdhash()
54 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
55 struct traits : public cc::feldman_hashmap::traits {
56 typedef std::hash<size_t> hash;
58 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
60 test_rcu<map_type>(4, 2);
64 void FeldmanHashMapHdrTest::rcu_sht_hash128()
66 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
67 struct traits : public cc::feldman_hashmap::traits {
68 typedef hash128::make hash;
69 typedef hash128::less less;
71 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
72 test_rcu<map_type>(4, 2);
74 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
75 typename cc::feldman_hashmap::make_traits<
76 co::hash< hash128::make >
77 , co::less< hash128::less >
80 test_rcu<map_type2>(4, 2);
84 void FeldmanHashMapHdrTest::rcu_sht_nohash_stat()
86 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
87 struct traits : public cc::feldman_hashmap::traits {
88 typedef cc::feldman_hashmap::stat<> stat;
90 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
91 test_rcu<map_type>(4, 2);
93 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
94 typename cc::feldman_hashmap::make_traits<
95 co::stat< cc::feldman_hashmap::stat<>>
98 test_rcu<map_type2>(4, 2);
102 void FeldmanHashMapHdrTest::rcu_sht_stdhash_stat()
104 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
105 struct traits : public cc::feldman_hashmap::traits {
106 typedef std::hash<size_t> hash;
107 typedef cc::feldman_hashmap::stat<> stat;
109 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
110 test_rcu<map_type>(4, 2);
112 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
113 typename cc::feldman_hashmap::make_traits<
114 co::stat< cc::feldman_hashmap::stat<>>
115 ,co::hash<std::hash<size_t>>
118 test_rcu<map_type2>(4, 2);
122 void FeldmanHashMapHdrTest::rcu_sht_hash128_stat()
124 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
125 struct traits : public cc::feldman_hashmap::traits {
126 typedef cc::feldman_hashmap::stat<> stat;
127 typedef hash128::make hash;
128 typedef hash128::cmp compare;
130 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
131 test_rcu<map_type>(4, 2);
133 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
134 typename cc::feldman_hashmap::make_traits<
135 co::stat< cc::feldman_hashmap::stat<>>
136 , co::hash< hash128::make >
137 , co::compare< hash128::cmp >
140 test_rcu<map_type2>(4, 2);
144 void FeldmanHashMapHdrTest::rcu_sht_nohash_5_3()
146 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
147 typedef cc::FeldmanHashMap< rcu_type, size_t, Item > map_type;
149 test_rcu<map_type>(5, 3);
153 void FeldmanHashMapHdrTest::rcu_sht_stdhash_5_3()
155 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
156 struct traits : public cc::feldman_hashmap::traits {
157 typedef std::hash<size_t> hash;
159 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
161 test_rcu<map_type>(5, 3);
165 void FeldmanHashMapHdrTest::rcu_sht_nohash_5_3_stat()
167 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
168 struct traits : public cc::feldman_hashmap::traits {
169 typedef cc::feldman_hashmap::stat<> stat;
170 typedef cds::backoff::empty back_off;
172 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
173 test_rcu<map_type>(5, 3);
175 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
176 typename cc::feldman_hashmap::make_traits<
177 co::stat< cc::feldman_hashmap::stat<>>
178 , co::back_off< cds::backoff::empty >
181 test_rcu<map_type2>(5, 3);
185 void FeldmanHashMapHdrTest::rcu_sht_stdhash_5_3_stat()
187 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
188 struct traits : public cc::feldman_hashmap::traits {
189 typedef cc::feldman_hashmap::stat<> stat;
190 typedef cds::backoff::empty back_off;
191 typedef std::hash<size_t> hash;
193 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
194 test_rcu<map_type>(5, 3);
196 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
197 typename cc::feldman_hashmap::make_traits<
198 co::stat< cc::feldman_hashmap::stat<>>
199 ,co::back_off< cds::backoff::empty >
200 ,co::hash< std::hash<size_t>>
203 test_rcu<map_type2>(5, 3);
207 void FeldmanHashMapHdrTest::rcu_sht_hash128_4_3()
209 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
210 struct traits : public cc::feldman_hashmap::traits {
211 typedef hash128::make hash;
212 typedef hash128::less less;
214 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
215 test_rcu<map_type>(4, 3);
217 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
218 typename cc::feldman_hashmap::make_traits<
219 co::hash< hash128::make >
220 , co::less< hash128::less >
223 test_rcu<map_type2>(4, 3);
227 void FeldmanHashMapHdrTest::rcu_sht_hash128_4_3_stat()
229 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
230 struct traits : public cc::feldman_hashmap::traits {
231 typedef hash128::make hash;
232 typedef hash128::less less;
233 typedef cc::feldman_hashmap::stat<> stat;
234 typedef co::v::sequential_consistent memory_model;
236 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
237 test_rcu<map_type>(4, 3);
239 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
240 typename cc::feldman_hashmap::make_traits<
241 co::hash< hash128::make >
242 , co::less< hash128::less >
243 , co::stat< cc::feldman_hashmap::stat<>>
244 , co::memory_model< co::v::sequential_consistent >
247 test_rcu<map_type2>(4, 3);