34 std::vector<std::size_t>
const&
data;
40 for (
auto v : histo.
data) {
44 for (
size_t i = 0;
i < histo.
data.size(); ++
i) {
48 partial += histo.
data[
i];
49 if (histo.
data[
i] > 0) {
50 xo <<
i <<
": " << histo.
data[
i] <<
" (" 51 << (
static_cast<double>(
partial) * 100.0 / sum) <<
"%)";
59 std::vector<std::size_t>&
a,
60 std::vector<std::size_t>
const& d) {
61 if (a.size() < d.size()) {
64 for (std::size_t
i = 0;
i < d.size(); ++
i) {
71 std::size_t
count = 0;
72 for (std::size_t
i = 1;
i < probeLengths.size(); ++
i) {
73 sum +=
i * probeLengths[
i];
74 count += probeLengths[
i];
76 return static_cast<double>(
sum) / static_cast<double>(count);
81 std::size_t
p99Probe(std::vector<std::size_t>
const& probeLengths) {
82 std::size_t
count = 0;
83 for (std::size_t
i = 1;
i < probeLengths.size(); ++
i) {
84 count += probeLengths[
i];
86 std::size_t rv = probeLengths.size();
88 while ((suffix + probeLengths[rv - 1]) * 100 <= count) {
96 bool destroyed{
false};
104 destroyed =
rhs.destroyed;
114 return x == rhs.
x && destroyed == rhs.
destroyed;
117 return !(*
this ==
rhs);
141 : copyConstruct{copConstr},
142 moveConstruct{movConstr},
143 copyConvert{copConv},
144 moveConvert{movConv},
145 copyAssign{copAssign},
146 moveAssign{movAssign},
147 defaultConstruct{def},
151 return copyConstruct + moveConstruct + copyConvert + moveConvert +
152 defaultConstruct - destroyed;
169 return !(*
this ==
rhs);
185 xo << glue << counts.
copyConvert <<
" copy convert";
189 xo << glue << counts.
moveConvert <<
" move convert";
193 xo << glue << counts.
copyAssign <<
" copy assign";
197 xo << glue << counts.
moveAssign <<
" move assign";
205 xo << glue << counts.
destroyed <<
" destroyed";
216 static_assert(
Tag <= 5,
"Need to extend Tracked<Tag> in F14TestUtil.h");
224 counts.defaultConstruct++;
228 counts.copyConvert++;
232 counts.moveConvert++;
236 counts.copyConstruct++;
240 counts.moveConstruct++;
258 counts.copyConvert++;
264 counts.moveConvert++;
273 return val_ == rhs.
val_;
276 return !(*
this ==
rhs);
303 template <
typename A,
typename B>
370 : a_(other.a_), t_(other.t_) {}
392 throw std::bad_alloc();
397 return a_.allocate(n);
406 std::allocator<T>
a_;
421 template <
class T1,
class T2>
426 template <
class T1,
class T2>
434 xo <<
"{ " << std::endl;
439 <<
"unknown (RTTI not availabe)" 442 xo <<
" size: " << stats.
size << std::endl;
443 xo <<
" valueSize: " << stats.
valueSize << std::endl;
444 xo <<
" bucketCount: " << stats.
bucketCount << std::endl;
445 xo <<
" chunkCount: " << stats.
chunkCount << std::endl;
448 xo <<
" chunkOutboundOverflowHisto" 456 xo <<
" totalBytes: " << stats.
totalBytes << std::endl;
457 xo <<
" valueBytes: " << (stats.
size * stats.
valueSize) << std::endl;
458 xo <<
" overheadBytes: " << stats.
overheadBytes << std::endl;
459 if (stats.
size > 0) {
460 xo <<
" overheadBytesPerKey: " 462 static_cast<double>(stats.
size))
489 template <
typename A,
typename D>
491 : alloc_{std::make_shared<AllocBytesFunc>(std::forward<A>(alloc))},
492 dealloc_{std::make_shared<DeallocBytesFunc>(std::forward<D>(dealloc))} {
497 : alloc_{other.alloc_}, dealloc_{other.dealloc_} {}
501 alloc_ = other.alloc_;
502 dealloc_ = other.dealloc_;
508 : alloc_(
std::
move(other.alloc_)), dealloc_(
std::
move(other.dealloc_)) {}
518 return static_cast<T*
>((*alloc_)(n *
sizeof(
T)));
521 (*dealloc_)(
static_cast<void*
>(p), n *
sizeof(
T));
524 template <
typename U>
526 return alloc_ == rhs.
alloc_;
529 template <
typename U>
531 return !(*
this ==
rhs);
542 template <
typename T>
549 template <
typename E>
551 :
equal_{std::make_shared<EqualFunc>(std::forward<E>(equal))} {}
561 template <
typename T>
568 template <
typename H>
570 : hasher_{std::make_shared<HasherFunc>(std::forward<H>(
hasher))} {}
573 return (*hasher_)(
val);
585 struct hash<
folly::f14::MoveOnlyTestInt> {
592 struct hash<
folly::f14::Tracked<Tag>> {
594 return tracked.
val_ ^ Tag;
Tracked(Tracked const &rhs)
SwapTrackingAlloc & operator=(SwapTrackingAlloc< U > const &other) noexcept
std::vector< std::size_t > keyProbeLengthHisto
uint64_t dist(Counts const &rhs) const
MoveOnlyTestInt() noexcept
std::atomic< int64_t > sum(0)
std::true_type propagate_on_container_swap
bool operator==(Tracked const &rhs) const
MoveOnlyTestInt(MoveOnlyTestInt &&rhs) noexcept
std::shared_ptr< HasherFunc > hasher_
void accumulate(std::vector< std::size_t > &a, std::vector< std::size_t > const &d)
T const & const_reference
void limitTestAllocations(std::size_t allocationsBeforeException=0)
folly::f14::Tracked< 0 > t_
thread_local Counts sumCounts
bool operator==(GenericAlloc< U > const &rhs) const
Tracked(uint64_t const &val)
size_t operator()(Tracked< Tag > const &tracked) const
bool operator!=(SwapTrackingAlloc< T1 > const &, SwapTrackingAlloc< T2 > const &)
std::shared_ptr< EqualFunc > equal_
Tracked(Tracked &&rhs) noexcept
Tracked & operator=(Tracked const &rhs)
constexpr detail::Map< Move > move
thread_local size_t testAllocationCount
typename Alloc::reference reference
typename Alloc::pointer pointer
std::size_t operator()(T const &val) const
bool operator!=(MoveOnlyTestInt const &rhs) const
std::allocator< T >::value_type value_type
std::true_type propagate_on_container_move_assignment
constexpr bool equal_(const Left &left, std::size_t left_size, const Right &right, std::size_t right_size) noexcept
—— Concurrent Priority Queue Implementation ——
std::true_type propagate_on_container_copy_assignment
requires E e noexcept(noexcept(s.error(std::move(e))))
std::shared_ptr< DeallocBytesFunc > dealloc_
SwapTrackingAlloc(SwapTrackingAlloc< U > const &other) noexcept
typename Alloc::value_type value_type
typename Alloc::size_type size_type
bool_constant< true > true_type
std::true_type propagate_on_container_move_assignment
std::size_t operator()(folly::f14::MoveOnlyTestInt const &val) const
FOLLY_PUSH_WARNING RHS rhs
GenericHasher(H &&hasher)
bool operator()(A const &lhs, B const &rhs) const
uint64_t unwrap(Tracked< Tag > const &v) const
void unlimitTestAllocations()
thread_local size_t testAllocatedBlockCount
bool operator==(Counts const &rhs) const
std::vector< std::size_t > const & data
std::vector< std::size_t > missProbeLengthHisto
Tracked(Tracked< T > &&rhs)
double expectedProbe(std::vector< std::size_t > const &probeLengths)
auto partial(F &&f, Args &&...args) -> detail::partial::Partial< typename std::decay< F >::type, std::tuple< typename std::decay< Args >::type... >>
std::vector< std::size_t > chunkOccupancyHisto
GenericAlloc & operator=(GenericAlloc< U > const &other) noexcept
std::true_type propagate_on_container_swap
std::true_type propagate_on_container_copy_assignment
SwapTrackingAlloc(SwapTrackingAlloc< U > &&other) noexcept
std::uniform_int_distribution< milliseconds::rep > dist
int64_t liveCount() const
bool operator!=(Tracked const &rhs) const
uint64_t defaultConstruct
std::vector< std::size_t > chunkHostedOverflowHisto
std::size_t overheadBytes
thread_local size_t testAllocatedMemorySize
Tracked & operator=(Tracked &&rhs) noexcept
std::shared_ptr< AllocBytesFunc > alloc_
static thread_local Counts counts
std::allocator< T >::const_pointer const_pointer
uint64_t unwrap(uint64_t v) const
bool operator!=(GenericAlloc< U > const &rhs) const
Tracked(Tracked< T > const &rhs)
std::vector< std::size_t > chunkOutboundOverflowHisto
SwapTrackingAlloc & operator=(SwapTrackingAlloc< U > &&other) noexcept
MoveOnlyTestInt & operator=(MoveOnlyTestInt &&rhs) noexcept
GenericAlloc(GenericAlloc< U > &&other) noexcept
std::allocator< T > Alloc
thread_local size_t testAllocationMaxCount
size_t operator()(folly::f14::Tracked< Tag > const &tracked) const
constexpr detail::Unwrap unwrap
typename Alloc::const_pointer const_pointer
std::size_t p99Probe(std::vector< std::size_t > const &probeLengths)
bool operator!=(Counts const &rhs) const
void swap(SwapTrackingAlloc< T > &, SwapTrackingAlloc< T > &)
GenericAlloc(A &&alloc, D &&dealloc)
std::allocator< T >::size_type size_type
typename Alloc::const_reference const_reference
bool operator==(MoveOnlyTestInt const &rhs) const
std::ostream & operator<<(std::ostream &xo, Histo const &histo)
GenericAlloc(GenericAlloc< U > const &other) noexcept
bool operator()(T const &lhs, T const &rhs) const
size_t operator()(uint64_t v) const
Counts(uint64_t copConstr=0, uint64_t movConstr=0, uint64_t copConv=0, uint64_t movConv=0, uint64_t copAssign=0, uint64_t movAssign=0, uint64_t def=0, uint64_t destr=0)
fbstring demangle(const char *name)
void deallocate(T *p, size_t n)
GenericAlloc & operator=(GenericAlloc< U > &&other) noexcept
void deallocate(T *p, size_t n)
std::allocator< T >::pointer pointer
bool operator==(SwapTrackingAlloc< T1 > const &, SwapTrackingAlloc< T2 > const &)