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/general_instant.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 namespace cc = cds::container;
40 namespace co = cds::opt;
42 typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_type;
44 typedef cc::ellen_bintree::map_node<rcu_type, EllenBinTreeMapHdrTest::key_type, EllenBinTreeMapHdrTest::value_type> tree_leaf_node;
45 typedef cc::ellen_bintree::internal_node< EllenBinTreeMapHdrTest::key_type, tree_leaf_node > tree_internal_node;
46 typedef cc::ellen_bintree::update_desc<tree_leaf_node, tree_internal_node> tree_update_desc;
49 template <typename Tree>
50 void operator()( Tree const& t)
52 std::cout << t.statistics();
58 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_gpi_less()
60 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
61 cc::ellen_bintree::make_map_traits<
66 test_rcu<set_type, print_stat>();
69 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_gpi_cmp()
71 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
72 cc::ellen_bintree::make_map_traits<
73 co::compare< compare >
77 test_rcu<set_type, print_stat>();
80 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_gpi_cmpless()
82 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
83 cc::ellen_bintree::make_map_traits<
84 co::compare< compare >
89 test_rcu<set_type, print_stat>();
92 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_gpi_less_ic()
94 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
95 cc::ellen_bintree::make_map_traits<
97 ,co::item_counter< cds::atomicity::item_counter >
101 test_rcu<set_type, print_stat>();
104 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_gpi_cmp_ic()
106 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
107 cc::ellen_bintree::make_map_traits<
108 co::item_counter< cds::atomicity::item_counter >
109 ,co::compare< compare >
113 test_rcu<set_type, print_stat>();
116 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_gpi_less_stat()
118 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
119 cc::ellen_bintree::make_map_traits<
121 ,co::stat< cc::ellen_bintree::stat<> >
125 test_rcu<set_type, print_stat>();
128 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_gpi_cmp_ic_stat()
130 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
131 cc::ellen_bintree::make_map_traits<
132 co::item_counter< cds::atomicity::item_counter >
133 ,co::stat< cc::ellen_bintree::stat<> >
134 ,co::compare< compare >
138 test_rcu<set_type, print_stat>();
141 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_gpi_cmp_ic_stat_yield()
143 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
144 cc::ellen_bintree::make_map_traits<
145 co::item_counter< cds::atomicity::item_counter >
146 ,co::stat< cc::ellen_bintree::stat<> >
147 ,co::compare< compare >
148 , co::back_off< cds::backoff::yield >
152 test_rcu<set_type, print_stat>();
155 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_gpi_less_pool()
157 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
158 cc::ellen_bintree::make_map_traits<
160 ,co::node_allocator< cds::memory::pool_allocator< tree_internal_node, ellen_bintree_rcu::internal_node_pool_accessor > >
161 ,cc::ellen_bintree::update_desc_allocator< cds::memory::pool_allocator< tree_update_desc, ellen_bintree_rcu::update_desc_pool_accessor > >
165 test_rcu<set_type, print_stat>();
168 void EllenBinTreeMapHdrTest::EllenBinTree_rcu_gpi_less_pool_ic_stat()
170 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
171 cc::ellen_bintree::make_map_traits<
173 ,co::node_allocator< cds::memory::pool_allocator< tree_internal_node, ellen_bintree_rcu::internal_node_pool_accessor > >
174 ,cc::ellen_bintree::update_desc_allocator< cds::memory::pool_allocator< tree_update_desc, ellen_bintree_rcu::update_desc_pool_accessor > >
175 ,co::item_counter< cds::atomicity::item_counter >
176 ,co::stat< cc::ellen_bintree::stat<> >
180 test_rcu<set_type, print_stat>();