Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "intrusive_stack_type.h"
virtual void test()
{
m_nPushError = 0;
- memset( m_arrPush, 0, sizeof( m_arrPush ) );
+ memset( m_arrPush, 0, sizeof( m_arrPush ));
size_t i = 0;
for ( typename Stack::value_type * p = m_pStart; p < m_pEnd; ++p, ++i ) {
p->nProducer = id();
size_t no;
p->nNo.store( no = i % c_nValArraySize, atomics::memory_order_release );
- if ( m_Stack.push( *p ) )
+ if ( m_Stack.push( *p ))
++m_arrPush[no];
else
++m_nPushError;
m_nPopEmpty = 0;
m_nPopCount = 0;
m_nDirtyPop = 0;
- memset( m_arrPop, 0, sizeof( m_arrPop ) );
+ memset( m_arrPop, 0, sizeof( m_arrPop ));
- while ( !(s_nWorkingProducers.load( atomics::memory_order_acquire ) == 0 && m_Stack.empty()) ) {
+ while ( !(s_nWorkingProducers.load( atomics::memory_order_acquire ) == 0 && m_Stack.empty())) {
typename Stack::value_type * p = m_Stack.pop();
if ( p ) {
p->nConsumer = id();
++m_nPopCount;
size_t no = p->nNo.load( atomics::memory_order_acquire );
- if ( no < sizeof( m_arrPop ) / sizeof( m_arrPop[0] ) )
+ if ( no < sizeof( m_arrPop ) / sizeof( m_arrPop[0] ))
++m_arrPop[no];
else
++m_nDirtyPop;
T * get() const { return m_pArr.get(); }
};
- protected:
+ public:
static void SetUpTestCase();
//static void TearDownTestCase();
+ protected:
template <class Stack>
- void analyze( Stack& stack )
+ void analyze( Stack& /*stack*/ )
{
cds_test::thread_pool& pool = get_pool();
size_t nPopEmpty = 0;
size_t nPopCount = 0;
size_t arrVal[c_nValArraySize];
- memset( arrVal, 0, sizeof( arrVal ) );
+ memset( arrVal, 0, sizeof( arrVal ));
size_t nDirtyPop = 0;
for ( size_t threadNo = 0; threadNo < pool.size(); ++threadNo ) {
}
EXPECT_EQ( nPopCount, s_nStackSize );
- EXPECT_EQ( nDirtyPop, 0 );
- EXPECT_EQ( nPushError, 0 );
+ EXPECT_EQ( nDirtyPop, 0u );
+ EXPECT_EQ( nPushError, 0u );
for ( size_t i = 0; i < sizeof( arrVal ) / sizeof( arrVal[0] ); ++i ) {
- EXPECT_EQ( arrVal[i], 0 ) << "i=" << i;
+ EXPECT_EQ( arrVal[i], 0u ) << "i=" << i;
}
propout() << std::make_pair( "push_count", s_nStackSize )
<< std::make_pair( "pop_count", nPopCount )
<< std::make_pair( "pop_empty", nPopEmpty )
<< std::make_pair( "dirty_pop", nDirtyPop )
- ;
+;
}
propout() << std::make_pair( "producer_thread_count", s_nPushThreadCount )
<< std::make_pair( "consumer_thread_count", s_nPopThreadCount )
<< std::make_pair( "push_count", nPushCount * s_nPushThreadCount )
- ;
+;
std::chrono::milliseconds duration = pool.run();
propout() << stack.statistics();
}
};
-} // namespace cds_test
\ No newline at end of file
+} // namespace cds_test