Merge branch 'dev'
[libcds.git] / tests / unit / set2 / set_delodd.cpp
1 //$$CDS-header$$
2
3 #include "set2/set_delodd.h"
4
5 namespace set2 {
6     CPPUNIT_TEST_SUITE_REGISTRATION( Set_DelOdd );
7
8     size_t Set_DelOdd::c_nSetSize = 1000000;
9     size_t Set_DelOdd::c_nInsThreadCount;
10     size_t Set_DelOdd::c_nDelThreadCount;
11     size_t Set_DelOdd::c_nExtractThreadCount;
12     size_t Set_DelOdd::c_nMaxLoadFactor;
13     bool   Set_DelOdd::c_bPrintGCState;
14
15     void Set_DelOdd::setUpParams( const CppUnitMini::TestCfg& cfg )
16     {
17         c_nSetSize = cfg.getSizeT("MapSize", c_nSetSize );
18         c_nInsThreadCount = cfg.getSizeT("InsThreadCount", c_nInsThreadCount);
19         c_nDelThreadCount = cfg.getSizeT("DelThreadCount", c_nDelThreadCount);
20         c_nExtractThreadCount = cfg.getSizeT("ExtractThreadCount", c_nExtractThreadCount);
21         c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor);
22         c_bPrintGCState = cfg.getBool("PrintGCStateFlag", true );
23
24         if ( c_nInsThreadCount == 0 )
25             c_nInsThreadCount = cds::OS::topology::processor_count();
26         if ( c_nDelThreadCount == 0 && c_nExtractThreadCount == 0 ) {
27             c_nExtractThreadCount = cds::OS::topology::processor_count() / 2;
28             c_nDelThreadCount = cds::OS::topology::processor_count() - c_nExtractThreadCount;
29         }
30
31         m_arrData.resize( c_nSetSize );
32         for ( size_t i = 0; i < c_nSetSize; ++i )
33             m_arrData[i] = i;
34         std::random_shuffle( m_arrData.begin(), m_arrData.end() );
35     }
36
37     void Set_DelOdd::myRun(const char *in_name, bool invert /*= false*/)
38     {
39         setUpParams( m_Cfg.get( "Map_DelOdd" ));
40
41         run_MichaelSet(in_name, invert);
42         run_SplitList(in_name, invert);
43         run_SkipListSet(in_name, invert);
44         run_EllenBinTreeSet(in_name, invert);
45         run_CuckooSet(in_name, invert);
46
47         endTestCase();
48     }
49 } // namespace set2