Reorganized map2 unit test to reduce compiling time and memory
[libcds.git] / tests / unit / map2 / map_delodd.cpp
1 //$$CDS-header$$
2
3 #include "map2/map_delodd.h"
4
5 namespace map2 {
6     CPPUNIT_TEST_SUITE_REGISTRATION( Map_DelOdd );
7
8     size_t  Map_DelOdd::c_nMapSize = 1000000         ;  // max map size
9     size_t  Map_DelOdd::c_nInsThreadCount = 4        ;  // insert thread count
10     size_t  Map_DelOdd::c_nDelThreadCount = 4        ;  // delete thread count
11     size_t  Map_DelOdd::c_nExtractThreadCount = 4    ;  // extract thread count
12     size_t  Map_DelOdd::c_nMaxLoadFactor = 8         ;  // maximum load factor
13     bool    Map_DelOdd::c_bPrintGCState = true;
14
15     void Map_DelOdd::setUpParams( const CppUnitMini::TestCfg& cfg ) {
16         c_nMapSize = cfg.getULong("MapSize", static_cast<unsigned long>(c_nMapSize) );
17         c_nInsThreadCount = cfg.getULong("InsThreadCount", static_cast<unsigned long>(c_nInsThreadCount) );
18         c_nDelThreadCount = cfg.getULong("DelThreadCount", static_cast<unsigned long>(c_nDelThreadCount) );
19         c_nExtractThreadCount = cfg.getULong("ExtractThreadCount", static_cast<unsigned long>(c_nExtractThreadCount) );
20         c_nMaxLoadFactor = cfg.getULong("MaxLoadFactor", static_cast<unsigned long>(c_nMaxLoadFactor) );
21         c_bPrintGCState = cfg.getBool("PrintGCStateFlag", true );
22
23         if ( c_nInsThreadCount == 0 )
24             c_nInsThreadCount = cds::OS::topology::processor_count();
25         if ( c_nDelThreadCount == 0 && c_nExtractThreadCount == 0 ) {
26             c_nExtractThreadCount = cds::OS::topology::processor_count() / 2;
27             c_nDelThreadCount = cds::OS::topology::processor_count() - c_nExtractThreadCount;
28         }
29
30         m_arrData.resize( c_nMapSize );
31         for ( size_t i = 0; i < c_nMapSize; ++i )
32             m_arrData[i] = i;
33         std::random_shuffle( m_arrData.begin(), m_arrData.end() );
34     }
35
36     void Map_DelOdd::myRun(const char *in_name, bool invert /*= false*/)
37     {
38         setUpParams( m_Cfg.get( "Map_DelOdd" ));
39
40         run_MichaelMap(in_name, invert);
41         run_SplitList(in_name, invert);
42         run_SkipListMap(in_name, invert);
43         run_EllenBinTreeMap(in_name, invert);
44         run_BronsonAVLTreeMap(in_name, invert);
45         //run_StripedMap(in_name, invert);
46         //run_RefinableMap(in_name, invert);
47         run_CuckooMap(in_name, invert);
48         //run_StdMap(in_name, invert);
49
50         endTestCase();
51     }
52
53 } // namespace map2