b553661e32c44ea91835a5423edae3ddcb6bb6e4
[libcds.git] / tests / test-hdr / map / hdr_multilevel_hashmap_rcu_shb.cpp
1 //$$CDS-header$$
2
3 #include "map/hdr_multilevel_hashmap.h"
4 #include <cds/urcu/signal_buffered.h>
5 #include <cds/container/multilevel_hashmap_rcu.h>
6 #include "unit/print_multilevel_hashset_stat.h"
7
8 namespace map {
9 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
10     namespace {
11         typedef cds::urcu::gc< cds::urcu::signal_buffered<>> rcu_type;
12     } // namespace
13 #endif
14
15     void MultiLevelHashMapHdrTest::rcu_shb_stdhash()
16     {
17 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
18         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item > map_type;
19
20         test_rcu<map_type>(4, 2);
21 #endif
22     }
23
24     void MultiLevelHashMapHdrTest::rcu_shb_hash128()
25     {
26 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
27         struct traits : public cc::multilevel_hashmap::traits {
28             typedef hash128::make hash;
29             typedef hash128::less less;
30         };
31         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item, traits > map_type;
32         test_rcu<map_type>(4, 2);
33
34         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item,
35             typename cc::multilevel_hashmap::make_traits<
36                 co::hash< hash128::make >
37                 , co::less< hash128::less >
38             >::type
39         > map_type2;
40         test_rcu<map_type2>(4, 2);
41 #endif
42     }
43
44     void MultiLevelHashMapHdrTest::rcu_shb_stdhash_stat()
45     {
46 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
47         struct traits : public cc::multilevel_hashmap::traits {
48             typedef cc::multilevel_hashmap::stat<> stat;
49         };
50         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item, traits > map_type;
51         test_rcu<map_type>(4, 2);
52
53         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item,
54             typename cc::multilevel_hashmap::make_traits<
55                 co::stat< cc::multilevel_hashmap::stat<>>
56             >::type
57         > map_type2;
58         test_rcu<map_type2>(4, 2);
59 #endif
60     }
61
62         void MultiLevelHashMapHdrTest::rcu_shb_hash128_stat()
63     {
64 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
65         struct traits : public cc::multilevel_hashmap::traits {
66             typedef cc::multilevel_hashmap::stat<> stat;
67             typedef hash128::make hash;
68             typedef hash128::cmp compare;
69         };
70         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item, traits > map_type;
71         test_rcu<map_type>(4, 2);
72
73         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item,
74             typename cc::multilevel_hashmap::make_traits<
75                 co::stat< cc::multilevel_hashmap::stat<>>
76                 , co::hash< hash128::make >
77                 , co::compare< hash128::cmp >
78             >::type
79         > map_type2;
80         test_rcu<map_type2>(4, 2);
81 #endif
82         }
83
84     void MultiLevelHashMapHdrTest::rcu_shb_stdhash_5_3()
85     {
86 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
87         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item > map_type;
88
89         test_rcu<map_type>(5, 3);
90 #endif
91     }
92
93     void MultiLevelHashMapHdrTest::rcu_shb_stdhash_5_3_stat()
94     {
95 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
96         struct traits : public cc::multilevel_hashmap::traits {
97             typedef cc::multilevel_hashmap::stat<> stat;
98             typedef cds::backoff::empty back_off;
99         };
100         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item, traits > map_type;
101         test_rcu<map_type>(5, 3);
102
103         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item,
104             typename cc::multilevel_hashmap::make_traits<
105                 co::stat< cc::multilevel_hashmap::stat<>>
106                 ,co::back_off< cds::backoff::empty >
107             >::type
108         > map_type2;
109         test_rcu<map_type2>(5, 3);
110 #endif
111     }
112
113     void MultiLevelHashMapHdrTest::rcu_shb_hash128_4_3()
114     {
115 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
116         struct traits : public cc::multilevel_hashmap::traits {
117             typedef hash128::make hash;
118             typedef hash128::less less;
119         };
120         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item, traits > map_type;
121         test_rcu<map_type>(4, 3);
122
123         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item,
124             typename cc::multilevel_hashmap::make_traits<
125                 co::hash< hash128::make >
126                 , co::less< hash128::less >
127             >::type
128         > map_type2;
129         test_rcu<map_type2>(4, 3);
130 #endif
131     }
132
133     void MultiLevelHashMapHdrTest::rcu_shb_hash128_4_3_stat()
134     {
135 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
136         struct traits : public cc::multilevel_hashmap::traits {
137             typedef hash128::make hash;
138             typedef hash128::less less;
139             typedef cc::multilevel_hashmap::stat<> stat;
140             typedef co::v::sequential_consistent memory_model;
141         };
142         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item, traits > map_type;
143         test_rcu<map_type>(4, 3);
144
145         typedef cc::MultiLevelHashMap< rcu_type, size_t, Item,
146             typename cc::multilevel_hashmap::make_traits<
147                 co::hash< hash128::make >
148                 , co::less< hash128::less >
149                 , co::stat< cc::multilevel_hashmap::stat<>>
150                 , co::memory_model< co::v::sequential_consistent >
151             >::type
152         > map_type2;
153         test_rcu<map_type2>(4, 3);
154 #endif
155     }
156
157 } // namespace map