#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>
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;
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 )
{
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
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,