X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=test%2Fstress%2Fset%2Fiteration%2Fset_iteration.h;fp=test%2Fstress%2Fset%2Fiteration%2Fset_iteration.h;h=decf002d7f9ae182776c7cbb8b3cae62cbf731c1;hb=f1f103dd29d271a5018a11ebfb64c118f74c88b4;hp=b8ea3b3c344670254dc2d86336b51f35c9a7bd60;hpb=4015ec7a4aab91a6216d1aba946a2db8d9750ead;p=libcds.git diff --git a/test/stress/set/iteration/set_iteration.h b/test/stress/set/iteration/set_iteration.h index b8ea3b3c..decf002d 100644 --- a/test/stress/set/iteration/set_iteration.h +++ b/test/stress/set/iteration/set_iteration.h @@ -370,7 +370,7 @@ namespace set { } }; - template + template class Iterator: public cds_test::thread { typedef cds_test::thread base_class; @@ -413,13 +413,57 @@ namespace set { } }; + template + class Iterator, Set>: public cds_test::thread + { + typedef cds_test::thread base_class; + + Set& m_Set; + typedef typename Set::value_type keyval_type; + + public: + size_t m_nPassCount = 0; + size_t m_nVisitCount = 0; // how many items the iterator visited + + public: + Iterator( cds_test::thread_pool& pool, Set& set ) + : base_class( pool, iterator_thread ) + , m_Set( set ) + {} + + Iterator( Iterator& src ) + : base_class( src ) + , m_Set( src.m_Set ) + {} + + virtual thread * clone() + { + return new Iterator( *this ); + } + + virtual void test() + { + Set& rSet = m_Set; + + Set_Iteration& fixture = pool().template fixture(); + while ( !fixture.all_modifiers_done() ) { + ++m_nPassCount; + typename Set::rcu_lock l; + for ( auto it = rSet.begin(); it != rSet.end(); ++it ) { + it->val.hash = CityHash64( it->key.c_str(), it->key.length() ); + ++m_nVisitCount; + } + } + } + }; + protected: template void do_test( Set& testSet ) { typedef Inserter InserterThread; typedef Deleter DeleterThread; - typedef Iterator IteratorThread; + typedef Iterator IteratorThread; cds_test::thread_pool& pool = get_pool(); pool.add( new InserterThread( pool, testSet ), s_nInsertThreadCount ); @@ -495,7 +539,7 @@ namespace set { typedef Inserter InserterThread; typedef Deleter DeleterThread; typedef Extractor ExtractThread; - typedef Iterator IteratorThread; + typedef Iterator IteratorThread; size_t const nDelThreadCount = s_nDeleteThreadCount / 2; size_t const nExtractThreadCount = s_nDeleteThreadCount - nDelThreadCount;