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