docfix
[libcds.git] / cds / gc / hp.h
index a9b289139d2687d5fd8201fe41fa5b375fe522d5..aedc47b064bada56c3a78c0ec95627d734309319 100644 (file)
@@ -33,6 +33,8 @@
 
 #include <exception>
 #include <cds/gc/details/hp_common.h>
+#include <cds/details/lib.h>
+#include <cds/threading/model.h>
 #include <cds/details/throw_exception.h>
 #include <cds/details/static_functor.h>
 #include <cds/details/marked_ptr.h>
@@ -347,18 +349,28 @@ namespace cds { namespace gc {
             thread_hp_storage   hazards_;   ///< Hazard pointers private to the thread
             retired_array       retired_;   ///< Retired data private to the thread
 
-            stat                stat_;      ///< Internal statistics for the thread
-
             char pad1_[cds::c_nCacheLineSize];
             atomics::atomic<unsigned int> sync_; ///< dummy var to introduce synchronizes-with relationship between threads
             char pad2_[cds::c_nCacheLineSize];
 
+#       ifdef CDS_ENABLE_HPSTAT
+            // Internal statistics:
+            size_t              free_count_;
+            size_t              scan_count_;
+            size_t              help_scan_count_;
+#       endif
+
             // CppCheck warn: pad1_ and pad2_ is uninitialized in ctor
             // cppcheck-suppress uninitMemberVar
             thread_data( guard* guards, size_t guard_count, retired_ptr* retired_arr, size_t retired_capacity )
                 : hazards_( guards, guard_count )
                 , retired_( retired_arr, retired_capacity )
                 , sync_(0)
+#       ifdef CDS_ENABLE_HPSTAT
+                , free_count_(0)
+                , scan_count_(0)
+                , help_scan_count_(0)
+#       endif
             {}
 
             thread_data() = delete;
@@ -1457,7 +1469,7 @@ namespace cds { namespace gc {
             The function clears \p st before gathering statistics.
 
             @note Internal statistics is available only if you compile
-            \p libcds and your program with \p -DCDS_ENABLE_HPSTAT key.
+            \p libcds and your program with \p -DCDS_ENABLE_HPSTAT.
         */
         static void statistics( stat& st )
         {
@@ -1470,7 +1482,7 @@ namespace cds { namespace gc {
             and can be accessible after destructing the global \p %HP object.
 
             @note Internal statistics is available only if you compile
-            \p libcds and your program with \p -DCDS_ENABLE_HPSTAT key.
+            \p libcds and your program with \p -DCDS_ENABLE_HPSTAT.
 
             Usage:
             \code
@@ -1490,13 +1502,13 @@ namespace cds { namespace gc {
                 cds::gc::HP::stat const& st = cds::gc::HP::postmortem_statistics();
 
                 printf( "HP statistics:\n"
-                    "\tthread count           = %llu\n"
-                    "\tguard allocated        = %llu\n"
-                    "\tguard freed            = %llu\n"
-                    "\tretired data count     = %llu\n"
-                    "\tfree data count        = %llu\n"
-                    "\tscan() call count      = %llu\n"
-                    "\thelp_scan() call count = %llu\n",
+                    "  thread count           = %llu\n"
+                    "  guard allocated        = %llu\n"
+                    "  guard freed            = %llu\n"
+                    "  retired data count     = %llu\n"
+                    "  free data count        = %llu\n"
+                    "  scan() call count      = %llu\n"
+                    "  help_scan() call count = %llu\n",
                     st.thread_rec_count,
                     st.guard_allocated, st.guard_freed,
                     st.retired_count, st.free_count,