| 96 | |
| 97 | template <class PQueue> |
| 98 | void test( PQueue& q ) |
| 99 | { |
| 100 | cds_test::thread_pool& pool = get_pool(); |
| 101 | pool.add( new Producer<PQueue>( pool, q ), s_nThreadCount ); |
| 102 | |
| 103 | size_t nStart = 0; |
| 104 | size_t nThreadItemCount = s_nQueueSize / s_nThreadCount; |
| 105 | s_nQueueSize = nThreadItemCount * s_nThreadCount; |
| 106 | |
| 107 | for ( size_t i = 0; i < pool.size(); ++i ) { |
| 108 | static_cast<Producer<PQueue>&>(pool.get( i )).prepare( nStart, nStart + nThreadItemCount ); |
| 109 | nStart += nThreadItemCount; |
| 110 | } |
| 111 | |
| 112 | propout() << std::make_pair( "thread_count", s_nThreadCount ) |
| 113 | << std::make_pair( "push_count", s_nQueueSize ); |
| 114 | |
| 115 | std::chrono::milliseconds duration = pool.run(); |
| 116 | propout() << std::make_pair( "duration", duration ); |
| 117 | |
| 118 | analyze( q ); |
| 119 | |
| 120 | propout() << q.statistics(); |
| 121 | } |
| 122 | |
| 123 | public: |
| 124 | static void SetUpTestCase() |