movable guarded_ptr: unit tests
[libcds.git] / tests / unit / map2 / map_delodd.cpp
1 //$$CDS-header$$
2
3 #include "cppunit/thread.h"
4 #include "map2/map_types.h"
5 #include <algorithm> // random_shuffle
6
7 namespace map2 {
8
9 #   define TEST_MAP(X)         void X() { test<MapTypes<key_type, value_type>::X >(); }
10 #   define TEST_MAP_EXTRACT(X) void X() { test_extract<MapTypes<key_type, value_type>::X >(); }
11 #   define TEST_MAP_NOLF(X)    void X() { test_nolf<MapTypes<key_type, value_type>::X >(); }
12 #   define TEST_MAP_NOLF_EXTRACT(X) void X() { test_nolf_extract<MapTypes<key_type, value_type>::X >(); }
13
14     namespace {
15         static size_t  c_nMapSize = 1000000         ;  // max map size
16         static size_t  c_nInsThreadCount = 4        ;  // insert thread count
17         static size_t  c_nDelThreadCount = 4        ;  // delete thread count
18         static size_t  c_nExtractThreadCount = 4    ;  // extract thread count
19         static size_t  c_nMaxLoadFactor = 8         ;  // maximum load factor
20         static bool    c_bPrintGCState = true;
21     }
22
23     namespace {
24         struct key_thread
25         {
26             size_t  nKey;
27             size_t  nThread;
28
29             key_thread( size_t key, size_t threadNo )
30                 : nKey( key )
31                 , nThread( threadNo )
32             {}
33
34             key_thread()
35             {}
36         };
37
38         //typedef MapTypes<key_thread, size_t>::key_val     key_value_pair;
39     }
40
41     template <>
42     struct cmp<key_thread> {
43         int operator ()(key_thread const& k1, key_thread const& k2) const
44         {
45             if ( k1.nKey < k2.nKey )
46                 return -1;
47             if ( k1.nKey > k2.nKey )
48                 return 1;
49             if ( k1.nThread < k2.nThread )
50                 return -1;
51             if ( k1.nThread > k2.nThread )
52                 return 1;
53             return 0;
54         }
55         int operator ()(key_thread const& k1, size_t k2) const
56         {
57             if ( k1.nKey < k2 )
58                 return -1;
59             if ( k1.nKey > k2 )
60                 return 1;
61             return 0;
62         }
63         int operator ()(size_t k1, key_thread const& k2) const
64         {
65             if ( k1 < k2.nKey )
66                 return -1;
67             if ( k1 > k2.nKey )
68                 return 1;
69             return 0;
70         }
71     };
72
73 } // namespace map2
74
75 namespace std {
76     template <>
77     struct less<map2::key_thread>
78     {
79         bool operator()(map2::key_thread const& k1, map2::key_thread const& k2) const
80         {
81             if ( k1.nKey <= k2.nKey )
82                 return k1.nKey < k2.nKey || k1.nThread < k2.nThread;
83             return false;
84         }
85     };
86
87     template <>
88     struct hash<map2::key_thread>
89     {
90         typedef size_t              result_type;
91         typedef map2::key_thread    argument_type;
92
93         size_t operator()( map2::key_thread const& k ) const
94         {
95             return std::hash<size_t>()(k.nKey);
96         }
97         size_t operator()( size_t k ) const
98         {
99             return std::hash<size_t>()(k);
100         }
101     };
102 } // namespace std
103
104 namespace boost {
105     inline size_t hash_value( map2::key_thread const& k )
106     {
107         return std::hash<size_t>()( k.nKey );
108     }
109     template <>
110     struct hash<map2::key_thread>
111     {
112         typedef size_t              result_type;
113         typedef map2::key_thread    argument_type;
114
115         size_t operator()(map2::key_thread const& k) const
116         {
117             return boost::hash<size_t>()( k.nKey );
118         }
119         size_t operator()(size_t k) const
120         {
121             return boost::hash<size_t>()( k );
122         }
123     };
124 } // namespace boost
125
126 namespace map2 {
127
128     template <typename Map>
129     static inline void check_before_clear( Map& s )
130     {}
131
132     template <typename GC, typename Key, typename T, typename Traits>
133     static inline void check_before_clear( cds::container::EllenBinTreeMap<GC, Key, T, Traits>& s )
134     {
135         CPPUNIT_CHECK_CURRENT( s.check_consistency() );
136     }
137
138     class Map_DelOdd: public CppUnitMini::TestCase
139     {
140         std::vector<size_t>     m_arrData;
141
142     protected:
143         typedef key_thread  key_type;
144         typedef size_t      value_type;
145         typedef std::pair<key_type const, value_type> pair_type;
146
147         atomics::atomic<size_t>      m_nInsThreadCount;
148
149         // Inserts keys from [0..N)
150         template <class Map>
151         class InsertThread: public CppUnitMini::TestThread
152         {
153             Map&     m_Map;
154
155             virtual InsertThread *    clone()
156             {
157                 return new InsertThread( *this );
158             }
159
160             struct ensure_func
161             {
162                 template <typename Q>
163                 void operator()( bool bNew, Q const& )
164                 {}
165             };
166         public:
167             size_t  m_nInsertSuccess;
168             size_t  m_nInsertFailed;
169
170         public:
171             InsertThread( CppUnitMini::ThreadPool& pool, Map& rMap )
172                 : CppUnitMini::TestThread( pool )
173                 , m_Map( rMap )
174             {}
175             InsertThread( InsertThread& src )
176                 : CppUnitMini::TestThread( src )
177                 , m_Map( src.m_Map )
178             {}
179
180             Map_DelOdd&  getTest()
181             {
182                 return reinterpret_cast<Map_DelOdd&>( m_Pool.m_Test );
183             }
184
185             virtual void init() { cds::threading::Manager::attachThread()   ; }
186             virtual void fini() { cds::threading::Manager::detachThread()   ; }
187
188             virtual void test()
189             {
190                 Map& rMap = m_Map;
191
192                 m_nInsertSuccess =
193                     m_nInsertFailed = 0;
194
195                 std::vector<size_t>& arrData = getTest().m_arrData;
196                 for ( size_t i = 0; i < arrData.size(); ++i ) {
197                     if ( rMap.insert( key_type( arrData[i], m_nThreadNo )))
198                         ++m_nInsertSuccess;
199                     else
200                         ++m_nInsertFailed;
201                 }
202
203                 ensure_func f;
204                 for ( size_t i = arrData.size() - 1; i > 0; --i ) {
205                     if ( arrData[i] & 1 ) {
206                         rMap.ensure( key_type( arrData[i], m_nThreadNo ), f );
207                     }
208                 }
209
210                 getTest().m_nInsThreadCount.fetch_sub( 1, atomics::memory_order_acquire );
211             }
212         };
213
214         struct key_equal {
215             bool operator()( key_type const& k1, key_type const& k2 ) const
216             {
217                 return k1.nKey == k2.nKey;
218             }
219             bool operator()( size_t k1, key_type const& k2 ) const
220             {
221                 return k1 == k2.nKey;
222             }
223             bool operator()( key_type const& k1, size_t k2 ) const
224             {
225                 return k1.nKey == k2;
226             }
227         };
228
229         struct key_less {
230             bool operator()( key_type const& k1, key_type const& k2 ) const
231             {
232                 return k1.nKey < k2.nKey;
233             }
234             bool operator()( size_t k1, key_type const& k2 ) const
235             {
236                 return k1 < k2.nKey;
237             }
238             bool operator()( key_type const& k1, size_t k2 ) const
239             {
240                 return k1.nKey < k2;
241             }
242
243             typedef key_equal equal_to;
244         };
245
246         // Deletes odd keys from [0..N)
247         template <class Map>
248         class DeleteThread: public CppUnitMini::TestThread
249         {
250             Map&     m_Map;
251
252             virtual DeleteThread *    clone()
253             {
254                 return new DeleteThread( *this );
255             }
256         public:
257             size_t  m_nDeleteSuccess;
258             size_t  m_nDeleteFailed;
259
260         public:
261             DeleteThread( CppUnitMini::ThreadPool& pool, Map& rMap )
262                 : CppUnitMini::TestThread( pool )
263                 , m_Map( rMap )
264             {}
265             DeleteThread( DeleteThread& src )
266                 : CppUnitMini::TestThread( src )
267                 , m_Map( src.m_Map )
268             {}
269
270             Map_DelOdd&  getTest()
271             {
272                 return reinterpret_cast<Map_DelOdd&>( m_Pool.m_Test );
273             }
274
275             virtual void init() { cds::threading::Manager::attachThread()   ; }
276             virtual void fini() { cds::threading::Manager::detachThread()   ; }
277
278             virtual void test()
279             {
280                 Map& rMap = m_Map;
281
282                 m_nDeleteSuccess =
283                     m_nDeleteFailed = 0;
284
285                 std::vector<size_t>& arrData = getTest().m_arrData;
286                 if ( m_nThreadNo & 1 ) {
287                     for ( size_t k = 0; k < c_nInsThreadCount; ++k ) {
288                         for ( size_t i = 0; i < arrData.size(); ++i ) {
289                             if ( arrData[i] & 1 ) {
290                                 if ( rMap.erase_with( arrData[i], key_less() ))
291                                     ++m_nDeleteSuccess;
292                                 else
293                                     ++m_nDeleteFailed;
294                             }
295                         }
296                         if ( getTest().m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 )
297                             break;
298                     }
299                 }
300                 else {
301                     for ( size_t k = 0; k < c_nInsThreadCount; ++k ) {
302                         for ( size_t i = arrData.size() - 1; i > 0; --i ) {
303                             if ( arrData[i] & 1 ) {
304                                 if ( rMap.erase_with( arrData[i], key_less() ))
305                                     ++m_nDeleteSuccess;
306                                 else
307                                     ++m_nDeleteFailed;
308                             }
309                         }
310                         if ( getTest().m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 )
311                             break;
312                     }
313                 }
314             }
315         };
316
317         // Deletes odd keys from [0..N)
318         template <class GC, class Map >
319         class ExtractThread: public CppUnitMini::TestThread
320         {
321             Map&     m_Map;
322
323             virtual ExtractThread *    clone()
324             {
325                 return new ExtractThread( *this );
326             }
327         public:
328             size_t  m_nDeleteSuccess;
329             size_t  m_nDeleteFailed;
330
331         public:
332             ExtractThread( CppUnitMini::ThreadPool& pool, Map& rMap )
333                 : CppUnitMini::TestThread( pool )
334                 , m_Map( rMap )
335             {}
336             ExtractThread( ExtractThread& src )
337                 : CppUnitMini::TestThread( src )
338                 , m_Map( src.m_Map )
339             {}
340
341             Map_DelOdd&  getTest()
342             {
343                 return reinterpret_cast<Map_DelOdd&>( m_Pool.m_Test );
344             }
345
346             virtual void init() { cds::threading::Manager::attachThread()   ; }
347             virtual void fini() { cds::threading::Manager::detachThread()   ; }
348
349             virtual void test()
350             {
351                 Map& rMap = m_Map;
352
353                 m_nDeleteSuccess =
354                     m_nDeleteFailed = 0;
355
356                 typename Map::guarded_ptr gp;
357
358                 std::vector<size_t>& arrData = getTest().m_arrData;
359                 if ( m_nThreadNo & 1 ) {
360                     for ( size_t k = 0; k < c_nInsThreadCount; ++k ) {
361                         for ( size_t i = 0; i < arrData.size(); ++i ) {
362                             if ( arrData[i] & 1 ) {
363                                 gp = rMap.extract_with( arrData[i], key_less());
364                                 if ( gp )
365                                     ++m_nDeleteSuccess;
366                                 else
367                                     ++m_nDeleteFailed;
368                             }
369                         }
370                         if ( getTest().m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 )
371                             break;
372                     }
373                 }
374                 else {
375                     for ( size_t k = 0; k < c_nInsThreadCount; ++k ) {
376                         for ( size_t i = arrData.size() - 1; i > 0; --i ) {
377                             if ( arrData[i] & 1 ) {
378                                 gp = rMap.extract_with( arrData[i], key_less());
379                                 if ( gp )
380                                     ++m_nDeleteSuccess;
381                                 else
382                                     ++m_nDeleteFailed;
383                             }
384                         }
385                         if ( getTest().m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 )
386                             break;
387                     }
388                 }
389             }
390         };
391
392         template <class RCU, class Map >
393         class ExtractThread< cds::urcu::gc<RCU>, Map > : public CppUnitMini::TestThread
394         {
395             Map&     m_Map;
396
397             virtual ExtractThread *    clone()
398             {
399                 return new ExtractThread( *this );
400             }
401         public:
402             size_t  m_nDeleteSuccess;
403             size_t  m_nDeleteFailed;
404
405         public:
406             ExtractThread( CppUnitMini::ThreadPool& pool, Map& rMap )
407                 : CppUnitMini::TestThread( pool )
408                 , m_Map( rMap )
409             {}
410             ExtractThread( ExtractThread& src )
411                 : CppUnitMini::TestThread( src )
412                 , m_Map( src.m_Map )
413             {}
414
415             Map_DelOdd&  getTest()
416             {
417                 return reinterpret_cast<Map_DelOdd&>( m_Pool.m_Test );
418             }
419
420             virtual void init() { cds::threading::Manager::attachThread()   ; }
421             virtual void fini() { cds::threading::Manager::detachThread()   ; }
422
423             virtual void test()
424             {
425                 Map& rMap = m_Map;
426
427                 m_nDeleteSuccess =
428                     m_nDeleteFailed = 0;
429
430                 typename Map::exempt_ptr xp;
431
432                 std::vector<size_t>& arrData = getTest().m_arrData;
433                 if ( m_nThreadNo & 1 ) {
434                     for ( size_t k = 0; k < c_nInsThreadCount; ++k ) {
435                         for ( size_t i = 0; i < arrData.size(); ++i ) {
436                             if ( arrData[i] & 1 ) {
437                                 if ( Map::c_bExtractLockExternal ) {
438                                     {
439                                         typename Map::rcu_lock l;
440                                         xp = rMap.extract_with( arrData[i], key_less() );
441                                         if ( xp )
442                                             ++m_nDeleteSuccess;
443                                         else
444                                             ++m_nDeleteFailed;
445                                     }
446                                 }
447                                 else {
448                                     xp = rMap.extract_with( arrData[i], key_less() );
449                                     if ( xp )
450                                         ++m_nDeleteSuccess;
451                                     else
452                                         ++m_nDeleteFailed;
453                                 }
454                                 xp.release();
455                             }
456                         }
457                         if ( getTest().m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 )
458                             break;
459                     }
460                 }
461                 else {
462                     for ( size_t k = 0; k < c_nInsThreadCount; ++k ) {
463                         for ( size_t i = arrData.size() - 1; i > 0; --i ) {
464                             if ( arrData[i] & 1 ) {
465                                 if ( Map::c_bExtractLockExternal ) {
466                                     {
467                                         typename Map::rcu_lock l;
468                                         xp = rMap.extract_with( arrData[i], key_less() );
469                                         if ( xp )
470                                             ++m_nDeleteSuccess;
471                                         else
472                                             ++m_nDeleteFailed;
473                                     }
474                                 }
475                                 else {
476                                     xp = rMap.extract_with( arrData[i], key_less() );
477                                     if ( xp )
478                                         ++m_nDeleteSuccess;
479                                     else
480                                         ++m_nDeleteFailed;
481                                 }
482                                 xp.release();
483                             }
484                         }
485                         if ( getTest().m_nInsThreadCount.load( atomics::memory_order_acquire ) == 0 )
486                             break;
487                     }
488                 }
489             }
490         };
491
492     protected:
493         template <class Map>
494         void do_test( size_t nLoadFactor )
495         {
496             Map  testMap( c_nMapSize, nLoadFactor );
497             do_test_with( testMap );
498         }
499
500         template <class Map>
501         void do_test_extract( size_t nLoadFactor )
502         {
503             Map  testMap( c_nMapSize, nLoadFactor );
504             do_test_extract_with( testMap );
505         }
506
507         template <class Map>
508         void do_test_with( Map& testMap )
509         {
510             typedef InsertThread<Map> insert_thread;
511             typedef DeleteThread<Map> delete_thread;
512
513             m_nInsThreadCount.store( c_nInsThreadCount, atomics::memory_order_release );
514
515             CppUnitMini::ThreadPool pool( *this );
516             pool.add( new insert_thread( pool, testMap ), c_nInsThreadCount );
517             pool.add( new delete_thread( pool, testMap ), c_nDelThreadCount ? c_nDelThreadCount : cds::OS::topology::processor_count());
518             pool.run();
519             CPPUNIT_MSG( "   Duration=" << pool.avgDuration() );
520
521             size_t nInsertSuccess = 0;
522             size_t nInsertFailed = 0;
523             size_t nDeleteSuccess = 0;
524             size_t nDeleteFailed = 0;
525             for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
526                 insert_thread * pThread = dynamic_cast<insert_thread *>( *it );
527                 if ( pThread ) {
528                     nInsertSuccess += pThread->m_nInsertSuccess;
529                     nInsertFailed += pThread->m_nInsertFailed;
530                 }
531                 else {
532                     delete_thread * p = static_cast<delete_thread *>( *it );
533                     nDeleteSuccess += p->m_nDeleteSuccess;
534                     nDeleteFailed += p->m_nDeleteFailed;
535                 }
536             }
537
538             CPPUNIT_MSG( "  Totals (success/failed): \n\t"
539                 << "      Insert=" << nInsertSuccess << '/' << nInsertFailed << "\n\t"
540                 << "      Delete=" << nDeleteSuccess << '/' << nDeleteFailed << "\n\t"
541                 );
542             CPPUNIT_CHECK( nInsertSuccess == c_nMapSize * c_nInsThreadCount );
543             CPPUNIT_CHECK( nInsertFailed == 0 );
544
545             analyze( testMap );
546         }
547
548         template <class Map>
549         void do_test_extract_with( Map& testMap )
550         {
551             typedef InsertThread<Map> insert_thread;
552             typedef DeleteThread<Map> delete_thread;
553             typedef ExtractThread< typename Map::gc, Map > extract_thread;
554
555             m_nInsThreadCount.store( c_nInsThreadCount, atomics::memory_order_release );
556
557             CppUnitMini::ThreadPool pool( *this );
558             pool.add( new insert_thread( pool, testMap ), c_nInsThreadCount );
559             if ( c_nDelThreadCount )
560                 pool.add( new delete_thread( pool, testMap ), c_nDelThreadCount );
561             if ( c_nExtractThreadCount )
562                 pool.add( new extract_thread( pool, testMap ), c_nExtractThreadCount );
563             pool.run();
564             CPPUNIT_MSG( "   Duration=" << pool.avgDuration() );
565
566             size_t nInsertSuccess = 0;
567             size_t nInsertFailed = 0;
568             size_t nDeleteSuccess = 0;
569             size_t nDeleteFailed = 0;
570             size_t nExtractSuccess = 0;
571             size_t nExtractFailed = 0;
572             for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
573                 insert_thread * pThread = dynamic_cast<insert_thread *>( *it );
574                 if ( pThread ) {
575                     nInsertSuccess += pThread->m_nInsertSuccess;
576                     nInsertFailed += pThread->m_nInsertFailed;
577                 }
578                 else {
579                     delete_thread * p = dynamic_cast<delete_thread *>( *it );
580                     if ( p ) {
581                         nDeleteSuccess += p->m_nDeleteSuccess;
582                         nDeleteFailed += p->m_nDeleteFailed;
583                     }
584                     else {
585                         extract_thread * pExtract = dynamic_cast<extract_thread *>( *it );
586                         assert( pExtract );
587                         nExtractSuccess += pExtract->m_nDeleteSuccess;
588                         nExtractFailed += pExtract->m_nDeleteFailed;
589                     }
590                 }
591             }
592
593             CPPUNIT_MSG( "  Totals (success/failed): \n\t"
594                 << "      Insert=" << nInsertSuccess << '/' << nInsertFailed << "\n\t"
595                 << "      Delete=" << nDeleteSuccess << '/' << nDeleteFailed << "\n\t"
596                 << "      Extract=" << nExtractSuccess << '/' << nExtractFailed << "\n\t"
597                 );
598             CPPUNIT_CHECK( nInsertSuccess == c_nMapSize * c_nInsThreadCount );
599             CPPUNIT_CHECK( nInsertFailed == 0 );
600
601             analyze( testMap );
602         }
603
604         template <class Map>
605         void analyze( Map& testMap )
606         {
607             cds::OS::Timer    timer;
608
609             // All even keys must be in the map
610             {
611                 size_t nErrorCount = 0;
612                 CPPUNIT_MSG( "  Check even keys..." );
613                 for ( size_t n = 0; n < c_nMapSize; n +=2 ) {
614                     for ( size_t i = 0; i < c_nInsThreadCount; ++i ) {
615                         if ( !testMap.find( key_type(n, i) ) ) {
616                             if ( ++nErrorCount < 10 ) {
617                                 CPPUNIT_MSG( "key " << n << "-" << i << " is not found!");
618                             }
619                         }
620                     }
621                 }
622                 CPPUNIT_CHECK_EX( nErrorCount == 0, "Totals: " << nErrorCount << " keys is not found");
623             }
624
625             check_before_clear( testMap );
626
627             CPPUNIT_MSG( "  Clear map (single-threaded)..." );
628             timer.reset();
629             testMap.clear();
630             CPPUNIT_MSG( "   Duration=" << timer.duration() );
631             CPPUNIT_CHECK_EX( testMap.empty(), ((long long) testMap.size()) );
632
633             additional_check( testMap );
634             print_stat( testMap );
635
636             additional_cleanup( testMap );
637         }
638
639
640         template <class Map>
641         void test()
642         {
643             CPPUNIT_MSG( "Insert thread count=" << c_nInsThreadCount
644                 << " delete thread count=" << c_nDelThreadCount
645                 << " set size=" << c_nMapSize
646                 );
647
648             for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
649                 CPPUNIT_MSG( "Load factor=" << nLoadFactor );
650                 do_test<Map>( nLoadFactor );
651                 if ( c_bPrintGCState )
652                     print_gc_state();
653             }
654         }
655
656         template <class Map>
657         void test_extract()
658         {
659             CPPUNIT_MSG( "Thread count: insert=" << c_nInsThreadCount
660                 << ", delete=" << c_nDelThreadCount
661                 << ", extract=" << c_nExtractThreadCount
662                 << "; set size=" << c_nMapSize
663                 );
664
665             for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
666                 CPPUNIT_MSG( "Load factor=" << nLoadFactor );
667                 do_test_extract<Map>( nLoadFactor );
668                 if ( c_bPrintGCState )
669                     print_gc_state();
670             }
671         }
672
673         template <class Map>
674         void test_nolf()
675         {
676             CPPUNIT_MSG( "Insert thread count=" << c_nInsThreadCount
677                 << " delete thread count=" << c_nDelThreadCount
678                 << " set size=" << c_nMapSize
679                 );
680
681             Map s;
682             do_test_with( s );
683             if ( c_bPrintGCState )
684                 print_gc_state();
685         }
686
687         template <class Map>
688         void test_nolf_extract()
689         {
690             CPPUNIT_MSG( "Thread count: insert=" << c_nInsThreadCount
691                 << ", delete=" << c_nDelThreadCount
692                 << ", extract=" << c_nExtractThreadCount
693                 << "; set size=" << c_nMapSize
694                 );
695
696             Map s;
697             do_test_extract_with( s );
698             if ( c_bPrintGCState )
699                 print_gc_state();
700         }
701
702         void setUpParams( const CppUnitMini::TestCfg& cfg ) {
703             c_nMapSize = cfg.getULong("MapSize", static_cast<unsigned long>(c_nMapSize) );
704             c_nInsThreadCount = cfg.getULong("InsThreadCount", static_cast<unsigned long>(c_nInsThreadCount) );
705             c_nDelThreadCount = cfg.getULong("DelThreadCount", static_cast<unsigned long>(c_nDelThreadCount) );
706             c_nExtractThreadCount = cfg.getULong("ExtractThreadCount", static_cast<unsigned long>(c_nExtractThreadCount) );
707             c_nMaxLoadFactor = cfg.getULong("MaxLoadFactor", static_cast<unsigned long>(c_nMaxLoadFactor) );
708             c_bPrintGCState = cfg.getBool("PrintGCStateFlag", true );
709
710             if ( c_nInsThreadCount == 0 )
711                 c_nInsThreadCount = cds::OS::topology::processor_count();
712             if ( c_nDelThreadCount == 0 && c_nExtractThreadCount == 0 ) {
713                 c_nExtractThreadCount = cds::OS::topology::processor_count() / 2;
714                 c_nDelThreadCount = cds::OS::topology::processor_count() - c_nExtractThreadCount;
715             }
716
717             m_arrData.resize( c_nMapSize );
718             for ( size_t i = 0; i < c_nMapSize; ++i )
719                 m_arrData[i] = i;
720             std::random_shuffle( m_arrData.begin(), m_arrData.end() );
721         }
722
723 #   include "map2/map_defs.h"
724         CDSUNIT_DECLARE_MichaelMap
725         CDSUNIT_DECLARE_SplitList
726         //CDSUNIT_DECLARE_StripedMap
727         //CDSUNIT_DECLARE_RefinableMap
728         CDSUNIT_DECLARE_CuckooMap
729         CDSUNIT_DECLARE_SkipListMap
730         CDSUNIT_DECLARE_EllenBinTreeMap
731         //CDSUNIT_DECLARE_StdMap
732
733         CPPUNIT_TEST_SUITE( Map_DelOdd )
734             CDSUNIT_TEST_MichaelMap
735             CDSUNIT_TEST_SplitList
736             CDSUNIT_TEST_SkipListMap
737             CDSUNIT_TEST_EllenBinTreeMap
738             //CDSUNIT_TEST_StripedMap
739             //CDSUNIT_TEST_RefinableMap
740             CDSUNIT_TEST_CuckooMap
741             //CDSUNIT_TEST_StdMap
742         CPPUNIT_TEST_SUITE_END()
743     };
744
745     CPPUNIT_TEST_SUITE_REGISTRATION( Map_DelOdd );
746 } // namespace map2