mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
streamlined update_size_ctrl, printed concurrent_table stats
This commit is contained in:
@ -53,6 +53,7 @@
|
|||||||
#if defined(BOOST_UNORDERED_LATCH_FREE)
|
#if defined(BOOST_UNORDERED_LATCH_FREE)
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::atomic<std::size_t> garbage_collected=0;
|
std::atomic<std::size_t> garbage_collected=0;
|
||||||
@ -568,6 +569,11 @@ public:
|
|||||||
retired_element_traits::deallocate(
|
retired_element_traits::deallocate(
|
||||||
ral,v.retired_elements,garbage_vector::N);
|
ral,v.retired_elements,garbage_vector::N);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout
|
||||||
|
<<"capacity: "<<capacity()<<"; "
|
||||||
|
<<"rehashes: "<<rehashes<<"; "
|
||||||
|
<<"max probe:" <<max_probe<<"\n";
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
~concurrent_table()=default;
|
~concurrent_table()=default;
|
||||||
@ -1724,8 +1730,9 @@ private:
|
|||||||
#if defined(BOOST_UNORDERED_LATCH_FREE)
|
#if defined(BOOST_UNORDERED_LATCH_FREE)
|
||||||
auto lck=exclusive_access();
|
auto lck=exclusive_access();
|
||||||
update_size_ctrl();
|
update_size_ctrl();
|
||||||
|
garbage_collect();
|
||||||
if(this->size_ctrl.size>=this->size_ctrl.ml){ // NB >=
|
if(this->size_ctrl.size>=this->size_ctrl.ml){ // NB >=
|
||||||
garbage_collect();
|
++rehashes;
|
||||||
this->unchecked_rehash_for_growth();
|
this->unchecked_rehash_for_growth();
|
||||||
max_probe=default_max_probe;
|
max_probe=default_max_probe;
|
||||||
}
|
}
|
||||||
@ -2011,6 +2018,7 @@ private:
|
|||||||
epoch_type current_epoch=1;
|
epoch_type current_epoch=1;
|
||||||
unsigned char pad_[cacheline_size-sizeof(epoch_type)];
|
unsigned char pad_[cacheline_size-sizeof(epoch_type)];
|
||||||
std::size_t max_probe=default_max_probe;
|
std::size_t max_probe=default_max_probe;
|
||||||
|
std::size_t rehashes=0;
|
||||||
|
|
||||||
garbage_vector& local_garbage_vector()const
|
garbage_vector& local_garbage_vector()const
|
||||||
{
|
{
|
||||||
@ -2062,13 +2070,15 @@ private:
|
|||||||
{
|
{
|
||||||
using ssize_t=std::make_signed<std::size_t>::type;
|
using ssize_t=std::make_signed<std::size_t>::type;
|
||||||
|
|
||||||
|
ssize_t ssize=0,smcos=0;
|
||||||
for(std::size_t i=0;i<garbage_vectors.size();++i){
|
for(std::size_t i=0;i<garbage_vectors.size();++i){
|
||||||
auto &v=garbage_vectors[i];
|
auto &v=garbage_vectors[i];
|
||||||
this->size_ctrl.size+=v.size.exchange(0);
|
ssize+=v.size.exchange(0);
|
||||||
auto mcos=v.mcos.exchange(0);
|
smcos+=v.mcos.exchange(0);
|
||||||
if(ssize_t(this->size_ctrl.ml)>=mcos)this->size_ctrl.ml-=mcos;
|
|
||||||
else this->size_ctrl.ml=0;
|
|
||||||
}
|
}
|
||||||
|
this->size_ctrl.size+=ssize;
|
||||||
|
if(ssize_t(this->size_ctrl.ml)>=smcos)this->size_ctrl.ml-=smcos;
|
||||||
|
else this->size_ctrl.ml=0;
|
||||||
auto max_ml=super::initial_max_load();
|
auto max_ml=super::initial_max_load();
|
||||||
if(this->size_ctrl.ml>max_ml)this->size_ctrl.ml=max_ml;
|
if(this->size_ctrl.ml>max_ml)this->size_ctrl.ml=max_ml;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user