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 "tree/hdr_ellenbintree_map.h"
32 #include <cds/urcu/signal_threaded.h>
33 #include <cds/container/ellen_bintree_map_rcu.h>
35 #include "tree/hdr_intrusive_ellen_bintree_pool_rcu.h"
36 #include "unit/print_ellenbintree_stat.h"
39 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
40 namespace cc = cds::container;
41 namespace co = cds::opt;
43 typedef cds::urcu::gc< cds::urcu::signal_threaded<> > rcu_type;
45 typedef cc::ellen_bintree::map_node<rcu_type, EllenBinTreeMapHdrTest::key_type, EllenBinTreeMapHdrTest::value_type> tree_leaf_node;
46 typedef cc::ellen_bintree::internal_node< EllenBinTreeMapHdrTest::key_type, tree_leaf_node > tree_internal_node;
47 typedef cc::ellen_bintree::update_desc<tree_leaf_node, tree_internal_node> tree_update_desc;
50 template <typename Tree>
51 void operator()( Tree const& t)
53 std::cout << t.statistics();
59 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_sht_less()
61 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
62 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
63 cc::ellen_bintree::make_map_traits<
68 test_rcu<set_type, print_stat>();
72 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_sht_cmp()
74 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
75 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
76 cc::ellen_bintree::make_map_traits<
77 co::compare< compare >
81 test_rcu<set_type, print_stat>();
85 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_sht_cmpless()
87 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
88 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
89 cc::ellen_bintree::make_map_traits<
90 co::compare< compare >
95 test_rcu<set_type, print_stat>();
99 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_sht_less_ic()
101 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
102 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
103 cc::ellen_bintree::make_map_traits<
105 ,co::item_counter< cds::atomicity::item_counter >
109 test_rcu<set_type, print_stat>();
113 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_sht_cmp_ic()
115 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
116 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
117 cc::ellen_bintree::make_map_traits<
118 co::item_counter< cds::atomicity::item_counter >
119 ,co::compare< compare >
123 test_rcu<set_type, print_stat>();
127 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_sht_less_stat()
129 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
130 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
131 cc::ellen_bintree::make_map_traits<
133 ,co::stat< cc::ellen_bintree::stat<> >
137 test_rcu<set_type, print_stat>();
141 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_sht_cmp_ic_stat()
143 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
144 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
145 cc::ellen_bintree::make_map_traits<
146 co::item_counter< cds::atomicity::item_counter >
147 ,co::stat< cc::ellen_bintree::stat<> >
148 ,co::compare< compare >
152 test_rcu<set_type, print_stat>();
156 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_sht_cmp_ic_stat_yield()
158 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
159 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
160 cc::ellen_bintree::make_map_traits<
161 co::item_counter< cds::atomicity::item_counter >
162 ,co::stat< cc::ellen_bintree::stat<> >
163 ,co::compare< compare >
164 , co::back_off< cds::backoff::yield >
168 test_rcu<set_type, print_stat>();
172 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_sht_less_pool()
174 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
175 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
176 cc::ellen_bintree::make_map_traits<
178 ,co::node_allocator< cds::memory::pool_allocator< tree_internal_node, ellen_bintree_rcu::internal_node_pool_accessor > >
179 ,cc::ellen_bintree::update_desc_allocator< cds::memory::pool_allocator< tree_update_desc, ellen_bintree_rcu::update_desc_pool_accessor > >
183 test_rcu<set_type, print_stat>();
187 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_sht_less_pool_ic_stat()
189 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
190 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
191 cc::ellen_bintree::make_map_traits<
193 ,co::node_allocator< cds::memory::pool_allocator< tree_internal_node, ellen_bintree_rcu::internal_node_pool_accessor > >
194 ,cc::ellen_bintree::update_desc_allocator< cds::memory::pool_allocator< tree_update_desc, ellen_bintree_rcu::update_desc_pool_accessor > >
195 ,co::item_counter< cds::atomicity::item_counter >
196 ,co::stat< cc::ellen_bintree::stat<> >
200 test_rcu<set_type, print_stat>();