Fixed MultiLevelHashSet MT-test
[libcds.git] / tests / unit / set2 / set_insdelfind.cpp
1 //$$CDS-header$$
2
3 #include "set2/set_insdelfind.h"
4
5 namespace set2 {
6     CPPUNIT_TEST_SUITE_REGISTRATION( Set_InsDelFind );
7
8     void Set_InsDelFind::setUpParams( const CppUnitMini::TestCfg& cfg )
9     {
10         c_nSetSize = cfg.getSizeT("InitialMapSize", c_nSetSize );
11         c_nThreadCount = cfg.getSizeT("ThreadCount", c_nThreadCount );
12         c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
13         c_nInsertPercentage = cfg.getUInt("InsertPercentage", c_nInsertPercentage );
14         c_nDeletePercentage = cfg.getUInt("DeletePercentage", c_nDeletePercentage );
15         c_nDuration = cfg.getUInt("Duration", c_nDuration );
16         c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
17
18         c_nCuckooInitialSize = cfg.getSizeT("CuckooInitialSize", c_nCuckooInitialSize );
19         c_nCuckooProbesetSize = cfg.getSizeT("CuckooProbesetSize", c_nCuckooProbesetSize );
20         c_nCuckooProbesetThreshold = cfg.getSizeT("CuckooProbesetThreshold", c_nCuckooProbesetThreshold );
21
22         c_nMultiLevelSet_HeadBits = cfg.getSizeT("MultiLevelMapHeadBits", c_nMultiLevelSet_HeadBits);
23         c_nMultiLevelSet_ArrayBits = cfg.getSizeT("MultiLevelMapArrayBits", c_nMultiLevelSet_ArrayBits);
24
25         if ( c_nThreadCount == 0 )
26             c_nThreadCount = std::thread::hardware_concurrency();
27
28         CPPUNIT_ASSERT( c_nInsertPercentage + c_nDeletePercentage <= 100 );
29
30         actions * pFirst = m_arrShuffle;
31         actions * pLast = m_arrShuffle + c_nInsertPercentage;
32         std::fill( pFirst, pLast, do_insert );
33         pFirst = pLast;
34         pLast += c_nDeletePercentage;
35         std::fill( pFirst, pLast, do_delete );
36         pFirst = pLast;
37         pLast = m_arrShuffle + sizeof(m_arrShuffle)/sizeof(m_arrShuffle[0]);
38         std::fill( pFirst, pLast, do_find );
39         shuffle( m_arrShuffle, pLast );
40     }
41 } // namespace set2