From: khizmax Date: Sun, 25 Dec 2016 13:59:15 +0000 (+0300) Subject: SkipList: added a statistical measure X-Git-Tag: v2.2.0~17 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3bc84990e83d348f5e7b37e3d19204191a724d0c;p=libcds.git SkipList: added a statistical measure --- diff --git a/cds/intrusive/details/skip_list_base.h b/cds/intrusive/details/skip_list_base.h index dbc3a272..97d30e30 100644 --- a/cds/intrusive/details/skip_list_base.h +++ b/cds/intrusive/details/skip_list_base.h @@ -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 }; diff --git a/cds/intrusive/impl/skip_list.h b/cds/intrusive/impl/skip_list.h index db291380..c3b38f0e 100644 --- a/cds/intrusive/impl/skip_list.h +++ b/cds/intrusive/impl/skip_list.h @@ -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(); diff --git a/cds/intrusive/skip_list_rcu.h b/cds/intrusive/skip_list_rcu.h index 52dccdd7..24a12cee 100644 --- a/cds/intrusive/skip_list_rcu.h +++ b/cds/intrusive/skip_list_rcu.h @@ -1720,6 +1720,7 @@ namespace cds { namespace intrusive { } else if ( p.bits() ) { // Another thread is deleting pDel right now + m_Stat.onEraseContention(); return false; } diff --git a/test/include/cds_test/stat_skiplist_out.h b/test/include/cds_test/stat_skiplist_out.h index 69f3894c..d263130a 100644 --- a/test/include/cds_test/stat_skiplist_out.h +++ b/test/include/cds_test/stat_skiplist_out.h @@ -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