From 51169cef24d316a2ae385136c2d5f05496d5d56f Mon Sep 17 00:00:00 2001 From: khizmax Date: Tue, 3 May 2016 08:25:40 +0300 Subject: [PATCH] Renamed "ensure" to "update" in statistics --- cds/container/michael_kvlist_rcu.h | 2 +- cds/container/michael_set_rcu.h | 29 ------------------- cds/container/split_list_set_rcu.h | 2 +- cds/intrusive/details/ellen_bintree_base.h | 18 ++++++------ cds/intrusive/details/split_list_base.h | 12 ++++---- cds/intrusive/ellen_bintree_rcu.h | 6 ++-- cds/intrusive/impl/ellen_bintree.h | 6 ++-- cds/intrusive/split_list.h | 4 +-- cds/intrusive/split_list_nogc.h | 4 +-- cds/intrusive/split_list_rcu.h | 4 +-- test/include/cds_test/stat_ellenbintree_out.h | 6 ++-- tests/unit/map2/map_delodd.h | 2 +- tests/unit/print_ellenbintree_stat.h | 6 ++-- tests/unit/print_split_list_stat.h | 4 +-- tests/unit/set2/set_insdel_func.cpp | 2 +- 15 files changed, 39 insertions(+), 68 deletions(-) diff --git a/cds/container/michael_kvlist_rcu.h b/cds/container/michael_kvlist_rcu.h index 6b80b9e1..f90b696d 100644 --- a/cds/container/michael_kvlist_rcu.h +++ b/cds/container/michael_kvlist_rcu.h @@ -448,7 +448,7 @@ namespace cds { namespace container { return insert_with_at( head(), key, func ); } - /// Ensures that the \p key exists in the list + /// Updates an element with given \p key /** The operation performs inserting or changing data with lock-free manner. diff --git a/cds/container/michael_set_rcu.h b/cds/container/michael_set_rcu.h index 5afd9a57..53e43fd8 100644 --- a/cds/container/michael_set_rcu.h +++ b/cds/container/michael_set_rcu.h @@ -384,36 +384,7 @@ namespace cds { namespace container { return bRet; } - /// Ensures that the item exists in the set - /** - The operation performs inserting or changing data with lock-free manner. - - If the \p val key not found in the set, then the new item created from \p val - is inserted into the set. Otherwise, the functor \p func is called with the item found. - The functor \p Func signature is: - \code - struct my_functor { - void operator()( bool bNew, value_type& item, const Q& val ); - }; - \endcode - - with arguments: - - \p bNew - \p true if the item has been inserted, \p false otherwise - - \p item - item of the set - - \p val - argument \p key passed into the \p ensure function - The functor may change non-key fields of the \p item. - - The function applies RCU lock internally. - - Returns std::pair where \p first is true if operation is successfull, - \p second is true if new item has been added or \p false if the item with \p key - already is in the set. - - @warning For \ref cds_nonintrusive_MichaelList_rcu "MichaelList" as the bucket see \ref cds_intrusive_item_creating "insert item troubleshooting". - \ref cds_nonintrusive_LazyList_rcu "LazyList" provides exclusive access to inserted item and does not require any node-level - synchronization. - */ /// Updates the element /** The operation performs inserting or changing data with lock-free manner. diff --git a/cds/container/split_list_set_rcu.h b/cds/container/split_list_set_rcu.h index c2625cf9..819c4e5b 100644 --- a/cds/container/split_list_set_rcu.h +++ b/cds/container/split_list_set_rcu.h @@ -605,7 +605,7 @@ namespace cds { namespace container { return insert_node( alloc_node( std::forward(args)...)); } - /// Ensures that the \p val exists in the set + /// Updates an element with given \p val /** The operation performs inserting or changing data with lock-free manner. diff --git a/cds/intrusive/details/ellen_bintree_base.h b/cds/intrusive/details/ellen_bintree_base.h index 3b04a962..a19b67d1 100644 --- a/cds/intrusive/details/ellen_bintree_base.h +++ b/cds/intrusive/details/ellen_bintree_base.h @@ -374,9 +374,9 @@ namespace cds { namespace intrusive { event_counter m_nInsertSuccess ; ///< Count of success insertion event_counter m_nInsertFailed ; ///< Count of failed insertion event_counter m_nInsertRetries ; ///< Count of unsuccessful retries of insertion - event_counter m_nEnsureExist ; ///< Count of \p ensure call for existed node - event_counter m_nEnsureNew ; ///< Count of \p ensure call for new node - event_counter m_nEnsureRetries ; ///< Count of unsuccessful retries of ensuring + event_counter m_nUpdateExist ; ///< Count of \p update() call for existed node + event_counter m_nUpdateNew ; ///< Count of \p update() call for new node + event_counter m_nUpdateRetries ; ///< Count of unsuccessful retries of ensuring event_counter m_nEraseSuccess ; ///< Count of successful call of \p erase and \p unlink event_counter m_nEraseFailed ; ///< Count of failed call of \p erase and \p unlink event_counter m_nEraseRetries ; ///< Count of unsuccessful retries inside erasing/unlinking @@ -404,9 +404,9 @@ namespace cds { namespace intrusive { void onInsertSuccess() { ++m_nInsertSuccess ; } void onInsertFailed() { ++m_nInsertFailed ; } void onInsertRetry() { ++m_nInsertRetries ; } - void onEnsureExist() { ++m_nEnsureExist ; } - void onEnsureNew() { ++m_nEnsureNew ; } - void onEnsureRetry() { ++m_nEnsureRetries ; } + void onUpdateExist() { ++m_nUpdateExist ; } + void onUpdateNew() { ++m_nUpdateNew ; } + void onUpdateRetry() { ++m_nUpdateRetries ; } void onEraseSuccess() { ++m_nEraseSuccess ; } void onEraseFailed() { ++m_nEraseFailed ; } void onEraseRetry() { ++m_nEraseRetries ; } @@ -437,9 +437,9 @@ namespace cds { namespace intrusive { void onInsertSuccess() const {} void onInsertFailed() const {} void onInsertRetry() const {} - void onEnsureExist() const {} - void onEnsureNew() const {} - void onEnsureRetry() const {} + void onUpdateExist() const {} + void onUpdateNew() const {} + void onUpdateRetry() const {} void onEraseSuccess() const {} void onEraseFailed() const {} void onEraseRetry() const {} diff --git a/cds/intrusive/details/split_list_base.h b/cds/intrusive/details/split_list_base.h index 40b5f102..8f90aa25 100644 --- a/cds/intrusive/details/split_list_base.h +++ b/cds/intrusive/details/split_list_base.h @@ -94,8 +94,8 @@ namespace cds { namespace intrusive { counter_type m_nInsertSuccess; ///< Count of success inserting counter_type m_nInsertFailed; ///< Count of failed inserting - counter_type m_nEnsureNew; ///< Count of new item created by \p ensure() member function - counter_type m_nEnsureExist; ///< Count of \p ensure() call for existing item + counter_type m_nUpdateNew; ///< Count of new item created by \p ensure() member function + counter_type m_nUpdateExist; ///< Count of \p ensure() call for existing item counter_type m_nEraseSuccess; ///< Count of success erasing of items counter_type m_nEraseFailed; ///< Count of attempts to erase unknown item counter_type m_nExtractSuccess; ///< Count of success extracting of items @@ -112,8 +112,8 @@ namespace cds { namespace intrusive { //@cond void onInsertSuccess() { ++m_nInsertSuccess; } void onInsertFailed() { ++m_nInsertFailed; } - void onEnsureNew() { ++m_nEnsureNew; } - void onEnsureExist() { ++m_nEnsureExist; } + void onUpdateNew() { ++m_nUpdateNew; } + void onUpdateExist() { ++m_nUpdateExist; } void onEraseSuccess() { ++m_nEraseSuccess; } void onEraseFailed() { ++m_nEraseFailed; } void onExtractSuccess() { ++m_nExtractSuccess; } @@ -142,8 +142,8 @@ namespace cds { namespace intrusive { //@cond void onInsertSuccess() const {} void onInsertFailed() const {} - void onEnsureNew() const {} - void onEnsureExist() const {} + void onUpdateNew() const {} + void onUpdateExist() const {} void onEraseSuccess() const {} void onEraseFailed() const {} void onExtractSuccess() const {} diff --git a/cds/intrusive/ellen_bintree_rcu.h b/cds/intrusive/ellen_bintree_rcu.h index fc3cfbc5..edfaf235 100644 --- a/cds/intrusive/ellen_bintree_rcu.h +++ b/cds/intrusive/ellen_bintree_rcu.h @@ -848,7 +848,7 @@ namespace cds { namespace intrusive { func( false, *node_traits::to_value_ptr( res.pLeaf ), val ); if ( pNewInternal.get()) m_Stat.onInternalNodeDeleted() ; // unique_internal_node_ptr deletes internal node - m_Stat.onEnsureExist(); + m_Stat.onUpdateExist(); return std::make_pair( true, false ); } @@ -869,12 +869,12 @@ namespace cds { namespace intrusive { help( res.updParent, updRetire ); bkoff(); - m_Stat.onEnsureRetry(); + m_Stat.onUpdateRetry(); } } ++m_ItemCounter; - m_Stat.onEnsureNew(); + m_Stat.onUpdateNew(); return std::make_pair( true, true ); } diff --git a/cds/intrusive/impl/ellen_bintree.h b/cds/intrusive/impl/ellen_bintree.h index fa1e1c68..7ed69b23 100644 --- a/cds/intrusive/impl/ellen_bintree.h +++ b/cds/intrusive/impl/ellen_bintree.h @@ -437,7 +437,7 @@ namespace cds { namespace intrusive { func( false, *node_traits::to_value_ptr( res.pLeaf ), val ); if ( pNewInternal.get() ) m_Stat.onInternalNodeDeleted() ; // unique_internal_node_ptr deletes internal node - m_Stat.onEnsureExist(); + m_Stat.onUpdateExist(); return std::make_pair( true, false ); } @@ -456,11 +456,11 @@ namespace cds { namespace intrusive { } bkoff(); - m_Stat.onEnsureRetry(); + m_Stat.onUpdateRetry(); } ++m_ItemCounter; - m_Stat.onEnsureNew(); + m_Stat.onUpdateNew(); return std::make_pair( true, true ); } //@cond diff --git a/cds/intrusive/split_list.h b/cds/intrusive/split_list.h index 2e461795..832534c7 100644 --- a/cds/intrusive/split_list.h +++ b/cds/intrusive/split_list.h @@ -754,10 +754,10 @@ namespace cds { namespace intrusive { std::pair bRet = m_List.update_at( pHead, val, func, bAllowInsert ); if ( bRet.first && bRet.second ) { inc_item_count(); - m_Stat.onEnsureNew(); + m_Stat.onUpdateNew(); } else - m_Stat.onEnsureExist(); + m_Stat.onUpdateExist(); return bRet; } //@cond diff --git a/cds/intrusive/split_list_nogc.h b/cds/intrusive/split_list_nogc.h index b93ce400..41066182 100644 --- a/cds/intrusive/split_list_nogc.h +++ b/cds/intrusive/split_list_nogc.h @@ -660,10 +660,10 @@ namespace cds { namespace intrusive { if ( ret.first != m_List.end() ) { if ( ret.second ) { inc_item_count(); - m_Stat.onEnsureNew(); + m_Stat.onUpdateNew(); } else - m_Stat.onEnsureExist(); + m_Stat.onUpdateExist(); return std::make_pair( iterator(ret.first, m_List.end()), ret.second ); } return std::make_pair( end(), ret.second ); diff --git a/cds/intrusive/split_list_rcu.h b/cds/intrusive/split_list_rcu.h index e17a0230..e27c64d8 100644 --- a/cds/intrusive/split_list_rcu.h +++ b/cds/intrusive/split_list_rcu.h @@ -636,10 +636,10 @@ namespace cds { namespace intrusive { std::pair bRet = m_List.update_at( pHead, val, func, bAllowInsert ); if ( bRet.first && bRet.second ) { inc_item_count(); - m_Stat.onEnsureNew(); + m_Stat.onUpdateNew(); } else - m_Stat.onEnsureExist(); + m_Stat.onUpdateExist(); return bRet; } //@cond diff --git a/test/include/cds_test/stat_ellenbintree_out.h b/test/include/cds_test/stat_ellenbintree_out.h index e9c8657c..5d74b430 100644 --- a/test/include/cds_test/stat_ellenbintree_out.h +++ b/test/include/cds_test/stat_ellenbintree_out.h @@ -53,9 +53,9 @@ namespace cds_test { << CDSSTRESS_STAT_OUT( s, m_nInsertSuccess ) << CDSSTRESS_STAT_OUT( s, m_nInsertFailed ) << CDSSTRESS_STAT_OUT( s, m_nInsertRetries ) - << CDSSTRESS_STAT_OUT( s, m_nEnsureExist ) - << CDSSTRESS_STAT_OUT( s, m_nEnsureNew ) - << CDSSTRESS_STAT_OUT( s, m_nEnsureRetries ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateExist ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateNew ) + << CDSSTRESS_STAT_OUT( s, m_nUpdateRetries ) << CDSSTRESS_STAT_OUT( s, m_nEraseSuccess ) << CDSSTRESS_STAT_OUT( s, m_nEraseFailed ) << CDSSTRESS_STAT_OUT( s, m_nEraseRetries ) diff --git a/tests/unit/map2/map_delodd.h b/tests/unit/map2/map_delodd.h index 97bf8849..354884fa 100644 --- a/tests/unit/map2/map_delodd.h +++ b/tests/unit/map2/map_delodd.h @@ -810,7 +810,7 @@ namespace map2 { //CDSUNIT_DECLARE_FeldmanHashMap_city CDSUNIT_DECLARE_CuckooMap - CPPUNIT_TEST_SUITE(Map_DelOdd) + CPPUNIT_TEST_SUITE_(Map_DelOdd, "map_delodd") CDSUNIT_TEST_MichaelMap CDSUNIT_TEST_SplitList CDSUNIT_TEST_SkipListMap diff --git a/tests/unit/print_ellenbintree_stat.h b/tests/unit/print_ellenbintree_stat.h index 76cece52..b48e938b 100644 --- a/tests/unit/print_ellenbintree_stat.h +++ b/tests/unit/print_ellenbintree_stat.h @@ -52,9 +52,9 @@ namespace std { << "\t\t m_nInsertSuccess: " << s.m_nInsertSuccess.get() << "\n" << "\t\t m_nInsertFailed: " << s.m_nInsertFailed.get() << "\n" << "\t\t m_nInsertRetries: " << s.m_nInsertRetries.get() << "\n" - << "\t\t m_nEnsureExist: " << s.m_nEnsureExist.get() << "\n" - << "\t\t m_nEnsureNew: " << s.m_nEnsureNew.get() << "\n" - << "\t\t m_nEnsureRetries: " << s.m_nEnsureRetries.get() << "\n" + << "\t\t m_nUpdateExist: " << s.m_nUpdateExist.get() << "\n" + << "\t\t m_nUpdateNew: " << s.m_nUpdateNew.get() << "\n" + << "\t\t m_nUpdateRetries: " << s.m_nUpdateRetries.get() << "\n" << "\t\t m_nEraseSuccess: " << s.m_nEraseSuccess.get() << "\n" << "\t\t m_nEraseFailed: " << s.m_nEraseFailed.get() << "\n" << "\t\t m_nEraseRetries: " << s.m_nEraseRetries.get() << "\n" diff --git a/tests/unit/print_split_list_stat.h b/tests/unit/print_split_list_stat.h index bcf11837..a69bb854 100644 --- a/tests/unit/print_split_list_stat.h +++ b/tests/unit/print_split_list_stat.h @@ -42,8 +42,8 @@ namespace std { o << "Split-list stat [cds::intrusive::split_list::stat]\n" << "\t\t m_nInsertSuccess: " << s.m_nInsertSuccess.get() << "\n" << "\t\t m_nInsertFailed: " << s.m_nInsertFailed.get() << "\n" - << "\t\t m_nEnsureExist: " << s.m_nEnsureExist.get() << "\n" - << "\t\t m_nEnsureNew: " << s.m_nEnsureNew.get() << "\n" + << "\t\t m_nUpdateExist: " << s.m_nUpdateExist.get() << "\n" + << "\t\t m_nUpdateNew: " << s.m_nUpdateNew.get() << "\n" << "\t\t m_nEraseSuccess: " << s.m_nEraseSuccess.get() << "\n" << "\t\t m_nEraseFailed: " << s.m_nEraseFailed.get() << "\n" << "\t\t m_nExtractSuccess: " << s.m_nExtractSuccess.get() << "\n" diff --git a/tests/unit/set2/set_insdel_func.cpp b/tests/unit/set2/set_insdel_func.cpp index d67853d0..ffd5d171 100644 --- a/tests/unit/set2/set_insdel_func.cpp +++ b/tests/unit/set2/set_insdel_func.cpp @@ -38,7 +38,7 @@ namespace set2 { c_nSetSize = cfg.getSizeT("MapSize", c_nSetSize ); c_nInsertThreadCount = cfg.getSizeT("InsertThreadCount", c_nInsertThreadCount ); c_nDeleteThreadCount = cfg.getSizeT("DeleteThreadCount", c_nDeleteThreadCount ); - c_nUpdateThreadCount = cfg.getSizeT("EnsureThreadCount", c_nUpdateThreadCount ); + c_nUpdateThreadCount = cfg.getSizeT("UpdateThreadCount", c_nUpdateThreadCount ); c_nThreadPassCount = cfg.getSizeT("ThreadPassCount", c_nThreadPassCount ); c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor ); c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState ); -- 2.34.1