3 #include "set2/set_insdelfind.h"
6 CPPUNIT_TEST_SUITE_REGISTRATION( Set_InsDelFind );
8 size_t Set_InsDelFind::c_nInitialMapSize = 500000;
9 size_t Set_InsDelFind::c_nThreadCount = 8;
10 size_t Set_InsDelFind::c_nMaxLoadFactor = 8;
11 unsigned int Set_InsDelFind::c_nInsertPercentage = 5;
12 unsigned int Set_InsDelFind::c_nDeletePercentage = 5;
13 unsigned int Set_InsDelFind::c_nDuration = 30;
14 bool Set_InsDelFind::c_bPrintGCState = true;
16 void Set_InsDelFind::setUpParams( const CppUnitMini::TestCfg& cfg )
18 c_nInitialMapSize = cfg.getSizeT("InitialMapSize", c_nInitialMapSize );
19 c_nThreadCount = cfg.getSizeT("ThreadCount", c_nThreadCount );
20 c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
21 c_nInsertPercentage = cfg.getUInt("InsertPercentage", c_nInsertPercentage );
22 c_nDeletePercentage = cfg.getUInt("DeletePercentage", c_nDeletePercentage );
23 c_nDuration = cfg.getUInt("Duration", c_nDuration );
24 c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
26 if ( c_nThreadCount == 0 )
27 c_nThreadCount = cds::OS::topology::processor_count() * 2;
29 CPPUNIT_ASSERT( c_nInsertPercentage + c_nDeletePercentage <= 100 );
31 actions * pFirst = m_arrShuffle;
32 actions * pLast = m_arrShuffle + c_nInsertPercentage;
33 std::fill( pFirst, pLast, do_insert );
35 pLast += c_nDeletePercentage;
36 std::fill( pFirst, pLast, do_delete );
38 pLast = m_arrShuffle + sizeof(m_arrShuffle)/sizeof(m_arrShuffle[0]);
39 std::fill( pFirst, pLast, do_find );
40 std::random_shuffle( m_arrShuffle, pLast );
43 void Set_InsDelFind::myRun(const char *in_name, bool invert /*= false*/)
45 setUpParams( m_Cfg.get( "Map_InsDelFind" ));
47 run_MichaelSet(in_name, invert);
48 run_SplitList(in_name, invert);
49 run_SkipListSet(in_name, invert);
50 run_EllenBinTreeSet(in_name, invert);
51 run_StripedSet(in_name, invert);
52 run_RefinableSet(in_name, invert);
53 run_CuckooSet(in_name, invert);
54 run_StdSet(in_name, invert);