Renamed "ensure" to "update" in statistics
[libcds.git] / cds / container / feldman_hashmap_rcu.h
index 7ad23b84912529b36f65c6584f9f4b6f646d38a5..bff5113b76d6ab51d0c4aff059a8a94f72b28fb3 100644 (file)
@@ -1,4 +1,32 @@
-//$$CDS-header$$
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    Source code repo: http://github.com/khizmax/libcds/
+    Download: http://sourceforge.net/projects/libcds/files/
+    
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
+*/
 
 #ifndef CDSLIB_CONTAINER_FELDMAN_HASHMAP_RCU_H
 #define CDSLIB_CONTAINER_FELDMAN_HASHMAP_RCU_H
@@ -81,12 +109,15 @@ namespace cds { namespace container {
         typedef typename traits::allocator      allocator;      ///< Element allocator
         typedef typename traits::node_allocator node_allocator; ///< Array node allocator
         typedef typename traits::memory_model   memory_model;   ///< Memory model
-        typedef typename traits::back_off       back_off;       ///< Backoff strategy
+        typedef typename traits::back_off       back_off;       ///< Back-off strategy
         typedef typename traits::stat           stat;           ///< Internal statistics type
         typedef typename traits::rcu_check_deadlock rcu_check_deadlock; ///< Deadlock checking policy
         typedef typename gc::scoped_lock       rcu_lock;        ///< RCU scoped lock
         static CDS_CONSTEXPR const bool c_bExtractLockExternal = false; ///< Group of \p extract_xxx functions does not require external locking
 
+        /// Level statistics
+        typedef feldman_hashmap::level_statistics level_statistics;
+
     protected:
         //@cond
         typedef typename maker::node_type node_type;
@@ -451,7 +482,7 @@ namespace cds { namespace container {
         /// Delete \p key from the map
         /**
             \p key_type must be constructible from value of type \p K.
-            The function deeltes the element with hash value equal to <tt>hash( key_type( key ))</tt>
+            The function deletes the element with hash value equal to <tt>hash( key_type( key ))</tt>
 
             Return \p true if \p key is found and deleted, \p false otherwise.
 
@@ -640,7 +671,13 @@ namespace cds { namespace container {
         }
 
         /// Collects tree level statistics into \p stat
-        /** @copydetails cds::intrusive::FeldmanHashSet::get_level_statistics
+        /**
+            The function traverses the set and collects statistics for each level of the tree
+            into \p feldman_hashset::level_statistics struct. The element of \p stat[i]
+            represents statistics for level \p i, level 0 is head array.
+            The function is thread-safe and may be called in multi-threaded environment.
+
+            Result can be useful for estimating efficiency of hash functor you use.
         */
         void get_level_statistics(std::vector< feldman_hashmap::level_statistics>& stat) const
         {
@@ -680,7 +717,7 @@ namespace cds { namespace container {
                     i->second.payload++;
                 }
             } // at this point RCU lock is released
-            /endcode
+            \endcode
 
             Each iterator object supports the common interface:
             - dereference operators: