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 "set/hdr_intrusive_feldman_hashset.h"
32 #include <cds/urcu/general_buffered.h>
33 #include <cds/intrusive/feldman_hashset_rcu.h>
34 #include "unit/print_feldman_hashset_stat.h"
38 typedef cds::urcu::gc<cds::urcu::general_buffered<>> rcu_type;
41 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_nohash()
43 typedef size_t key_type;
45 struct traits : public ci::feldman_hashset::traits
47 typedef get_key<key_type> hash_accessor;
48 typedef item_disposer disposer;
50 typedef ci::FeldmanHashSet< rcu_type, Item<key_type>, traits > set_type;
51 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!");
52 test_rcu<set_type, nohash<key_type>>(4, 2);
54 typedef ci::FeldmanHashSet<
57 typename ci::feldman_hashset::make_traits<
58 ci::feldman_hashset::hash_accessor< get_key<key_type>>
59 , ci::opt::disposer< item_disposer >
62 test_rcu<set_type2, nohash<key_type>>(4, 2);
65 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_stdhash()
67 typedef size_t hash_type;
69 struct traits: public ci::feldman_hashset::traits
71 typedef get_hash<hash_type> hash_accessor;
72 typedef item_disposer disposer;
74 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
75 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
76 test_rcu<set_type, std::hash<hash_type>>(4, 2);
78 typedef ci::FeldmanHashSet<
81 typename ci::feldman_hashset::make_traits<
82 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
83 , ci::opt::disposer< item_disposer >
86 test_rcu<set_type2, std::hash<hash_type>>(4, 2);
89 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_hash128()
91 typedef hash128 hash_type;
93 struct traits: public ci::feldman_hashset::traits
95 typedef get_hash<hash_type> hash_accessor;
96 typedef item_disposer disposer;
97 typedef hash128::less less;
99 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
100 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash128!!!" );
101 test_rcu<set_type, hash128::make>(4, 2);
103 typedef ci::FeldmanHashSet<
106 typename ci::feldman_hashset::make_traits<
107 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
108 , ci::opt::disposer< item_disposer >
109 , ci::opt::less< hash_type::less >
112 test_rcu<set_type2, hash128::make>(4, 2);
115 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_nohash_stat()
117 typedef size_t key_type;
119 struct traits : public ci::feldman_hashset::traits
121 typedef get_key<key_type> hash_accessor;
122 typedef item_disposer disposer;
123 typedef ci::feldman_hashset::stat<> stat;
125 typedef ci::FeldmanHashSet< rcu_type, Item<key_type>, traits > set_type;
126 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!");
127 test_rcu<set_type, nohash<key_type>>(4, 2);
129 typedef ci::FeldmanHashSet<
132 typename ci::feldman_hashset::make_traits<
133 ci::feldman_hashset::hash_accessor< get_key<key_type>>
134 , ci::opt::disposer< item_disposer >
135 , co::stat< ci::feldman_hashset::stat<>>
138 test_rcu<set_type2, nohash<key_type>>(4, 2);
141 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_stdhash_stat()
143 typedef size_t hash_type;
145 struct traits: public ci::feldman_hashset::traits
147 typedef get_hash<hash_type> hash_accessor;
148 typedef item_disposer disposer;
149 typedef ci::feldman_hashset::stat<> stat;
151 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
152 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
153 test_rcu<set_type, std::hash<hash_type>>(4, 2);
155 typedef ci::FeldmanHashSet<
158 typename ci::feldman_hashset::make_traits<
159 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
160 , ci::opt::disposer< item_disposer >
161 ,co::stat< ci::feldman_hashset::stat<>>
164 test_rcu<set_type2, std::hash<hash_type>>(4, 2);
167 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_hash128_stat()
169 typedef hash128 hash_type;
171 struct traits: public ci::feldman_hashset::traits
173 typedef get_hash<hash_type> hash_accessor;
174 typedef item_disposer disposer;
175 typedef hash128::cmp compare;
176 typedef ci::feldman_hashset::stat<> stat;
178 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
179 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash_type!!!" );
180 test_rcu<set_type, hash_type::make>(4, 2);
182 typedef ci::FeldmanHashSet<
185 typename ci::feldman_hashset::make_traits<
186 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
187 , ci::opt::disposer< item_disposer >
188 ,co::stat< ci::feldman_hashset::stat<>>
189 ,co::compare< hash128::cmp >
192 test_rcu<set_type2, hash_type::make>(4, 2);
195 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_nohash_5_3()
197 typedef size_t key_type;
199 struct traits : public ci::feldman_hashset::traits
201 typedef get_key<key_type> hash_accessor;
202 typedef item_disposer disposer;
204 typedef ci::FeldmanHashSet< rcu_type, Item<key_type>, traits > set_type;
205 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!");
206 test_rcu<set_type, nohash<key_type>>(5, 3);
208 typedef ci::FeldmanHashSet<
211 typename ci::feldman_hashset::make_traits<
212 ci::feldman_hashset::hash_accessor< get_key<key_type>>
213 , ci::opt::disposer< item_disposer >
216 test_rcu<set_type2, nohash<key_type>>(5, 3);
219 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_stdhash_5_3()
221 typedef size_t hash_type;
223 struct traits: public ci::feldman_hashset::traits
225 typedef get_hash<hash_type> hash_accessor;
226 typedef item_disposer disposer;
228 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
229 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
230 test_rcu<set_type, std::hash<hash_type>>(5, 3);
232 typedef ci::FeldmanHashSet<
235 typename ci::feldman_hashset::make_traits<
236 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
237 , ci::opt::disposer< item_disposer >
240 test_rcu<set_type2, std::hash<hash_type>>(5, 3);
243 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_hash128_4_3()
245 typedef hash128 hash_type;
247 struct traits: public ci::feldman_hashset::traits
249 typedef get_hash<hash_type> hash_accessor;
250 typedef item_disposer disposer;
251 typedef co::v::sequential_consistent memory_model;
253 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
254 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash_type!!!" );
255 test_rcu<set_type, hash128::make >(4, 3);
257 typedef ci::FeldmanHashSet<
260 typename ci::feldman_hashset::make_traits<
261 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
262 , ci::opt::disposer< item_disposer >
263 ,co::memory_model< co::v::sequential_consistent >
266 test_rcu<set_type2, hash128::make >(4, 3);
269 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_nohash_5_3_stat()
271 typedef size_t key_type;
273 struct traits: public ci::feldman_hashset::traits
275 typedef get_key<key_type> hash_accessor;
276 typedef item_disposer disposer;
277 typedef ci::feldman_hashset::stat<> stat;
279 typedef ci::FeldmanHashSet< rcu_type, Item<key_type>, traits > set_type;
280 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
281 test_rcu<set_type, nohash<key_type>>(5, 3);
283 typedef ci::FeldmanHashSet<
286 typename ci::feldman_hashset::make_traits<
287 ci::feldman_hashset::hash_accessor< get_key<key_type>>
288 , ci::opt::disposer< item_disposer >
289 ,co::stat< ci::feldman_hashset::stat<>>
292 test_rcu<set_type2, nohash<key_type>>(5, 3);
295 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_stdhash_5_3_stat()
297 typedef size_t hash_type;
299 struct traits: public ci::feldman_hashset::traits
301 typedef get_hash<hash_type> hash_accessor;
302 typedef item_disposer disposer;
303 typedef ci::feldman_hashset::stat<> stat;
305 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
306 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
307 test_rcu<set_type, std::hash<hash_type>>(5, 3);
309 typedef ci::FeldmanHashSet<
312 typename ci::feldman_hashset::make_traits<
313 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
314 , ci::opt::disposer< item_disposer >
315 ,co::stat< ci::feldman_hashset::stat<>>
318 test_rcu<set_type2, std::hash<hash_type>>(5, 3);
321 void IntrusiveFeldmanHashSetHdrTest::rcu_gpb_hash128_4_3_stat()
323 typedef hash128 hash_type;
325 struct traits: public ci::feldman_hashset::traits
327 typedef get_hash<hash_type> hash_accessor;
328 typedef item_disposer disposer;
329 typedef ci::feldman_hashset::stat<> stat;
330 typedef hash128::less less;
331 typedef hash128::cmp compare;
333 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
334 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash_type!!!" );
335 test_rcu<set_type, hash_type::make>(4, 3);
337 typedef ci::FeldmanHashSet<
340 typename ci::feldman_hashset::make_traits<
341 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
342 , ci::opt::disposer< item_disposer >
343 , co::stat< ci::feldman_hashset::stat<>>
344 , co::less< hash_type::less >
345 , co::compare< hash128::cmp >
348 test_rcu<set_type2, hash_type::make>(4, 3);