3 #include "map2/map_find_int.h"
5 // find int test in map<int> in mutithreaded mode
7 CPPUNIT_TEST_SUITE_REGISTRATION( Map_find_int );
9 void Map_find_int::generateSequence()
11 size_t nPercent = c_nPercentExists;
15 else if ( nPercent < 1 )
20 m_Arr.resize( c_nMapSize );
21 for ( size_t i = 0; i < c_nMapSize; ++i ) {
22 m_Arr[i].nKey = i * 13;
23 m_Arr[i].bExists = CppUnitMini::Rand( 100 ) <= nPercent;
24 if ( m_Arr[i].bExists )
27 shuffle( m_Arr.begin(), m_Arr.end() );
30 void Map_find_int::setUpParams( const CppUnitMini::TestCfg& cfg )
32 c_nThreadCount = cfg.getSizeT("ThreadCount", c_nThreadCount );
33 c_nMapSize = cfg.getSizeT("MapSize", c_nMapSize);
34 c_nPercentExists = cfg.getSizeT("PercentExists", c_nPercentExists);
35 c_nPassCount = cfg.getSizeT("PassCount", c_nPassCount);
36 c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor);
37 c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
39 c_nCuckooInitialSize = cfg.getSizeT("CuckooInitialSize", c_nCuckooInitialSize);
40 c_nCuckooProbesetSize = cfg.getSizeT("CuckooProbesetSize", c_nCuckooProbesetSize);
41 c_nCuckooProbesetThreshold = cfg.getSizeT("CuckooProbesetThreshold", c_nCuckooProbesetThreshold);
43 c_nMultiLevelMap_HeadBits = cfg.getSizeT("MultiLevelMapHeadBits", c_nMultiLevelMap_HeadBits);
44 c_nMultiLevelMap_ArrayBits = cfg.getSizeT("MultiLevelMapArrayBits", c_nMultiLevelMap_ArrayBits);
46 if ( c_nThreadCount == 0 )
47 c_nThreadCount = std::thread::hardware_concurrency();
49 CPPUNIT_MSG( "Generating test data...");
52 CPPUNIT_MSG( " Duration=" << timer.duration() );
53 CPPUNIT_MSG( "Map size=" << m_nRealMapSize << " find key loop=" << m_Arr.size() << " (" << c_nPercentExists << "% success)" );
54 CPPUNIT_MSG( "Thread count=" << c_nThreadCount << " Pass count=" << c_nPassCount );