Refactors some of existing cds multi-threaded stress test cases
[libcds.git] / test / stress / map / insdelfind / map_insdelfind.cpp
index 642abd2401d6577b6ad15f336271d419dd5a658f..830356e898311db3ec831f00b5ffd462555f8996 100644 (file)
@@ -34,6 +34,7 @@ namespace map {
 
     size_t Map_InsDelFind::s_nMapSize = 500000;
     size_t Map_InsDelFind::s_nThreadCount = 8;
+    size_t Map_InsDelFind::s_nPassCount = 100000;
     size_t Map_InsDelFind::s_nMaxLoadFactor = 8;
     unsigned int Map_InsDelFind::s_nInsertPercentage = 5;
     unsigned int Map_InsDelFind::s_nDeletePercentage = 5;
@@ -60,7 +61,11 @@ namespace map {
 
         s_nThreadCount = cfg.get_size_t( "ThreadCount", s_nThreadCount );
         if ( s_nThreadCount == 0 )
-            s_nThreadCount = std::thread::hardware_concurrency() * 2;
+            s_nThreadCount = std::min( 16u, std::thread::hardware_concurrency() * 2 );
+
+        s_nPassCount = cfg.get_size_t( "PassCount", s_nPassCount );
+        if ( s_nPassCount == 0 )
+            s_nThreadCount = 1000;
 
         s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor );
         if ( s_nMaxLoadFactor == 0 )
@@ -130,5 +135,14 @@ namespace map {
         return lf;
     }
 
-    INSTANTIATE_TEST_CASE_P( _, Map_InsDelFind_LF, ::testing::ValuesIn( Map_InsDelFind_LF::get_load_factors()));
+#ifdef CDSTEST_GTEST_INSTANTIATE_TEST_CASE_P_HAS_4TH_ARG
+    static std::string get_test_parameter_name( testing::TestParamInfo<size_t> const& p )
+    {
+        return std::to_string( p.param );
+    }
+    INSTANTIATE_TEST_CASE_P( a, Map_InsDelFind_LF, ::testing::ValuesIn( Map_InsDelFind_LF::get_load_factors()), get_test_parameter_name );
+#else
+    INSTANTIATE_TEST_CASE_P( a, Map_InsDelFind_LF, ::testing::ValuesIn( Map_InsDelFind_LF::get_load_factors()));
+#endif
+
 } // namespace map