<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\test\stress\main.cpp">
s_nDeleteThreadCount = 2;
s_nUpdateThreadCount = cfg.get_size_t( "UpdateThreadCount", s_nUpdateThreadCount );
- if ( s_nUpdateThreadCount == 0 )
- s_nUpdateThreadCount = 2;
+ //if ( s_nUpdateThreadCount == 0 )
+ // s_nUpdateThreadCount = 2;
s_nThreadPassCount = cfg.get_size_t( "ThreadPassCount", s_nThreadPassCount );
if ( s_nThreadPassCount == 0 )
cds_test::thread_pool& pool = get_pool();
pool.add( new inserter( pool, testMap ), s_nInsertThreadCount );
pool.add( new deleter( pool, testMap ), s_nDeleteThreadCount );
- pool.add( new updater( pool, testMap ), s_nUpdateThreadCount );
+ if ( s_nUpdateThreadCount )
+ pool.add( new updater( pool, testMap ), s_nUpdateThreadCount );
propout() << std::make_pair( "insert_thread_count", s_nInsertThreadCount )
<< std::make_pair( "delete_thread_count", s_nDeleteThreadCount )
Map testMap( *this );
do_test( testMap );
}
+
+ template <class Map>
+ void run_test2()
+ {
+ Map testMap( *this );
+ do_test( testMap );
+
+ if ( testMap.size() != 0 ) {
+ for ( auto it = testMap.begin(); it != testMap.end(); ++it ) {
+ std::cout << "key=" << it->first << std::endl;
+ }
+ }
+ }
};
class Map_InsDel_func_LF: public Map_InsDel_func
Map_InsDel_func::run_test<Set>();
}
+ template <class Set>
+ void run_test2()
+ {
+ s_nLoadFactor = GetParam();
+ propout() << std::make_pair( "load_factor", s_nLoadFactor );
+ Map_InsDel_func::run_test2<Set>();
+ }
+
static std::vector<size_t> get_load_factors();
};
namespace map {
- CDSSTRESS_MichaelMap( Map_InsDel_func_LF, run_test, size_t, Map_InsDel_func::value_type )
+ CDSSTRESS_MichaelMap( Map_InsDel_func_LF, run_test2, size_t, Map_InsDel_func::value_type )
} // namespace map
size_t nKey;
size_t nData;
atomics::atomic<size_t> nUpdateCall;
- bool volatile bInitialized;
- cds::OS::ThreadId threadId ; // insert thread id
+ bool volatile bInitialized;
+ cds::OS::ThreadId threadId; // insert thread id
typedef cds::sync::spin_lock< cds::backoff::pause > lock_type;
mutable lock_type m_access;
size_t * m_pKeyFirst;
size_t * m_pKeyLast;
- size_t * m_pKeyArr;
+ std::unique_ptr< size_t[] > m_pKeyArr;
enum {
insert_thread,
typedef Deleter<Set> DeleterThread;
typedef Updater<Set> UpdaterThread;
- m_pKeyArr = new size_t[ s_nSetSize ];
- m_pKeyFirst = m_pKeyArr;
+ m_pKeyArr.reset( new size_t[ s_nSetSize ] );
+ m_pKeyFirst = m_pKeyArr.get();
m_pKeyLast = m_pKeyFirst + s_nSetSize;
for ( size_t i = 0; i < s_nSetSize; ++i )
m_pKeyArr[i] = i;
propout() << std::make_pair( "duration", duration );
- delete [] m_pKeyArr;
-
size_t nInsertSuccess = 0;
size_t nInsertFailed = 0;
size_t nDeleteSuccess = 0;
// nTestFunctorRef is call count of insert functor
EXPECT_EQ( nTestFunctorRef, nInsertSuccess );
- testSet.clear();
+ //testSet.clear();
+ for ( size_t * p = m_pKeyFirst; p != m_pKeyLast; ++p )
+ testSet.erase( *p );
+
EXPECT_TRUE( testSet.empty() );
+ EXPECT_EQ( testSet.size(), 0u );
additional_check( testSet );
print_stat( propout(), testSet );
Set s( *this );
run_test( s );
}
+
+ template <class Set>
+ void run_test2()
+ {
+ Set s( *this );
+ run_test( s );
+
+ for ( auto it = s.begin(); it != s.end(); ++it )
+ std::cout << "key=" << it->key << std::endl;
+ }
};
class Set_InsDel_func_LF: public Set_InsDel_func
Set_InsDel_func::run_test<Set>();
}
+ template <class Set>
+ void run_test2()
+ {
+ s_nLoadFactor = GetParam();
+ propout() << std::make_pair( "load_factor", s_nLoadFactor );
+ Set_InsDel_func::run_test2<Set>();
+ }
+
static std::vector<size_t> get_load_factors();
};
namespace set {
- CDSSTRESS_MichaelSet( Set_InsDel_func_LF, run_test, size_t, value )
- CDSSTRESS_MichaelIterableSet( Set_InsDel_func_LF, run_test, size_t, value )
+ CDSSTRESS_MichaelSet( Set_InsDel_func_LF, run_test2, size_t, value )
+ CDSSTRESS_MichaelIterableSet( Set_InsDel_func_LF, run_test2, size_t, value )
} // namespace set