Merged branch 'master' of https://github.com/Nemo1369/libcds
[libcds.git] / test / stress / map / delodd / map_delodd.cpp
index 44b951b2289da29806779f9399b92c84661862db..bd9d9855d5e80394dd9847e55acd7e7898d0068d 100644 (file)
@@ -1,11 +1,11 @@
 /*
     This file is a part of libcds - Concurrent Data Structures library
 
-    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
 
     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:
 
     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.
 */
 
 #include "map_delodd.h"
 
 namespace map {
-    
-    size_t  Map_DelOdd::s_nMapSize = 1000000;
+
+    size_t  Map_DelOdd::s_nMapSize = 10000;
     size_t  Map_DelOdd::s_nInsThreadCount = 4;
     size_t  Map_DelOdd::s_nDelThreadCount = 4;
     size_t  Map_DelOdd::s_nExtractThreadCount = 4;
+    size_t  Map_DelOdd::s_nFindThreadCount = 2;
     size_t  Map_DelOdd::s_nMaxLoadFactor = 8;
+    size_t  Map_DelOdd::s_nInsertPassCount = 100;
 
     size_t  Map_DelOdd::s_nCuckooInitialSize = 1024;
     size_t  Map_DelOdd::s_nCuckooProbesetSize = 16;
@@ -45,10 +47,8 @@ namespace map {
     size_t Map_DelOdd::s_nFeldmanMap_HeadBits = 10;
     size_t Map_DelOdd::s_nFeldmanMap_ArrayBits = 4;
 
-
     size_t Map_DelOdd::s_nLoadFactor = 1;
-    std::vector<size_t> Map_DelOdd::m_arrInsert;
-    std::vector<size_t> Map_DelOdd::m_arrRemove;
+    std::vector<size_t> Map_DelOdd::m_arrElements;
 
     void Map_DelOdd::SetUpTestCase()
     {
@@ -64,11 +64,16 @@ namespace map {
 
         s_nDelThreadCount = cfg.get_size_t( "DelThreadCount", s_nDelThreadCount );
         s_nExtractThreadCount = cfg.get_size_t( "ExtractThreadCount", s_nExtractThreadCount );
+        s_nFindThreadCount = cfg.get_size_t( "FindThreadCount", s_nFindThreadCount );
 
         s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor );
         if ( s_nMaxLoadFactor == 0 )
             s_nMaxLoadFactor = 1;
 
+        s_nInsertPassCount = cfg.get_size_t( "PassCount", s_nInsertPassCount );
+        if ( s_nInsertPassCount == 0 )
+            s_nInsertPassCount = 100;
+
         s_nCuckooInitialSize = cfg.get_size_t( "CuckooInitialSize", s_nCuckooInitialSize );
         if ( s_nCuckooInitialSize < 256 )
             s_nCuckooInitialSize = 256;
@@ -87,21 +92,15 @@ namespace map {
         if ( s_nFeldmanMap_ArrayBits == 0 )
             s_nFeldmanMap_ArrayBits = 2;
 
-
-        m_arrInsert.resize( s_nMapSize );
-        m_arrRemove.resize( s_nMapSize );
-        for ( size_t i = 0; i < s_nMapSize; ++i ) {
-            m_arrInsert[i] = i;
-            m_arrRemove[i] = i;
-        }
-        shuffle( m_arrInsert.begin(), m_arrInsert.end() );
-        shuffle( m_arrRemove.begin(), m_arrRemove.end() );
+        m_arrElements.resize( s_nMapSize );
+        for ( size_t i = 0; i < s_nMapSize; ++i )
+            m_arrElements[i] = i;;
+        shuffle( m_arrElements.begin(), m_arrElements.end());
     }
 
     void Map_DelOdd::TearDownTestCase()
     {
-        m_arrInsert.clear();
-        m_arrRemove.clear();
+        m_arrElements.clear();
     }
 
     std::vector<size_t> Map_DelOdd_LF::get_load_factors()
@@ -119,5 +118,5 @@ namespace map {
         return lf;
     }
 
-    INSTANTIATE_TEST_CASE_P( a, Map_DelOdd_LF, ::testing::ValuesIn( Map_DelOdd_LF::get_load_factors() ) );
+    INSTANTIATE_TEST_CASE_P( a, Map_DelOdd_LF, ::testing::ValuesIn( Map_DelOdd_LF::get_load_factors()));
 } // namespace map