mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
grouped foa::table_core cumulative stats in one member
This commit is contained in:
@ -1214,7 +1214,7 @@ private:
|
|||||||
if(BOOST_LIKELY(bool(this->pred()(x,this->key_from(p[n]))))){
|
if(BOOST_LIKELY(bool(this->pred()(x,this->key_from(p[n]))))){
|
||||||
f(pg,n,p+n);
|
f(pg,n,p+n);
|
||||||
BOOST_UNORDERED_ADD_STATS(
|
BOOST_UNORDERED_ADD_STATS(
|
||||||
this->successful_lookup_cumulative_stats(),
|
this->get_cumulative_stats().successful_lookup,
|
||||||
(pb.length(),num_cmps));
|
(pb.length(),num_cmps));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1224,15 +1224,14 @@ private:
|
|||||||
}
|
}
|
||||||
if(BOOST_LIKELY(pg->is_not_overflowed(hash))){
|
if(BOOST_LIKELY(pg->is_not_overflowed(hash))){
|
||||||
BOOST_UNORDERED_ADD_STATS(
|
BOOST_UNORDERED_ADD_STATS(
|
||||||
this->unsuccessful_lookup_cumulative_stats(),
|
this->get_cumulative_stats().unsuccessful_lookup,
|
||||||
(pb.length(),num_cmps));
|
(pb.length(),num_cmps));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while(BOOST_LIKELY(pb.next(this->arrays.groups_size_mask)));
|
while(BOOST_LIKELY(pb.next(this->arrays.groups_size_mask)));
|
||||||
BOOST_UNORDERED_ADD_STATS(
|
BOOST_UNORDERED_ADD_STATS(
|
||||||
this->unsuccessful_lookup_cumulative_stats(),
|
this->get_cumulative_stats().unsuccessful_lookup,(pb.length(),num_cmps));
|
||||||
(pb.length(),num_cmps));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1514,7 +1513,7 @@ private:
|
|||||||
rslot.commit();
|
rslot.commit();
|
||||||
rsize.commit();
|
rsize.commit();
|
||||||
BOOST_UNORDERED_ADD_STATS(
|
BOOST_UNORDERED_ADD_STATS(
|
||||||
this->insertion_cumulative_stats(),(pb.length()));
|
this->get_cumulative_stats().insertion,(pb.length()));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
pg->mark_overflow(hash);
|
pg->mark_overflow(hash);
|
||||||
|
@ -1133,6 +1133,13 @@ struct table_arrays
|
|||||||
#if defined(BOOST_UNORDERED_ENABLE_STATS)
|
#if defined(BOOST_UNORDERED_ENABLE_STATS)
|
||||||
/* stats support */
|
/* stats support */
|
||||||
|
|
||||||
|
struct table_core_cumulative_stats
|
||||||
|
{
|
||||||
|
cumulative_stats<1> insertion;
|
||||||
|
cumulative_stats<2> successful_lookup,
|
||||||
|
unsuccessful_lookup;
|
||||||
|
};
|
||||||
|
|
||||||
struct table_core_insertion_stats
|
struct table_core_insertion_stats
|
||||||
{
|
{
|
||||||
cumulative_stats_summary probe_length;
|
cumulative_stats_summary probe_length;
|
||||||
@ -1434,10 +1441,8 @@ public:
|
|||||||
using arrays_holder_type=arrays_holder<arrays_type,Allocator>;
|
using arrays_holder_type=arrays_holder<arrays_type,Allocator>;
|
||||||
|
|
||||||
#if defined(BOOST_UNORDERED_ENABLE_STATS)
|
#if defined(BOOST_UNORDERED_ENABLE_STATS)
|
||||||
|
using cumulative_stats=table_core_cumulative_stats;
|
||||||
using stats=table_core_stats;
|
using stats=table_core_stats;
|
||||||
using cumulative_insertion_stats=concurrent_cumulative_stats<1>;
|
|
||||||
using cumulative_successful_lookup_stats=concurrent_cumulative_stats<2>;
|
|
||||||
using cumulative_unsuccessful_lookup_stats=concurrent_cumulative_stats<2>;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
table_core(
|
table_core(
|
||||||
@ -1700,7 +1705,7 @@ public:
|
|||||||
auto n=unchecked_countr_zero(mask);
|
auto n=unchecked_countr_zero(mask);
|
||||||
if(BOOST_LIKELY(bool(pred()(x,key_from(p[n]))))){
|
if(BOOST_LIKELY(bool(pred()(x,key_from(p[n]))))){
|
||||||
BOOST_UNORDERED_ADD_STATS(
|
BOOST_UNORDERED_ADD_STATS(
|
||||||
successful_lookup_stats,(pb.length(),num_cmps));
|
get_cumulative_stats().successful_lookup,(pb.length(),num_cmps));
|
||||||
return {pg,n,p+n};
|
return {pg,n,p+n};
|
||||||
}
|
}
|
||||||
mask&=mask-1;
|
mask&=mask-1;
|
||||||
@ -1708,13 +1713,13 @@ public:
|
|||||||
}
|
}
|
||||||
if(BOOST_LIKELY(pg->is_not_overflowed(hash))){
|
if(BOOST_LIKELY(pg->is_not_overflowed(hash))){
|
||||||
BOOST_UNORDERED_ADD_STATS(
|
BOOST_UNORDERED_ADD_STATS(
|
||||||
unsuccessful_lookup_stats,(pb.length(),num_cmps));
|
get_cumulative_stats().unsuccessful_lookup,(pb.length(),num_cmps));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while(BOOST_LIKELY(pb.next(arrays.groups_size_mask)));
|
while(BOOST_LIKELY(pb.next(arrays.groups_size_mask)));
|
||||||
BOOST_UNORDERED_ADD_STATS(
|
BOOST_UNORDERED_ADD_STATS(
|
||||||
unsuccessful_lookup_stats,(pb.length(),num_cmps));
|
get_cumulative_stats().unsuccessful_lookup,(pb.length(),num_cmps));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1804,41 +1809,28 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
insertion_stats.get_summary<0>()
|
cstats.insertion.get_summary<0>()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
successful_lookup_stats.get_summary<0>(),
|
cstats.successful_lookup.get_summary<0>(),
|
||||||
successful_lookup_stats.get_summary<1>()
|
cstats.successful_lookup.get_summary<1>()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unsuccessful_lookup_stats.get_summary<0>(),
|
cstats.unsuccessful_lookup.get_summary<0>(),
|
||||||
unsuccessful_lookup_stats.get_summary<1>()
|
cstats.unsuccessful_lookup.get_summary<1>()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
cumulative_insertion_stats& insertion_cumulative_stats()noexcept
|
cumulative_stats& get_cumulative_stats()const noexcept
|
||||||
{
|
{
|
||||||
return insertion_stats;
|
return cstats;
|
||||||
}
|
}
|
||||||
|
|
||||||
cumulative_successful_lookup_stats&
|
|
||||||
successful_lookup_cumulative_stats()const noexcept
|
|
||||||
{
|
|
||||||
return successful_lookup_stats;
|
|
||||||
}
|
|
||||||
|
|
||||||
cumulative_unsuccessful_lookup_stats&
|
|
||||||
unsuccessful_lookup_cumulative_stats()const noexcept
|
|
||||||
{
|
|
||||||
return unsuccessful_lookup_stats;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset_stats()
|
void reset_stats()
|
||||||
{
|
{
|
||||||
insertion_stats.reset();
|
cstats.insertion.reset();
|
||||||
successful_lookup_stats.reset();
|
cstats.successful_lookup.reset();
|
||||||
unsuccessful_lookup_stats.reset();
|
cstats.unsuccessful_lookup.reset();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2049,13 +2041,11 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
arrays_type arrays;
|
arrays_type arrays;
|
||||||
size_ctrl_type size_ctrl;
|
size_ctrl_type size_ctrl;
|
||||||
|
|
||||||
#if defined(BOOST_UNORDERED_ENABLE_STATS)
|
#if defined(BOOST_UNORDERED_ENABLE_STATS)
|
||||||
cumulative_insertion_stats insertion_stats;
|
mutable cumulative_stats cstats;
|
||||||
mutable cumulative_successful_lookup_stats successful_lookup_stats;
|
|
||||||
mutable cumulative_unsuccessful_lookup_stats unsuccessful_lookup_stats;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -2345,7 +2335,8 @@ private:
|
|||||||
auto p=arrays_.elements()+pos*N+n;
|
auto p=arrays_.elements()+pos*N+n;
|
||||||
construct_element(p,std::forward<Args>(args)...);
|
construct_element(p,std::forward<Args>(args)...);
|
||||||
pg->set(n,hash);
|
pg->set(n,hash);
|
||||||
BOOST_UNORDERED_ADD_STATS(insertion_stats,(pb.length()));
|
BOOST_UNORDERED_ADD_STATS(
|
||||||
|
get_cumulative_stats().insertion,(pb.length()));
|
||||||
return {pg,n,p};
|
return {pg,n,p};
|
||||||
}
|
}
|
||||||
else pg->mark_overflow(hash);
|
else pg->mark_overflow(hash);
|
||||||
|
Reference in New Issue
Block a user