From: khizmax Date: Tue, 14 Apr 2015 15:04:27 +0000 (+0300) Subject: On integration: Added more stats to Bronson's tree X-Git-Tag: v2.1.0~259 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1702de791aae88d532fcfb176fbf0cf96230c565;p=libcds.git On integration: Added more stats to Bronson's tree --- 1702de791aae88d532fcfb176fbf0cf96230c565 diff --cc cds/container/details/bronson_avltree_base.h index cf52bda2,cf52bda2..85e220d9 --- a/cds/container/details/bronson_avltree_base.h +++ b/cds/container/details/bronson_avltree_base.h @@@ -195,9 -195,9 +195,14 @@@ namespace cds { namespace container event_counter m_nDisposedNode; ///< Count of disposed node event_counter m_nDisposedValue; ///< Count of disposed value event_counter m_nExtractedValue; ///< Count of extracted value ++ event_counter m_nRemoveSuccess; ///< Count of successfully \p erase() call ++ event_counter m_nRemoveFailed; ///< Count of failed \p erase() call event_counter m_nRemoveRetry; ///< Count o erase/extract retries ++ event_counter m_nExtractSuccess; ///< Count of successfully \p extract() call ++ event_counter m_nExtractFailed; ///< Count of failed \p extract() call event_counter m_nRemoveWaitShrinking; ///< ount of waiting until shrinking completed during \p erase() or \p extract() call event_counter m_nRemoveRootWaitShrinking; ///< Count of waiting until root shrinking completed duting \p erase() or \p extract() call ++ event_counter m_nMakeRoutingNode; ///< How many nodes were converted to routing (valueless) nodes event_counter m_nRightRotation; ///< Count of single right rotation event_counter m_nLeftRotation; ///< Count of single left rotation @@@ -238,9 -238,9 +243,24 @@@ void onDisposeNode() { ++m_nDisposedNode; } void onDisposeValue() { ++m_nDisposedValue; } void onExtractValue() { ++m_nExtractedValue; } ++ void onRemove(bool bSuccess) ++ { ++ if ( bSuccess ) ++ ++m_nRemoveSuccess; ++ else ++ ++m_nRemoveFailed; ++ } ++ void onExtract( bool bSuccess ) ++ { ++ if ( bSuccess ) ++ ++m_nExtractSuccess; ++ else ++ ++m_nExtractFailed; ++ } void onRemoveRetry() { ++m_nRemoveRetry; } void onRemoveWaitShrinking() { ++m_nRemoveWaitShrinking; } void onRemoveRootWaitShrinking() { ++m_nRemoveRootWaitShrinking; } ++ void onMakeRoutingNode() { ++m_nMakeRoutingNode; } void onRotateRight() { ++m_nRightRotation; } void onRotateLeft() { ++m_nLeftRotation; } @@@ -285,9 -285,9 +305,12 @@@ void onDisposeNode() const {} void onDisposeValue() const {} void onExtractValue() const {} ++ void onRemove(bool /*bSuccess*/) const {} ++ void onExtract(bool /*bSuccess*/) const {} void onRemoveRetry() const {} void onRemoveWaitShrinking() const {} void onRemoveRootWaitShrinking() const {} ++ void onMakeRoutingNode() const {} void onRotateRight() const {} void onRotateLeft() const {} diff --cc cds/container/impl/bronson_avltree_map_rcu.h index c623c467,c623c467..82eb8c17 --- a/cds/container/impl/bronson_avltree_map_rcu.h +++ b/cds/container/impl/bronson_avltree_map_rcu.h @@@ -884,8 -884,8 +884,10 @@@ namespace cds { namespace container if ( result == update_flags::retry ) m_stat.onRemoveRetry(); -- else ++ else { ++ m_stat.onExtract( result == update_flags::result_removed ); return; ++ } } } } @@@ -899,6 -899,6 +901,7 @@@ key_comparator(), [&pExtracted]( key_type const&, mapped_type pVal, rcu_disposer& ) -> bool { pExtracted = pVal; return false; } ); ++ m_stat.onExtract( pExtracted != nullptr ); return pExtracted; } @@@ -912,6 -912,6 +915,7 @@@ cds::opt::details::make_comparator_from_less(), [&pExtracted]( key_type const&, mapped_type pVal, rcu_disposer& ) -> bool { pExtracted = pVal; return false; } ); ++ m_stat.onExtract( pExtracted != nullptr ); return pExtracted; } //@endcond @@@ -1175,8 -1175,8 +1179,10 @@@ if ( result == update_flags::retry ) m_stat.onRemoveRetry(); -- else ++ else { ++ m_stat.onRemove( result == update_flags::result_removed ); return result == update_flags::result_removed; ++ } } } @@@ -1766,6 -1766,6 +1772,7 @@@ return update_flags::failed; pNode->m_pValue.store( nullptr, memory_model::memory_order_relaxed ); ++ m_stat.onMakeRoutingNode(); } --m_ItemCounter; diff --cc tests/unit/print_bronsonavltree_stat.h index e1c6996c,e1c6996c..84d815d1 --- a/tests/unit/print_bronsonavltree_stat.h +++ b/tests/unit/print_bronsonavltree_stat.h @@@ -28,9 -28,9 +28,14 @@@ namespace std << "\t\t m_nUpdateRootWaitShrinking: " << s.m_nUpdateRootWaitShrinking.get() << "\n" << "\t\t m_nUpdateSuccess: " << s.m_nUpdateSuccess.get() << "\n" << "\t\t m_nUpdateUnlinked: " << s.m_nUpdateUnlinked.get() << "\n" ++ << "\t\t m_nRemoveSuccess: " << s.m_nRemoveSuccess.get() << "\n" ++ << "\t\t m_nRemoveFailed: " << s.m_nRemoveFailed.get() << "\n" << "\t\t m_nRemoveRetry: " << s.m_nRemoveRetry.get() << "\n" ++ << "\t\t m_nExtractSuccess: " << s.m_nExtractSuccess.get() << "\n" ++ << "\t\t m_nExtractFailed: " << s.m_nExtractFailed.get() << "\n" << "\t\t m_nRemoveWaitShrinking: " << s.m_nRemoveWaitShrinking.get() << "\n" << "\t\t m_nRemoveRootWaitShrinking: " << s.m_nRemoveRootWaitShrinking.get() << "\n" ++ << "\t\t m_nMakeRoutingNode: " << s.m_nMakeRoutingNode.get() << "\n" << "\t\t m_nDisposedValue: " << s.m_nDisposedValue.get() << "\n" << "\t\t m_nDisposedNode: " << s.m_nDisposedNode.get() << "\n" << "\t\t m_nExtractedValue: " << s.m_nExtractedValue.get() << "\n"