cd63603934d7ca18b4a30ca828af84b8b69db316
[libcds.git] / tests / unit / map2 / map_insdel_int.cpp
1 //$$CDS-header$$
2
3 #include "map2/map_insdel_int.h"
4 #include <cds/os/topology.h>
5
6 namespace map2 {
7     CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDel_int );
8
9
10     void Map_InsDel_int::setUpParams( const CppUnitMini::TestCfg& cfg ) {
11         c_nInsertThreadCount = cfg.getSizeT("InsertThreadCount", c_nInsertThreadCount );
12         c_nDeleteThreadCount = cfg.getSizeT("DeleteThreadCount", c_nDeleteThreadCount );
13         c_nThreadPassCount = cfg.getSizeT("ThreadPassCount", c_nThreadPassCount );
14         c_nMapSize = cfg.getSizeT("MapSize", c_nMapSize );
15         c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
16
17         c_nCuckooInitialSize = cfg.getULong("CuckooInitialSize", static_cast<unsigned long>(c_nCuckooInitialSize) );
18         c_nCuckooProbesetSize = cfg.getULong("CuckooProbesetSize", static_cast<unsigned long>(c_nCuckooProbesetSize) );
19         c_nCuckooProbesetThreshold = cfg.getULong("CuckooProbesetThreshold", static_cast<unsigned long>(c_nCuckooProbesetThreshold) );
20
21         c_nMultiLevelMap_HeadBits = cfg.getULong("MultiLevelMapHeadBits", static_cast<unsigned long>(c_nMultiLevelMap_HeadBits) );
22         c_nMultiLevelMap_ArrayBits = cfg.getULong("MultiLevelMapArrayBits", static_cast<unsigned long>(c_nMultiLevelMap_ArrayBits) );
23
24         c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
25
26         if ( c_nInsertThreadCount == 0 )
27             c_nInsertThreadCount = cds::OS::topology::processor_count();
28         if ( c_nDeleteThreadCount == 0 )
29             c_nDeleteThreadCount = cds::OS::topology::processor_count();
30
31         m_arrValues.clear();
32         m_arrValues.reserve( c_nMapSize );
33         for ( size_t i = 0; i < c_nMapSize; ++i )
34             m_arrValues.push_back( i );
35         shuffle( m_arrValues.begin(), m_arrValues.end() );
36     }
37
38 } // namespace map2