Disables running some stat analysis for benchmarks & Adds some sequential data structures
[libcds.git] / test / stress / sequential / sequential-set / insdel_find / set_insdelfind.h
index c28ab90af53f40a089840f4a5126903b743ab5b6..ba9a8490134f7b740f885e2d649b3592d5dedd0d 100644 (file)
@@ -36,6 +36,7 @@ namespace set {
     {
     public:
         static size_t s_nSetSize;           // initial set size
+        static size_t s_nPassCount;           // initial set size
         static size_t s_nThreadCount;       // thread count
         static size_t s_nMaxLoadFactor;     // maximum load factor
         static unsigned int s_nInsertPercentage;
@@ -105,9 +106,10 @@ namespace set {
 
                 unsigned int i = 0;
                 size_t const nNormalize = size_t(-1) / ( fixture.s_nSetSize * 2);
+                size_t pass_count = fixture.s_nPassCount;
 
                 size_t nRand = 0;
-                while ( !time_elapsed()) {
+                while ( pass_count-- ) {
                     nRand = cds::bitop::RandXorShift(nRand);
                     size_t n = nRand / nNormalize;
                     switch ( s_arrShuffle[i] ) {
@@ -155,8 +157,10 @@ namespace set {
                 delete [] pInitArr;
             }
 
+            s_nThreadCount = 1;
             cds_test::thread_pool& pool = get_pool();
-            pool.add( new work_thread( pool, testSet ), s_nThreadCount );
+            std::unique_ptr<work_thread> worker(new work_thread(pool, testSet));
+            worker->test();
 
             propout() << std::make_pair( "thread_count", s_nThreadCount )
                 << std::make_pair( "set_size", s_nSetSize )
@@ -164,25 +168,19 @@ namespace set {
                 << std::make_pair( "delete_percentage", s_nDeletePercentage )
                 << std::make_pair( "total_duration", s_nDuration );
 
-            std::chrono::milliseconds duration = pool.run( std::chrono::seconds( s_nDuration ));
-
-            propout() << std::make_pair( "duration", duration );
-
             size_t nInsertSuccess = 0;
             size_t nInsertFailed = 0;
             size_t nDeleteSuccess = 0;
             size_t nDeleteFailed = 0;
             size_t nFindSuccess = 0;
             size_t nFindFailed = 0;
-            for ( size_t i = 0; i < pool.size(); ++i ) {
-                work_thread& thr = static_cast<work_thread&>( pool.get( i ));
-                nInsertSuccess += thr.m_nInsertSuccess;
-                nInsertFailed  += thr.m_nInsertFailed;
-                nDeleteSuccess += thr.m_nDeleteSuccess;
-                nDeleteFailed  += thr.m_nDeleteFailed;
-                nFindSuccess   += thr.m_nFindSuccess;
-                nFindFailed    += thr.m_nFindFailed;
-            }
+            work_thread &thr = *worker;
+            nInsertSuccess += thr.m_nInsertSuccess;
+            nInsertFailed += thr.m_nInsertFailed;
+            nDeleteSuccess += thr.m_nDeleteSuccess;
+            nDeleteFailed += thr.m_nDeleteFailed;
+            nFindSuccess += thr.m_nFindSuccess;
+            nFindFailed += thr.m_nFindFailed;
 
             propout()
                 << std::make_pair( "insert_success", nInsertSuccess )
@@ -192,13 +190,6 @@ namespace set {
                 << std::make_pair( "find_success", nFindSuccess )
                 << std::make_pair( "find_failed", nFindFailed );
 
-            {
-                ASSERT_TRUE( std::chrono::duration_cast<std::chrono::seconds>(duration).count() > 0 );
-                size_t nTotalOps = nInsertSuccess + nInsertFailed + nDeleteSuccess + nDeleteFailed + nFindSuccess + nFindFailed;
-                propout() << std::make_pair( "avg_speed", nTotalOps / std::chrono::duration_cast<std::chrono::seconds>(duration).count());
-            }
-
-
             testSet.clear();
             EXPECT_TRUE( testSet.empty()) << "set size=" << testSet.size();