Fixed internal statistics printing for map/set stress test
[libcds.git] / test / stress / map / map_type.h
index ac56f95da366aa63019bef37e3f27bace9c6233a..08373a6621ebedc1ce9d0307aa7dbf1761774eb6 100644 (file)
@@ -5,7 +5,7 @@
 
     Source code repo: http://github.com/khizmax/libcds/
     Download: http://sourceforge.net/projects/libcds/files/
-    
+
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:
 
@@ -25,7 +25,7 @@
     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 #ifndef CDSUNIT_MAP_TYPE_H
 #include <boost/functional/hash/hash.hpp>
 
 #include <cds_test/stress_test.h>
+#include <cds_test/check_size.h>
 #include "framework/michael_alloc.h"
 
 namespace map {
     namespace cc = cds::container;
     namespace co = cds::opt;
 
-    typedef cds::urcu::gc< cds::urcu::general_instant<> >   rcu_gpi;
-    typedef cds::urcu::gc< cds::urcu::general_buffered<> >  rcu_gpb;
-    typedef cds::urcu::gc< cds::urcu::general_threaded<> >  rcu_gpt;
+    typedef cds::urcu::gc< cds::urcu::general_instant_stripped >   rcu_gpi;
+    typedef cds::urcu::gc< cds::urcu::general_buffered_stripped >  rcu_gpb;
+    typedef cds::urcu::gc< cds::urcu::general_threaded_stripped >  rcu_gpt;
 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-    typedef cds::urcu::gc< cds::urcu::signal_buffered<> >  rcu_shb;
-    typedef cds::urcu::gc< cds::urcu::signal_threaded<> >  rcu_sht;
+    typedef cds::urcu::gc< cds::urcu::signal_buffered_stripped >  rcu_shb;
+    typedef cds::urcu::gc< cds::urcu::signal_threaded_stripped >  rcu_sht;
 #endif
 
     template <typename Key>
@@ -72,7 +73,7 @@ namespace map {
     template <typename Key>
     struct hash;
 
-#define CDSUNIT_INT_COMPARE(t)  template <> struct cmp<t> { int operator()( t k1, t k2 ){ return (int)(k1 - k2); } }
+#define CDSUNIT_INT_COMPARE(t)  template <> struct cmp<t> { int operator()( t k1, t k2 ) const { return (int)(k1 - k2); } }
     CDSUNIT_INT_COMPARE(char);
     CDSUNIT_INT_COMPARE(unsigned char);
     CDSUNIT_INT_COMPARE(int);
@@ -83,7 +84,7 @@ namespace map {
     CDSUNIT_INT_COMPARE(unsigned long long);
 #undef CDSUNIT_INT_COMPARE
 
-#define CDSUNIT_INT_LESS(t)  template <> struct less<t> { bool operator()( t k1, t k2 ){ return k1 < k2; } }
+#define CDSUNIT_INT_LESS(t)  template <> struct less<t> { bool operator()( t k1, t k2 ) const { return k1 < k2; } }
     CDSUNIT_INT_LESS( char );
     CDSUNIT_INT_LESS( unsigned char );
     CDSUNIT_INT_LESS( int );
@@ -205,12 +206,20 @@ namespace map {
                 return seed;
             }
         };
-
     };
 
+    struct empty_stat {};
+    static inline cds_test::property_stream& operator <<( cds_test::property_stream& o, empty_stat const& )
+    {
+        return o;
+    }
+
     template <typename Map>
-    static inline void print_stat( cds_test::property_stream&, Map const& /*m*/ )
-    {}
+    static inline void print_stat( cds_test::property_stream& o, Map const& m )
+    {
+        o << m.statistics();
+    }
+
 
     template <typename Map>
     static inline void check_before_cleanup( Map& /*m*/ )