On integration: Added more stats to Bronson's tree
authorkhizmax <khizmax@gmail.com>
Tue, 14 Apr 2015 15:04:27 +0000 (18:04 +0300)
committerkhizmax <khizmax@gmail.com>
Tue, 14 Apr 2015 15:04:27 +0000 (18:04 +0300)
1  2 
cds/container/details/bronson_avltree_base.h
cds/container/impl/bronson_avltree_map_rcu.h
tests/unit/print_bronsonavltree_stat.h

index cf52bda265cfa47b4f8358a3e2892d6e408b6115,cf52bda265cfa47b4f8358a3e2892d6e408b6115..85e220d9fc4b29661bc2aa1e3ba6685cea39bd60
@@@ -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
              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; }
              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 {}
index c623c467b7bcb558d2a53b3f49f7cb8ca2ae4773,c623c467b7bcb558d2a53b3f49f7cb8ca2ae4773..82eb8c173ba355095bc84ab83c1e10d539d7adc0
@@@ -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;
++                    }
                  }
              }
          }
                  key_comparator(),
                  [&pExtracted]( key_type const&, mapped_type pVal, rcu_disposer& ) -> bool { pExtracted = pVal; return false; }
              );
++            m_stat.onExtract( pExtracted != nullptr );
              return pExtracted;
          }
  
                  cds::opt::details::make_comparator_from_less<Less>(),
                  [&pExtracted]( key_type const&, mapped_type pVal, rcu_disposer& ) -> bool { pExtracted = pVal; return false; }
              );
++            m_stat.onExtract( pExtracted != nullptr );
              return pExtracted;
          }
          //@endcond
  
                  if ( result == update_flags::retry )
                      m_stat.onRemoveRetry();
--                else
++                else {
++                    m_stat.onRemove( result == update_flags::result_removed );
                      return result == update_flags::result_removed;
++                }
              }
          }
  
                          return update_flags::failed;
  
                      pNode->m_pValue.store( nullptr, memory_model::memory_order_relaxed );
++                    m_stat.onMakeRoutingNode();
                  }
  
                  --m_ItemCounter;
index e1c6996c790d6146d7a3268477704bb33cf868d2,e1c6996c790d6146d7a3268477704bb33cf868d2..84d815d18a0207cdc8a0cff2ca5c30cfda04b2e4
@@@ -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"