Refactoring exponential and delay back-off strategies to avoid static data members...
[libcds.git] / test / stress / stack / stack_type.h
index 39d476d47f2813d42265fecfa366b2097df8bf6d..a9a7350d05cf12150e758f5aa37fc2522120de27 100644 (file)
@@ -1,11 +1,11 @@
 /*
     This file is a part of libcds - Concurrent Data Structures library
 
-    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
 
     Source code repo: http://github.com/khizmax/libcds/
     Download: http://sourceforge.net/projects/libcds/files/
-    
+
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:
 
@@ -25,7 +25,7 @@
     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 #ifndef CDSSTRESS_STACK_TYPES_H
@@ -45,6 +45,7 @@
 #include <vector>
 
 #include <cds_test/stress_test.h>
+#include <cds_test/stat_flat_combining_out.h>
 
 namespace stack {
 
@@ -122,7 +123,7 @@ namespace stack {
             bool pop( T& v )
             {
                 unique_lock l( m_Lock );
-                if ( !m_Impl.empty() ) {
+                if ( !m_Impl.empty()) {
                     v = m_Impl.top();
                     m_Impl.pop();
                     return true;
@@ -186,10 +187,7 @@ namespace stack {
         struct traits_Treiber_exp: public
             cds::container::treiber_stack::make_traits<
                 cds::opt::back_off<
-                    cds::backoff::exponential<
-                        cds::backoff::pause,
-                        cds::backoff::yield
-                    >
+                    cds::backoff::make_exponential_t<cds::backoff::pause, cds::backoff::yield >
                 >
             >::type
         {};
@@ -323,10 +321,7 @@ namespace stack {
             cds::container::treiber_stack::make_traits <
                 cds::opt::enable_elimination<true>
                 ,cds::opt::back_off<
-                    cds::backoff::exponential<
-                        cds::backoff::pause,
-                        cds::backoff::yield
-                    >
+                    cds::backoff::make_exponential_t< cds::backoff::pause, cds::backoff::yield >
                 >
             > ::type
         {};
@@ -455,16 +450,7 @@ namespace cds_test {
             << CDSSTRESS_STAT_OUT( s, m_nPop )
             << CDSSTRESS_STAT_OUT( s, m_nFailedPop )
             << CDSSTRESS_STAT_OUT( s, m_nCollided )
-            << CDSSTRESS_STAT_OUT_( "combining_factor", s.combining_factor())
-            << CDSSTRESS_STAT_OUT( s, m_nOperationCount )
-            << CDSSTRESS_STAT_OUT( s, m_nCombiningCount )
-            << CDSSTRESS_STAT_OUT( s, m_nCompactPublicationList )
-            << CDSSTRESS_STAT_OUT( s, m_nDeactivatePubRecord )
-            << CDSSTRESS_STAT_OUT( s, m_nActivatePubRecord )
-            << CDSSTRESS_STAT_OUT( s, m_nPubRecordCreated )
-            << CDSSTRESS_STAT_OUT( s, m_nPubRecordDeteted )
-            << CDSSTRESS_STAT_OUT( s, m_nAcquirePubRecCount )
-            << CDSSTRESS_STAT_OUT( s, m_nReleasePubRecCount );
+            << static_cast<cds::algo::flat_combining::stat<> const&>( s );
     }
 
     static inline property_stream& operator <<( property_stream& o, cds::container::fcdeque::empty_stat const& /*s*/ )
@@ -484,16 +470,7 @@ namespace cds_test {
             << CDSSTRESS_STAT_OUT( s, m_nPopBack )
             << CDSSTRESS_STAT_OUT( s, m_nFailedPopBack )
             << CDSSTRESS_STAT_OUT( s, m_nCollided )
-            << CDSSTRESS_STAT_OUT_( "combining_factor", s.combining_factor() )
-            << CDSSTRESS_STAT_OUT( s, m_nOperationCount )
-            << CDSSTRESS_STAT_OUT( s, m_nCombiningCount )
-            << CDSSTRESS_STAT_OUT( s, m_nCompactPublicationList )
-            << CDSSTRESS_STAT_OUT( s, m_nDeactivatePubRecord )
-            << CDSSTRESS_STAT_OUT( s, m_nActivatePubRecord )
-            << CDSSTRESS_STAT_OUT( s, m_nPubRecordCreated )
-            << CDSSTRESS_STAT_OUT( s, m_nPubRecordDeteted )
-            << CDSSTRESS_STAT_OUT( s, m_nAcquirePubRecCount )
-            << CDSSTRESS_STAT_OUT( s, m_nReleasePubRecCount );
+            << static_cast<cds::algo::flat_combining::stat<> const&>(s);
     }
 } // namespace cds_test