| 161 | |
| 162 | template <typename Stack> |
| 163 | void test( Stack& stack ) |
| 164 | { |
| 165 | cds_test::thread_pool& pool = get_pool(); |
| 166 | size_t const nPushCount = s_nStackSize / s_nPushThreadCount; |
| 167 | |
| 168 | pool.add( new Producer<Stack>( pool, stack, nPushCount ), s_nPushThreadCount ); |
| 169 | pool.add( new Consumer<Stack>( pool, stack ), s_nPopThreadCount ); |
| 170 | |
| 171 | s_nWorkingProducers.store( s_nPushThreadCount ); |
| 172 | s_nStackSize = nPushCount * s_nPushThreadCount; |
| 173 | |
| 174 | propout() << std::make_pair( "producer_thread_count", s_nPushThreadCount ) |
| 175 | << std::make_pair( "consumer_thread_count", s_nPopThreadCount ) |
| 176 | << std::make_pair( "push_count", s_nStackSize ) |
| 177 | ; |
| 178 | |
| 179 | std::chrono::milliseconds duration = pool.run(); |
| 180 | |
| 181 | propout() << std::make_pair( "duration", duration ); |
| 182 | |
| 183 | analyze( stack ); |
| 184 | |
| 185 | propout() << stack.statistics(); |
| 186 | } |
| 187 | |
| 188 | template <typename Stack> |
| 189 | void test_elimination( Stack& stack ) |