| 64 | protected: |
| 65 | template <class PQueue> |
| 66 | void analyze( PQueue& q ) |
| 67 | { |
| 68 | cds_test::thread_pool& pool = get_pool(); |
| 69 | |
| 70 | for ( size_t i = 0; i < pool.size(); ++i ) { |
| 71 | Producer<PQueue>& prod = static_cast<Producer<PQueue>&>(pool.get( i )); |
| 72 | EXPECT_EQ( prod.m_nPushError, 0u ) << "producer=" << i; |
| 73 | } |
| 74 | EXPECT_FALSE( q.empty()); |
| 75 | |
| 76 | typedef std::vector<size_t> vector_type; |
| 77 | vector_type arr; |
| 78 | arr.reserve( s_nQueueSize ); |
| 79 | |
| 80 | size_t nPopped = 0; |
| 81 | typename PQueue::value_type val; |
| 82 | while ( q.pop( val )) { |
| 83 | nPopped++; |
| 84 | arr.push_back( val.key ); |
| 85 | } |
| 86 | |
| 87 | EXPECT_EQ( arr.size(), s_nQueueSize ); |
| 88 | auto it = arr.begin(); |
| 89 | size_t nPrev = *it; |
| 90 | ++it; |
| 91 | for ( auto itEnd = arr.end(); it != itEnd; ++it ) { |
| 92 | EXPECT_EQ( nPrev - 1, *it ); |
| 93 | nPrev = *it; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | template <class PQueue> |
| 98 | void test( PQueue& q ) |