- cds_test::thread_pool& pool = get_pool();
- pool.add( new InserterThread( pool, testSet ), s_nInsertThreadCount );
- pool.add( new DeleterThread( pool, testSet ), s_nDeleteThreadCount );
- pool.add( new UpdaterThread( pool, testSet ), s_nUpdateThreadCount );
-
- propout() << std::make_pair( "insert_thread_count", s_nInsertThreadCount )
- << std::make_pair( "update_thread_count", s_nUpdateThreadCount )
- << std::make_pair( "delete_thread_count", s_nDeleteThreadCount )
- << std::make_pair( "thread_pass_count", s_nThreadPassCount )
- << std::make_pair( "set_size", s_nSetSize );
-
- std::chrono::milliseconds duration = pool.run();
-
- propout() << std::make_pair( "duration", duration );
-
- size_t nInsertSuccess = 0;
- size_t nInsertFailed = 0;
- size_t nDeleteSuccess = 0;
- size_t nDeleteFailed = 0;
- size_t nDelValueSuccess = 0;
- size_t nDelValueFailed = 0;
- size_t nUpdateFailed = 0;
- size_t nUpdateCreated = 0;
- size_t nUpdateModified = 0;
- size_t nEnsFuncCreated = 0;
- size_t nEnsFuncModified = 0;
- size_t nTestFunctorRef = 0;
-
- for ( size_t i = 0; i < pool.size(); ++i ) {
- cds_test::thread& thr = pool.get( i );
- switch ( thr.type()) {
- case insert_thread:
- {
- InserterThread& inserter = static_cast<InserterThread&>( thr );
- nInsertSuccess += inserter.m_nInsertSuccess;
- nInsertFailed += inserter.m_nInsertFailed;
- nTestFunctorRef += inserter.m_nTestFunctorRef;
- }
- break;
- case update_thread:
- {
- UpdaterThread& updater = static_cast<UpdaterThread&>(thr);
- nUpdateCreated += updater.m_nUpdateCreated;
- nUpdateModified += updater.m_nUpdateExisted;
- nUpdateFailed += updater.m_nUpdateFailed;
- nEnsFuncCreated += updater.m_nFunctorCreated;
- nEnsFuncModified += updater.m_nFunctorModified;
- }
- break;
- case delete_thread:
- {
- DeleterThread& deleter = static_cast<DeleterThread&>(thr);
- nDeleteSuccess += deleter.m_nDeleteSuccess;
- nDeleteFailed += deleter.m_nDeleteFailed;
- nDelValueSuccess += deleter.m_nValueSuccess;
- nDelValueFailed += deleter.m_nValueFailed;
- }
- break;
- }
+ cds_test::thread_pool &pool = get_pool();
+ std::unique_ptr<InserterThread> inserter(
+ new InserterThread(pool, testSet));
+ std::unique_ptr<DeleterThread> deleter(
+ new DeleterThread(pool, testSet));
+ std::unique_ptr<UpdaterThread> updater(
+ new UpdaterThread(pool, testSet));
+
+ for (size_t i = 0; i < pass_count; i++) {
+ inserter->test();
+ updater->test();
+ deleter->test();
+ updater->test();