Refactored Map_insdel_int MT-test
[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_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
22
23         if ( c_nInsertThreadCount == 0 )
24             c_nInsertThreadCount = cds::OS::topology::processor_count();
25         if ( c_nDeleteThreadCount == 0 )
26             c_nDeleteThreadCount = cds::OS::topology::processor_count();
27
28         m_arrValues.clear();
29         m_arrValues.reserve( c_nMapSize );
30         for ( size_t i = 0; i < c_nMapSize; ++i )
31             m_arrValues.push_back( i );
32         shuffle( m_arrValues.begin(), m_arrValues.end() );
33     }
34
35 } // namespace map2