3 #include "map2/map_insdelfind.h"
4 #include <cds/os/topology.h>
7 CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDelFind );
9 size_t Map_InsDelFind::c_nInitialMapSize = 500000;
10 size_t Map_InsDelFind::c_nThreadCount = 8;
11 size_t Map_InsDelFind::c_nMaxLoadFactor = 8;
12 unsigned int Map_InsDelFind::c_nInsertPercentage = 5;
13 unsigned int Map_InsDelFind::c_nDeletePercentage = 5;
14 unsigned int Map_InsDelFind::c_nDuration = 30;
15 bool Map_InsDelFind::c_bPrintGCState = true;
17 void Map_InsDelFind::setUpParams( const CppUnitMini::TestCfg& cfg )
19 c_nInitialMapSize = cfg.getSizeT("InitialMapSize", c_nInitialMapSize );
20 c_nThreadCount = cfg.getSizeT("ThreadCount", c_nThreadCount );
21 c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
22 c_nInsertPercentage = cfg.getUInt("InsertPercentage", c_nInsertPercentage );
23 c_nDeletePercentage = cfg.getUInt("DeletePercentage", c_nDeletePercentage );
24 c_nDuration = cfg.getUInt("Duration", c_nDuration );
25 c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
27 if ( c_nThreadCount == 0 )
28 c_nThreadCount = cds::OS::topology::processor_count() * 2;
30 CPPUNIT_ASSERT( c_nInsertPercentage + c_nDeletePercentage <= 100 );
32 actions * pFirst = m_arrShuffle;
33 actions * pLast = m_arrShuffle + c_nInsertPercentage;
34 std::fill( pFirst, pLast, do_insert );
36 pLast += c_nDeletePercentage;
37 std::fill( pFirst, pLast, do_delete );
39 pLast = m_arrShuffle + sizeof(m_arrShuffle)/sizeof(m_arrShuffle[0]);
40 std::fill( pFirst, pLast, do_find );
41 std::random_shuffle( m_arrShuffle, pLast );
44 void Map_InsDelFind::myRun(const char *in_name, bool invert /*= false*/)
46 setUpParams( m_Cfg.get( "Map_InsDelFind" ));
48 run_MichaelMap(in_name, invert);
49 run_SplitList(in_name, invert);
50 run_SkipListMap(in_name, invert);
51 run_EllenBinTreeMap(in_name, invert);
52 run_BronsonAVLTreeMap(in_name, invert);
53 run_StripedMap(in_name, invert);
54 run_RefinableMap(in_name, invert);
55 run_CuckooMap(in_name, invert);
56 run_StdMap(in_name, invert);