39d476d47f2813d42265fecfa366b2097df8bf6d
[libcds.git] / test / stress / stack / stack_type.h
1 /*
2     This file is a part of libcds - Concurrent Data Structures library
3
4     (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
5
6     Source code repo: http://github.com/khizmax/libcds/
7     Download: http://sourceforge.net/projects/libcds/files/
8     
9     Redistribution and use in source and binary forms, with or without
10     modification, are permitted provided that the following conditions are met:
11
12     * Redistributions of source code must retain the above copyright notice, this
13       list of conditions and the following disclaimer.
14
15     * Redistributions in binary form must reproduce the above copyright notice,
16       this list of conditions and the following disclaimer in the documentation
17       and/or other materials provided with the distribution.
18
19     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
29 */
30
31 #ifndef CDSSTRESS_STACK_TYPES_H
32 #define CDSSTRESS_STACK_TYPES_H
33
34 #include <cds/container/treiber_stack.h>
35 #include <cds/container/fcstack.h>
36 #include <cds/container/fcdeque.h>
37
38 #include <cds/gc/hp.h>
39 #include <cds/gc/dhp.h>
40
41 #include <mutex>
42 #include <cds/sync/spinlock.h>
43 #include <stack>
44 #include <list>
45 #include <vector>
46
47 #include <cds_test/stress_test.h>
48
49 namespace stack {
50
51     namespace details {
52
53         template <typename T, typename Traits=cds::container::fcdeque::traits>
54         class FCDequeL: public cds::container::FCDeque<T, std::deque<T>, Traits >
55         {
56             typedef cds::container::FCDeque<T, std::deque<T>, Traits > base_class;
57         public:
58             FCDequeL()
59             {}
60
61             FCDequeL(
62                 unsigned int nCompactFactor     ///< Flat combining: publication list compacting factor
63                 ,unsigned int nCombinePassCount ///< Flat combining: number of combining passes for combiner thread
64                 )
65                 : base_class( nCompactFactor, nCombinePassCount )
66             {}
67
68             bool push( T const& v )
69             {
70                 return base_class::push_front( v );
71             }
72
73             bool pop( T& v )
74             {
75                 return base_class::pop_front( v );
76             }
77         };
78
79         template <typename T, typename Traits=cds::container::fcdeque::traits>
80         class FCDequeR: public cds::container::FCDeque<T, std::deque<T>, Traits >
81         {
82             typedef cds::container::FCDeque<T, std::deque<T>, Traits > base_class;
83         public:
84             FCDequeR()
85             {}
86
87             FCDequeR(
88                 unsigned int nCompactFactor     ///< Flat combining: publication list compacting factor
89                 ,unsigned int nCombinePassCount ///< Flat combining: number of combining passes for combiner thread
90                 )
91                 : base_class( nCompactFactor, nCombinePassCount )
92             {}
93
94             bool push( T const& v )
95             {
96                 return base_class::push_back( v );
97             }
98
99             bool pop( T& v )
100             {
101                 return base_class::pop_back( v );
102             }
103         };
104
105         template < typename T, typename Stack, typename Lock>
106         class StdStack
107         {
108             Stack   m_Impl;
109             mutable Lock    m_Lock;
110             cds::container::treiber_stack::empty_stat m_stat;
111
112             typedef std::unique_lock<Lock>  unique_lock;
113
114         public:
115             bool push( T const& v )
116             {
117                 unique_lock l( m_Lock );
118                 m_Impl.push( v );
119                 return true;
120             }
121
122             bool pop( T& v )
123             {
124                 unique_lock l( m_Lock );
125                 if ( !m_Impl.empty() ) {
126                     v = m_Impl.top();
127                     m_Impl.pop();
128                     return true;
129                 }
130                 return false;
131             }
132
133             bool empty() const
134             {
135                 unique_lock l( m_Lock );
136                 return m_Impl.empty();
137             }
138
139             cds::container::treiber_stack::empty_stat const& statistics() const
140             {
141                 return m_stat;
142             }
143         };
144     }
145
146     template <typename T>
147     struct Types {
148
149     // TreiberStack
150         typedef cds::container::TreiberStack< cds::gc::HP,  T > Treiber_HP;
151         typedef cds::container::TreiberStack< cds::gc::DHP, T > Treiber_DHP;
152
153         struct traits_Treiber_seqcst: public
154             cds::container::treiber_stack::make_traits<
155                 cds::opt::memory_model<cds::opt::v::sequential_consistent>
156             >::type
157         {};
158         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Treiber_seqcst > Treiber_HP_seqcst;
159         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_seqcst > Treiber_DHP_seqcst;
160
161         struct traits_Treiber_stat: public
162             cds::container::treiber_stack::make_traits<
163                 cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
164             >::type
165         {};
166         typedef cds::container::TreiberStack< cds::gc::HP, T, traits_Treiber_stat > Treiber_HP_stat;
167         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_stat > Treiber_DHP_stat;
168
169         struct traits_Treiber_yield: public
170             cds::container::treiber_stack::make_traits<
171                 cds::opt::back_off<cds::backoff::yield>
172                 , cds::opt::memory_model<cds::opt::v::relaxed_ordering>
173             >::type
174         {};
175         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Treiber_yield > Treiber_HP_yield;
176         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_yield > Treiber_DHP_yield;
177
178         struct traits_Treiber_pause: public
179             cds::container::treiber_stack::make_traits<
180                 cds::opt::back_off<cds::backoff::pause>
181             >::type
182         {};
183         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Treiber_pause > Treiber_HP_pause;
184         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_pause > Treiber_DHP_pause;
185
186         struct traits_Treiber_exp: public
187             cds::container::treiber_stack::make_traits<
188                 cds::opt::back_off<
189                     cds::backoff::exponential<
190                         cds::backoff::pause,
191                         cds::backoff::yield
192                     >
193                 >
194             >::type
195         {};
196         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Treiber_exp > Treiber_HP_exp;
197         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Treiber_exp > Treiber_DHP_exp;
198
199
200     // Elimination stack
201         struct traits_Elimination_on : public
202             cds::container::treiber_stack::make_traits <
203                 cds::opt::enable_elimination<true>
204             > ::type
205         {};
206         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_on > Elimination_HP;
207         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_on > Elimination_DHP;
208
209         struct traits_Elimination_stat : public
210             cds::container::treiber_stack::make_traits <
211                 cds::opt::enable_elimination<true>
212                 ,cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
213             > ::type
214         {};
215         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_stat > Elimination_HP_stat;
216         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_stat > Elimination_DHP_stat;
217
218         struct traits_Elimination_2ms: public
219             cds::container::treiber_stack::make_traits <
220                 cds::opt::enable_elimination<true>
221                 ,cds::opt::elimination_backoff< cds::backoff::delay_of<2> >
222             > ::type
223         {};
224         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_2ms >  Elimination_HP_2ms;
225         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_2ms >  Elimination_DHP_2ms;
226
227         struct traits_Elimination_2ms_stat : public
228             cds::container::treiber_stack::make_traits <
229                 cds::opt::enable_elimination<true>
230                 , cds::opt::elimination_backoff< cds::backoff::delay_of<2> >
231                 , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
232             > ::type
233         {};
234         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_2ms_stat > Elimination_HP_2ms_stat;
235         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_2ms_stat > Elimination_DHP_2ms_stat;
236
237         struct traits_Elimination_5ms : public
238             cds::container::treiber_stack::make_traits <
239                 cds::opt::enable_elimination<true>
240                 , cds::opt::elimination_backoff< cds::backoff::delay_of<5> >
241             > ::type
242         {};
243         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_5ms > Elimination_HP_5ms;
244         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_5ms > Elimination_DHP_5ms;
245
246         struct traits_Elimination_5ms_stat : public
247             cds::container::treiber_stack::make_traits <
248                 cds::opt::enable_elimination<true>
249                 , cds::opt::elimination_backoff< cds::backoff::delay_of<5> >
250                 , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
251             > ::type
252         {};
253         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_5ms_stat > Elimination_HP_5ms_stat;
254         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_5ms_stat > Elimination_DHP_5ms_stat;
255
256         struct traits_Elimination_10ms : public
257             cds::container::treiber_stack::make_traits <
258                 cds::opt::enable_elimination<true>
259                 , cds::opt::elimination_backoff< cds::backoff::delay_of<10> >
260             > ::type
261         {};
262         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_10ms > Elimination_HP_10ms;
263         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_10ms > Elimination_DHP_10ms;
264
265         struct traits_Elimination_10ms_stat : public
266             cds::container::treiber_stack::make_traits <
267                 cds::opt::enable_elimination<true>
268                 , cds::opt::elimination_backoff< cds::backoff::delay_of<10> >
269                 , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
270             > ::type
271         {};
272         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_10ms_stat > Elimination_HP_10ms_stat;
273         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_10ms_stat > Elimination_DHP_10ms_stat;
274
275         struct traits_Elimination_dyn: public
276             cds::container::treiber_stack::make_traits <
277                 cds::opt::enable_elimination<true>
278                 , cds::opt::buffer< cds::opt::v::initialized_dynamic_buffer<int> >
279             > ::type
280         {};
281         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_dyn > Elimination_HP_dyn;
282         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_dyn > Elimination_DHP_dyn;
283
284         struct traits_Elimination_seqcst: public
285             cds::container::treiber_stack::make_traits <
286                 cds::opt::enable_elimination<true>
287                 , cds::opt::memory_model<cds::opt::v::sequential_consistent>
288             > ::type
289         {};
290         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_seqcst > Elimination_HP_seqcst;
291         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_seqcst > Elimination_DHP_seqcst;
292
293         struct traits_Elimination_dyn_stat: public
294             cds::container::treiber_stack::make_traits <
295                 cds::opt::enable_elimination<true>
296                 , cds::opt::stat<cds::intrusive::treiber_stack::stat<> >
297                 , cds::opt::buffer< cds::opt::v::initialized_dynamic_buffer<int> >
298             > ::type
299         {};
300         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_dyn_stat > Elimination_HP_dyn_stat;
301         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_dyn_stat > Elimination_DHP_dyn_stat;
302
303         struct traits_Elimination_yield: public
304             cds::container::treiber_stack::make_traits <
305                 cds::opt::enable_elimination<true>
306                 , cds::opt::back_off<cds::backoff::yield>
307                 , cds::opt::memory_model<cds::opt::v::relaxed_ordering>
308             > ::type
309         {};
310         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_yield > Elimination_HP_yield;
311         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_yield > Elimination_DHP_yield;
312
313         struct traits_Elimination_pause: public
314             cds::container::treiber_stack::make_traits <
315                 cds::opt::enable_elimination<true>
316                 , cds::opt::back_off<cds::backoff::pause>
317             > ::type
318         {};
319         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_pause > Elimination_HP_pause;
320         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_pause > Elimination_DHP_pause;
321
322         struct traits_Elimination_exp: public
323             cds::container::treiber_stack::make_traits <
324                 cds::opt::enable_elimination<true>
325                 ,cds::opt::back_off<
326                     cds::backoff::exponential<
327                         cds::backoff::pause,
328                         cds::backoff::yield
329                     >
330                 >
331             > ::type
332         {};
333         typedef cds::container::TreiberStack< cds::gc::HP,  T, traits_Elimination_exp > Elimination_HP_exp;
334         typedef cds::container::TreiberStack< cds::gc::DHP, T, traits_Elimination_exp > Elimination_DHP_exp;
335
336
337     // FCStack
338         typedef cds::container::FCStack< T > FCStack_deque;
339
340         struct traits_FCStack_stat:
341             public cds::container::fcstack::make_traits<
342                 cds::opt::stat< cds::container::fcstack::stat<> >
343             >::type
344         {};
345         struct traits_FCStack_elimination:
346             public cds::container::fcstack::make_traits<
347             cds::opt::enable_elimination< true >
348             >::type
349         {};
350         struct traits_FCStack_elimination_stat:
351             public cds::container::fcstack::make_traits<
352                 cds::opt::stat< cds::container::fcstack::stat<> >,
353                 cds::opt::enable_elimination< true >
354             >::type
355         {};
356         struct traits_FCStack_mutex:
357             public cds::container::fcstack::make_traits<
358                 cds::opt::lock_type< std::mutex >
359             >::type
360         {};
361
362         typedef cds::container::FCStack< T, std::stack<T, std::deque<T> >, traits_FCStack_mutex > FCStack_deque_mutex;
363         typedef cds::container::FCStack< T, std::stack<T, std::deque<T> >, traits_FCStack_stat > FCStack_deque_stat;
364         typedef cds::container::FCStack< T, std::stack<T, std::deque<T> >, traits_FCStack_elimination > FCStack_deque_elimination;
365         typedef cds::container::FCStack< T, std::stack<T, std::deque<T> >, traits_FCStack_elimination_stat > FCStack_deque_elimination_stat;
366         typedef cds::container::FCStack< T, std::stack<T, std::vector<T> > > FCStack_vector;
367         typedef cds::container::FCStack< T, std::stack<T, std::vector<T> >, traits_FCStack_mutex > FCStack_vector_mutex;
368         typedef cds::container::FCStack< T, std::stack<T, std::vector<T> >, traits_FCStack_stat > FCStack_vector_stat;
369         typedef cds::container::FCStack< T, std::stack<T, std::vector<T> >, traits_FCStack_elimination > FCStack_vector_elimination;
370         typedef cds::container::FCStack< T, std::stack<T, std::vector<T> >, traits_FCStack_elimination_stat > FCStack_vector_elimination_stat;
371         typedef cds::container::FCStack< T, std::stack<T, std::list<T> > > FCStack_list;
372         typedef cds::container::FCStack< T, std::stack<T, std::list<T> >, traits_FCStack_mutex > FCStack_list_mutex;
373         typedef cds::container::FCStack< T, std::stack<T, std::list<T> >, traits_FCStack_stat > FCStack_list_stat;
374         typedef cds::container::FCStack< T, std::stack<T, std::list<T> >, traits_FCStack_elimination > FCStack_list_elimination;
375         typedef cds::container::FCStack< T, std::stack<T, std::list<T> >, traits_FCStack_elimination_stat > FCStack_list_elimination_stat;
376
377    // FCDeque
378         struct traits_FCDeque_stat:
379             public cds::container::fcdeque::make_traits<
380                 cds::opt::stat< cds::container::fcdeque::stat<> >
381             >::type
382         {};
383         struct traits_FCDeque_elimination:
384             public cds::container::fcdeque::make_traits<
385                 cds::opt::enable_elimination< true >
386             >::type
387         {};
388         struct traits_FCDeque_elimination_stat:
389             public cds::container::fcdeque::make_traits<
390                 cds::opt::stat< cds::container::fcdeque::stat<> >,
391                 cds::opt::enable_elimination< true >
392             >::type
393         {};
394         struct traits_FCDeque_mutex:
395             public cds::container::fcdeque::make_traits<
396                 cds::opt::lock_type< std::mutex >
397             >::type
398         {};
399
400
401         typedef details::FCDequeL< T > FCDequeL_default;
402         typedef details::FCDequeL< T, traits_FCDeque_mutex > FCDequeL_mutex;
403         typedef details::FCDequeL< T, traits_FCDeque_stat > FCDequeL_stat;
404         typedef details::FCDequeL< T, traits_FCDeque_elimination > FCDequeL_elimination;
405         typedef details::FCDequeL< T, traits_FCDeque_elimination_stat > FCDequeL_elimination_stat;
406
407         typedef details::FCDequeR< T > FCDequeR_default;
408         typedef details::FCDequeR< T, traits_FCDeque_mutex > FCDequeR_mutex;
409         typedef details::FCDequeR< T, traits_FCDeque_stat > FCDequeR_stat;
410         typedef details::FCDequeR< T, traits_FCDeque_elimination > FCDequeR_elimination;
411         typedef details::FCDequeR< T, traits_FCDeque_elimination_stat > FCDequeR_elimination_stat;
412
413
414         // std::stack
415         typedef details::StdStack< T, std::stack< T >, std::mutex >  StdStack_Deque_Mutex;
416         typedef details::StdStack< T, std::stack< T >, cds::sync::spin > StdStack_Deque_Spin;
417         typedef details::StdStack< T, std::stack< T, std::vector<T> >, std::mutex >  StdStack_Vector_Mutex;
418         typedef details::StdStack< T, std::stack< T, std::vector<T> >, cds::sync::spin > StdStack_Vector_Spin;
419         typedef details::StdStack< T, std::stack< T, std::list<T> >, std::mutex >  StdStack_List_Mutex;
420         typedef details::StdStack< T, std::stack< T, std::list<T> >, cds::sync::spin > StdStack_List_Spin;
421
422     };
423 } // namespace stack
424
425 namespace cds_test {
426     static inline property_stream& operator <<( property_stream& o, cds::container::treiber_stack::empty_stat const& )
427     {
428         return o;
429     }
430
431     static inline property_stream& operator <<( property_stream& o, cds::container::treiber_stack::stat<> const& s )
432     {
433         return o
434             << CDSSTRESS_STAT_OUT( s, m_PushCount )
435             << CDSSTRESS_STAT_OUT( s, m_PopCount  )
436             << CDSSTRESS_STAT_OUT( s, m_PushRace  )
437             << CDSSTRESS_STAT_OUT( s, m_PopRace   )
438             << CDSSTRESS_STAT_OUT( s, m_ActivePushCollision  )
439             << CDSSTRESS_STAT_OUT( s, m_PassivePopCollision  )
440             << CDSSTRESS_STAT_OUT( s, m_ActivePopCollision   )
441             << CDSSTRESS_STAT_OUT( s, m_PassivePushCollision )
442             << CDSSTRESS_STAT_OUT( s, m_EliminationFailed    );
443     }
444
445     static inline property_stream& operator <<( property_stream& o, cds::container::fcstack::empty_stat const& /*s*/ )
446     {
447         return o;
448     }
449
450     static inline property_stream& operator <<( property_stream& o, cds::container::fcstack::stat<> const& s )
451     {
452         return o
453             << CDSSTRESS_STAT_OUT( s, m_nPush )
454             << CDSSTRESS_STAT_OUT( s, m_nPushMove )
455             << CDSSTRESS_STAT_OUT( s, m_nPop )
456             << CDSSTRESS_STAT_OUT( s, m_nFailedPop )
457             << CDSSTRESS_STAT_OUT( s, m_nCollided )
458             << CDSSTRESS_STAT_OUT_( "combining_factor", s.combining_factor())
459             << CDSSTRESS_STAT_OUT( s, m_nOperationCount )
460             << CDSSTRESS_STAT_OUT( s, m_nCombiningCount )
461             << CDSSTRESS_STAT_OUT( s, m_nCompactPublicationList )
462             << CDSSTRESS_STAT_OUT( s, m_nDeactivatePubRecord )
463             << CDSSTRESS_STAT_OUT( s, m_nActivatePubRecord )
464             << CDSSTRESS_STAT_OUT( s, m_nPubRecordCreated )
465             << CDSSTRESS_STAT_OUT( s, m_nPubRecordDeteted )
466             << CDSSTRESS_STAT_OUT( s, m_nAcquirePubRecCount )
467             << CDSSTRESS_STAT_OUT( s, m_nReleasePubRecCount );
468     }
469
470     static inline property_stream& operator <<( property_stream& o, cds::container::fcdeque::empty_stat const& /*s*/ )
471     {
472         return o;
473     }
474
475     static inline property_stream& operator <<( property_stream& o, cds::container::fcdeque::stat<> const& s )
476     {
477         return o
478             << CDSSTRESS_STAT_OUT( s, m_nPushFront )
479             << CDSSTRESS_STAT_OUT( s, m_nPushFrontMove )
480             << CDSSTRESS_STAT_OUT( s, m_nPushBack )
481             << CDSSTRESS_STAT_OUT( s, m_nPushBackMove )
482             << CDSSTRESS_STAT_OUT( s, m_nPopFront )
483             << CDSSTRESS_STAT_OUT( s, m_nFailedPopFront )
484             << CDSSTRESS_STAT_OUT( s, m_nPopBack )
485             << CDSSTRESS_STAT_OUT( s, m_nFailedPopBack )
486             << CDSSTRESS_STAT_OUT( s, m_nCollided )
487             << CDSSTRESS_STAT_OUT_( "combining_factor", s.combining_factor() )
488             << CDSSTRESS_STAT_OUT( s, m_nOperationCount )
489             << CDSSTRESS_STAT_OUT( s, m_nCombiningCount )
490             << CDSSTRESS_STAT_OUT( s, m_nCompactPublicationList )
491             << CDSSTRESS_STAT_OUT( s, m_nDeactivatePubRecord )
492             << CDSSTRESS_STAT_OUT( s, m_nActivatePubRecord )
493             << CDSSTRESS_STAT_OUT( s, m_nPubRecordCreated )
494             << CDSSTRESS_STAT_OUT( s, m_nPubRecordDeteted )
495             << CDSSTRESS_STAT_OUT( s, m_nAcquirePubRecCount )
496             << CDSSTRESS_STAT_OUT( s, m_nReleasePubRecCount );
497     }
498 } // namespace cds_test
499
500 #define CDSSTRESS_Stack_F( test_fixture, type_name ) \
501     TEST_F( test_fixture, type_name ) \
502     { \
503         typedef stack::Types< value_type >::type_name stack_type; \
504         stack_type stack; \
505         test( stack ); \
506     }
507
508 #define CDSSTRESS_EliminationStack_F( test_fixture, type_name ) \
509     TEST_F( test_fixture, type_name ) \
510     { \
511         typedef stack::Types< value_type >::type_name stack_type; \
512         stack_type stack( s_nEliminationSize ); \
513         test_elimination( stack ); \
514     }
515
516 #define CDSSTRESS_TreiberStack( test_fixture ) \
517     CDSSTRESS_Stack_F( test_fixture, Treiber_HP )        \
518     CDSSTRESS_Stack_F( test_fixture, Treiber_HP_seqcst ) \
519     CDSSTRESS_Stack_F( test_fixture, Treiber_HP_pause )  \
520     CDSSTRESS_Stack_F( test_fixture, Treiber_HP_exp )    \
521     CDSSTRESS_Stack_F( test_fixture, Treiber_HP_stat   ) \
522     CDSSTRESS_Stack_F( test_fixture, Treiber_DHP       ) \
523     CDSSTRESS_Stack_F( test_fixture, Treiber_DHP_pause ) \
524     CDSSTRESS_Stack_F( test_fixture, Treiber_DHP_exp   ) \
525     CDSSTRESS_Stack_F( test_fixture, Treiber_DHP_stat  ) \
526
527 #define CDSSTRESS_EliminationStack( test_fixture ) \
528     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP        ) \
529     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_2ms    ) \
530     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_2ms_stat) \
531     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_5ms    ) \
532     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_5ms_stat) \
533     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_10ms    ) \
534     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_10ms_stat) \
535     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_seqcst ) \
536     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_pause  ) \
537     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_exp    ) \
538     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_stat   ) \
539     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_dyn    ) \
540     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_HP_dyn_stat) \
541     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP       ) \
542     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_2ms    ) \
543     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_2ms_stat) \
544     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_5ms    ) \
545     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_5ms_stat) \
546     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_10ms    ) \
547     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_10ms_stat) \
548     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_pause ) \
549     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_exp   ) \
550     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_stat  ) \
551     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_dyn   ) \
552     CDSSTRESS_EliminationStack_F( test_fixture, Elimination_DHP_dyn_stat)
553
554 #define CDSSTRESS_FCStack( test_fixture ) \
555     CDSSTRESS_Stack_F( test_fixture, FCStack_deque ) \
556     CDSSTRESS_Stack_F( test_fixture, FCStack_deque_mutex ) \
557     CDSSTRESS_Stack_F( test_fixture, FCStack_deque_stat ) \
558     CDSSTRESS_Stack_F( test_fixture, FCStack_deque_elimination ) \
559     CDSSTRESS_Stack_F( test_fixture, FCStack_deque_elimination_stat ) \
560     CDSSTRESS_Stack_F( test_fixture, FCStack_vector ) \
561     CDSSTRESS_Stack_F( test_fixture, FCStack_vector_mutex ) \
562     CDSSTRESS_Stack_F( test_fixture, FCStack_vector_stat ) \
563     CDSSTRESS_Stack_F( test_fixture, FCStack_vector_elimination ) \
564     CDSSTRESS_Stack_F( test_fixture, FCStack_vector_elimination_stat ) \
565     CDSSTRESS_Stack_F( test_fixture, FCStack_list ) \
566     CDSSTRESS_Stack_F( test_fixture, FCStack_list_mutex ) \
567     CDSSTRESS_Stack_F( test_fixture, FCStack_list_stat ) \
568     CDSSTRESS_Stack_F( test_fixture, FCStack_list_elimination ) \
569     CDSSTRESS_Stack_F( test_fixture, FCStack_list_elimination_stat )
570
571 #define CDSSTRESS_FCDeque( test_fixture ) \
572     CDSSTRESS_Stack_F( test_fixture, FCDequeL_default ) \
573     CDSSTRESS_Stack_F( test_fixture, FCDequeL_mutex ) \
574     CDSSTRESS_Stack_F( test_fixture, FCDequeL_stat ) \
575     CDSSTRESS_Stack_F( test_fixture, FCDequeL_elimination ) \
576     CDSSTRESS_Stack_F( test_fixture, FCDequeL_elimination_stat ) \
577     CDSSTRESS_Stack_F( test_fixture, FCDequeR_default ) \
578     CDSSTRESS_Stack_F( test_fixture, FCDequeR_mutex ) \
579     CDSSTRESS_Stack_F( test_fixture, FCDequeR_stat ) \
580     CDSSTRESS_Stack_F( test_fixture, FCDequeR_elimination ) \
581     CDSSTRESS_Stack_F( test_fixture, FCDequeR_elimination_stat )
582
583 #define CDSSTRESS_StdStack( test_fixture ) \
584     CDSSTRESS_Stack_F( test_fixture, StdStack_Deque_Mutex  ) \
585     CDSSTRESS_Stack_F( test_fixture, StdStack_Deque_Spin   ) \
586     CDSSTRESS_Stack_F( test_fixture, StdStack_Vector_Mutex ) \
587     CDSSTRESS_Stack_F( test_fixture, StdStack_Vector_Spin  ) \
588     CDSSTRESS_Stack_F( test_fixture, StdStack_List_Mutex   ) \
589     CDSSTRESS_Stack_F( test_fixture, StdStack_List_Spin    )
590
591
592 #endif // #ifndef CDSSTRESS_STACK_TYPES_H