SkipList: added a statistical measure
authorkhizmax <libcds.dev@gmail.com>
Sun, 25 Dec 2016 13:59:15 +0000 (16:59 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sun, 25 Dec 2016 13:59:15 +0000 (16:59 +0300)
cds/intrusive/details/skip_list_base.h
cds/intrusive/impl/skip_list.h
cds/intrusive/skip_list_rcu.h
test/include/cds_test/stat_skiplist_out.h

index dbc3a272fedfa21ae47fdffca67c20c2c5aa12e7..97d30e3058646f675a19e1e31977fdc78bfbdb7c 100644 (file)
@@ -423,6 +423,7 @@ namespace cds { namespace intrusive {
             event_counter   m_nEraseWhileFind       ; ///< Count of erased item while searching
             event_counter   m_nExtractWhileFind     ; ///< Count of extracted item while searching (RCU only)
             event_counter   m_nMarkFailed           ; ///< Count of failed node marking (logical deletion mark)
+            event_counter   m_nEraseContention      ; ///< Count of key erasing contention encountered
 
             //@cond
             void onAddNode( unsigned int nHeight )
@@ -472,6 +473,7 @@ namespace cds { namespace intrusive {
             void onExtractMaxFailed()       { ++m_nExtractMaxFailed;  }
             void onExtractMaxRetry()        { ++m_nExtractMaxRetries; }
             void onMarkFailed()             { ++m_nMarkFailed;        }
+            void onEraseContention()        { ++m_nEraseContention;   }
             //@endcond
         };
 
@@ -516,6 +518,7 @@ namespace cds { namespace intrusive {
             void onExtractMaxFailed()       const {}
             void onExtractMaxRetry()        const {}
             void onMarkFailed()             const {}
+            void onEraseContention()        const {}
             //@endcond
         };
 
index db291380ded5bc49bb888aba59dd936aeb590e3d..c3b38f0e47682eba17dc1825f27784d0dbb925c4 100644 (file)
@@ -1453,8 +1453,9 @@ namespace cds { namespace intrusive {
                     m_Stat.onFastErase();
                     return true;
                 }
-                else if ( p.bits() ) {
+                else if ( p.bits()) {
                     // Another thread is deleting pDel right now
+                    m_Stat.onEraseContention();
                     return false;
                 }
                 m_Stat.onEraseRetry();
index 52dccdd76b6a95adbdf667020090d26750845e3e..24a12ceeff5171108a7489eeab1695ba23618b3a 100644 (file)
@@ -1720,6 +1720,7 @@ namespace cds { namespace intrusive {
                 }
                 else if ( p.bits() ) {
                     // Another thread is deleting pDel right now
+                    m_Stat.onEraseContention();
                     return false;
                 }
 
index 69f3894c1dc62dc515a03a9248b2858d7a1018f4..d263130a10fe45e908a6fff92a8970a1fed2b101 100644 (file)
@@ -85,7 +85,8 @@ namespace cds_test {
             << CDSSTRESS_STAT_OUT( s, m_nSlowExtract )
             << CDSSTRESS_STAT_OUT( s, m_nEraseWhileFind )
             << CDSSTRESS_STAT_OUT( s, m_nExtractWhileFind )
-            << CDSSTRESS_STAT_OUT( s, m_nMarkFailed );
+            << CDSSTRESS_STAT_OUT( s, m_nMarkFailed )
+            << CDSSTRESS_STAT_OUT( s, m_nEraseContention );
     }
 
 } // namespace cds_test