| 88 | protected: |
| 89 | template <class Queue> |
| 90 | void test( Queue& q ) |
| 91 | { |
| 92 | cds_test::thread_pool& pool = get_pool(); |
| 93 | |
| 94 | pool.add( new Producer<Queue>( pool, q ), s_nThreadCount ); |
| 95 | |
| 96 | size_t nStart = 0; |
| 97 | size_t nThreadItemCount = s_nQueueSize / s_nThreadCount; |
| 98 | for ( size_t i = 0; i < pool.size(); ++i ) { |
| 99 | Producer<Queue>& thread = static_cast<Producer<Queue>&>(pool.get( i )); |
| 100 | thread.m_nStartItem = nStart; |
| 101 | nStart += nThreadItemCount; |
| 102 | thread.m_nEndItem = nStart; |
| 103 | } |
| 104 | |
| 105 | s_nQueueSize = nThreadItemCount * s_nThreadCount; |
| 106 | propout() << std::make_pair( "thread_count", s_nThreadCount ) |
| 107 | << std::make_pair( "push_count", s_nQueueSize ); |
| 108 | |
| 109 | std::chrono::milliseconds duration = pool.run(); |
| 110 | |
| 111 | propout() << std::make_pair( "duration", duration ); |
| 112 | |
| 113 | analyze( q ); |
| 114 | |
| 115 | propout() << q.statistics(); |
| 116 | } |
| 117 | |
| 118 | template <class Queue> |
| 119 | void analyze( Queue& q ) |