Tune FeldmanHashMap tests
authorkhizmax <libcds.dev@gmail.com>
Wed, 9 Dec 2015 19:42:05 +0000 (22:42 +0300)
committerkhizmax <libcds.dev@gmail.com>
Wed, 9 Dec 2015 19:42:05 +0000 (22:42 +0300)
tests/unit/map2/map_delodd.h
tests/unit/map2/map_delodd_feldmanhashmap.cpp
tests/unit/map2/map_insdel_func.h
tests/unit/map2/map_type_feldman_hashmap.h
tests/unit/print_feldman_hashset_stat.h
tests/unit/set2/set_type_feldman_hashset.h

index 883d6f8c0d1f247e1db451fcff938f77c126cce1..10009ae87bb759ceaae54d2920f3d9fe2e9d906a 100644 (file)
@@ -777,7 +777,7 @@ namespace map2 {
         CDSUNIT_DECLARE_EllenBinTreeMap
         CDSUNIT_DECLARE_BronsonAVLTreeMap
         CDSUNIT_DECLARE_FeldmanHashMap_fixed
         CDSUNIT_DECLARE_EllenBinTreeMap
         CDSUNIT_DECLARE_BronsonAVLTreeMap
         CDSUNIT_DECLARE_FeldmanHashMap_fixed
-        CDSUNIT_DECLARE_FeldmanHashMap_city
+        //CDSUNIT_DECLARE_FeldmanHashMap_city
         CDSUNIT_DECLARE_CuckooMap
 
         CPPUNIT_TEST_SUITE(Map_DelOdd)
         CDSUNIT_DECLARE_CuckooMap
 
         CPPUNIT_TEST_SUITE(Map_DelOdd)
@@ -787,7 +787,7 @@ namespace map2 {
             CDSUNIT_TEST_EllenBinTreeMap
             CDSUNIT_TEST_BronsonAVLTreeMap
             CDSUNIT_TEST_FeldmanHashMap_fixed
             CDSUNIT_TEST_EllenBinTreeMap
             CDSUNIT_TEST_BronsonAVLTreeMap
             CDSUNIT_TEST_FeldmanHashMap_fixed
-            CDSUNIT_TEST_FeldmanHashMap_city
+            //CDSUNIT_TEST_FeldmanHashMap_city
             CDSUNIT_TEST_CuckooMap
         CPPUNIT_TEST_SUITE_END();
 
             CDSUNIT_TEST_CuckooMap
         CPPUNIT_TEST_SUITE_END();
 
index 11c4d749a0fca3c615886151c6bc3ef3c595bc68..aa6e8418baa21575f7b91ab5807ee8409018b5c3 100644 (file)
@@ -9,5 +9,5 @@
 
 namespace map2 {
     CDSUNIT_DECLARE_FeldmanHashMap_fixed
 
 namespace map2 {
     CDSUNIT_DECLARE_FeldmanHashMap_fixed
-    CDSUNIT_DECLARE_FeldmanHashMap_city
+    //CDSUNIT_DECLARE_FeldmanHashMap_city
 } // namespace map2
 } // namespace map2
index 83d64b243fb375a9efdccaa854a02e8eb6e2b77d..ded6542e8060e4e2df0fe76be0ff94e740b38cd7 100644 (file)
@@ -219,8 +219,11 @@ namespace map2 {
                 template <typename Val>
                 void operator()( Val& cur, Val * old )
                 {
                 template <typename Val>
                 void operator()( Val& cur, Val * old )
                 {
-                    if ( old )
+                    if ( old ) {
+                        cur.second.nKey = cur.first;
+                        cur.second.nData = cur.first * 8;
                         cur.second.bInitialized.store( true, atomics::memory_order_release );
                         cur.second.bInitialized.store( true, atomics::memory_order_release );
+                    }
                     operator()( old == nullptr, cur.first, cur.second );
                 }
 
                     operator()( old == nullptr, cur.first, cur.second );
                 }
 
@@ -334,7 +337,7 @@ namespace map2 {
                 {
                     while ( true ) {
                         if ( v.bInitialized.load( atomics::memory_order_relaxed )) {
                 {
                     while ( true ) {
                         if ( v.bInitialized.load( atomics::memory_order_relaxed )) {
-                            std::unique_lock< typename value_type::lock_type>    ac( v.m_access );
+                            std::unique_lock< typename value_type::lock_type> ac( v.m_access );
 
                             if ( m_cnt.nKeyExpected == v.nKey && m_cnt.nKeyExpected * 8 == v.nData )
                                 ++m_cnt.nSuccessItem;
 
                             if ( m_cnt.nKeyExpected == v.nKey && m_cnt.nKeyExpected * 8 == v.nData )
                                 ++m_cnt.nSuccessItem;
index 6d6dd47518636ed482254635540b03a990ba61ce..0896230c8b6d04ca4b35c764a4c9760e70929868 100644 (file)
@@ -165,6 +165,8 @@ namespace map2 {
 
         std::vector< cds::intrusive::feldman_hashset::level_statistics > level_stat;
         m.get_level_statistics( level_stat );
 
         std::vector< cds::intrusive::feldman_hashset::level_statistics > level_stat;
         m.get_level_statistics( level_stat );
+        CPPUNIT_MSG( level_stat );
+        /*
         CPPUNIT_MSG( "Level statistics, height=" << level_stat.size());
         size_t i = 0;
         CPPUNIT_MSG( "  i   node_count capacity    data_cell   array_cell   empty_cell" );
         CPPUNIT_MSG( "Level statistics, height=" << level_stat.size());
         size_t i = 0;
         CPPUNIT_MSG( "  i   node_count capacity    data_cell   array_cell   empty_cell" );
@@ -177,6 +179,7 @@ namespace map2 {
                       << std::setw(12) << it->empty_cell_count << std::setw(0)
                       );
         }
                       << std::setw(12) << it->empty_cell_count << std::setw(0)
                       );
         }
+        */
     }
 
 }   // namespace map2
     }
 
 }   // namespace map2
index 73560dec2e38e831b310138f7f6db4c4bfd1e962..142b8ad160c016680d664ec082c98dcbd9fb7b85 100644 (file)
@@ -37,6 +37,23 @@ namespace std {
         return o;
     }
 
         return o;
     }
 
+    static inline ostream& operator<<( ostream& o, std::vector< cds::intrusive::feldman_hashset::level_statistics > const& level_stat )
+    {
+        o << "Level statistics, height=" << level_stat.size() << "\n";
+        size_t i = 0;
+        o << "  i   node_count capacity    data_cell   array_cell   empty_cell\n";
+        for ( auto it = level_stat.begin(); it != level_stat.end(); ++it, ++i ) {
+            o << std::setw( 3 ) << i << std::setw( 0 ) << " "
+              << std::setw( 12 ) << it->array_node_count << std::setw( 0 ) << " "
+              << std::setw( 8 ) << it->node_capacity << std::setw( 0 ) << " "
+              << std::setw( 12 ) << it->data_cell_count << std::setw( 0 ) << " "
+              << std::setw( 12 ) << it->array_cell_count << std::setw( 0 ) << " "
+              << std::setw( 12 ) << it->empty_cell_count << std::setw( 0 )
+              << "\n";
+        }
+        return o;
+    }
+
 } // namespace std
 
 #endif // #ifndef CDSUNIT_PRINT_FELDMAN_HASHSET_STAT_H
 } // namespace std
 
 #endif // #ifndef CDSUNIT_PRINT_FELDMAN_HASHSET_STAT_H
index 2b2b9d57c19b302c1088bde1a552540234b9bf5e..f9f00992a9eb2e2127af31a9425704995cf65b78 100644 (file)
@@ -284,6 +284,10 @@ namespace set2 {
     static inline void print_stat( FeldmanHashSet< GC, T, Traits > const& s )
     {
         CPPUNIT_MSG( s.statistics() );
     static inline void print_stat( FeldmanHashSet< GC, T, Traits > const& s )
     {
         CPPUNIT_MSG( s.statistics() );
+
+        std::vector< cds::intrusive::feldman_hashset::level_statistics > level_stat;
+        s.get_level_statistics( level_stat );
+        CPPUNIT_MSG( level_stat );
     }
 
 } // namespace set2
     }
 
 } // namespace set2