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/general_threaded.h>
33 #include <cds/container/feldman_hashmap_rcu.h>
34 #include "unit/print_feldman_hashset_stat.h"
38 typedef cds::urcu::gc< cds::urcu::general_threaded<>> rcu_type;
41 void FeldmanHashMapHdrTest::rcu_gpt_nohash()
43 typedef cc::FeldmanHashMap< rcu_type, size_t, Item > map_type;
45 test_rcu<map_type>(4, 2);
48 void FeldmanHashMapHdrTest::rcu_gpt_stdhash()
50 struct traits : public cc::feldman_hashmap::traits {
51 typedef std::hash<size_t> hash;
53 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
55 test_rcu<map_type>(4, 2);
58 void FeldmanHashMapHdrTest::rcu_gpt_hash128()
60 struct traits : public cc::feldman_hashmap::traits {
61 typedef hash128::make hash;
62 typedef hash128::less less;
64 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
65 test_rcu<map_type>(4, 2);
67 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
68 typename cc::feldman_hashmap::make_traits<
69 co::hash< hash128::make >
70 , co::less< hash128::less >
73 test_rcu<map_type2>(4, 2);
76 void FeldmanHashMapHdrTest::rcu_gpt_nohash_stat()
78 struct traits : public cc::feldman_hashmap::traits {
79 typedef cc::feldman_hashmap::stat<> stat;
81 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
82 test_rcu<map_type>(4, 2);
84 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
85 typename cc::feldman_hashmap::make_traits<
86 co::stat< cc::feldman_hashmap::stat<>>
89 test_rcu<map_type2>(4, 2);
92 void FeldmanHashMapHdrTest::rcu_gpt_stdhash_stat()
94 struct traits : public cc::feldman_hashmap::traits {
95 typedef std::hash<size_t> hash;
96 typedef cc::feldman_hashmap::stat<> stat;
98 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
99 test_rcu<map_type>(4, 2);
101 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
102 typename cc::feldman_hashmap::make_traits<
103 co::stat< cc::feldman_hashmap::stat<>>
104 ,co::hash<std::hash<size_t>>
107 test_rcu<map_type2>(4, 2);
110 void FeldmanHashMapHdrTest::rcu_gpt_hash128_stat()
112 struct traits : public cc::feldman_hashmap::traits {
113 typedef cc::feldman_hashmap::stat<> stat;
114 typedef hash128::make hash;
115 typedef hash128::cmp compare;
117 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
118 test_rcu<map_type>(4, 2);
120 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
121 typename cc::feldman_hashmap::make_traits<
122 co::stat< cc::feldman_hashmap::stat<>>
123 , co::hash< hash128::make >
124 , co::compare< hash128::cmp >
127 test_rcu<map_type2>(4, 2);
130 void FeldmanHashMapHdrTest::rcu_gpt_nohash_5_3()
132 typedef cc::FeldmanHashMap< rcu_type, size_t, Item > map_type;
134 test_rcu<map_type>(5, 3);
137 void FeldmanHashMapHdrTest::rcu_gpt_stdhash_5_3()
139 struct traits : public cc::feldman_hashmap::traits {
140 typedef std::hash<size_t> hash;
142 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
144 test_rcu<map_type>(5, 3);
147 void FeldmanHashMapHdrTest::rcu_gpt_nohash_5_3_stat()
149 struct traits : public cc::feldman_hashmap::traits {
150 typedef cc::feldman_hashmap::stat<> stat;
151 typedef cds::backoff::empty back_off;
153 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
154 test_rcu<map_type>(5, 3);
156 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
157 typename cc::feldman_hashmap::make_traits<
158 co::stat< cc::feldman_hashmap::stat<>>
159 , co::back_off< cds::backoff::empty >
162 test_rcu<map_type2>(5, 3);
165 void FeldmanHashMapHdrTest::rcu_gpt_stdhash_5_3_stat()
167 struct traits : public cc::feldman_hashmap::traits {
168 typedef cc::feldman_hashmap::stat<> stat;
169 typedef cds::backoff::empty back_off;
170 typedef std::hash<size_t> hash;
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 >
179 ,co::hash< std::hash<size_t>>
182 test_rcu<map_type2>(5, 3);
185 void FeldmanHashMapHdrTest::rcu_gpt_hash128_4_3()
187 struct traits : public cc::feldman_hashmap::traits {
188 typedef hash128::make hash;
189 typedef hash128::less less;
191 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
192 test_rcu<map_type>(4, 3);
194 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
195 typename cc::feldman_hashmap::make_traits<
196 co::hash< hash128::make >
197 , co::less< hash128::less >
200 test_rcu<map_type2>(4, 3);
203 void FeldmanHashMapHdrTest::rcu_gpt_hash128_4_3_stat()
205 struct traits : public cc::feldman_hashmap::traits {
206 typedef hash128::make hash;
207 typedef hash128::less less;
208 typedef cc::feldman_hashmap::stat<> stat;
209 typedef co::v::sequential_consistent memory_model;
211 typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
212 test_rcu<map_type>(4, 3);
214 typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
215 typename cc::feldman_hashmap::make_traits<
216 co::hash< hash128::make >
217 , co::less< hash128::less >
218 , co::stat< cc::feldman_hashmap::stat<>>
219 , co::memory_model< co::v::sequential_consistent >
222 test_rcu<map_type2>(4, 3);