summaryrefslogtreecommitdiff
path: root/absl/container/internal/hashtablez_sampler.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2021-02-08 13:20:10 -0800
committerGravatar Derek Mauro <dmauro@google.com>2021-02-09 15:21:31 -0500
commit2aa00ab2f22cf4e0e85e622c3254d483b2ddfb30 (patch)
tree851eb5fbee5fdb05abc07dcbac5f7ca31c8b9bfb /absl/container/internal/hashtablez_sampler.cc
parentc36d825d9a5443f81d2656685ae021d6326da90c (diff)
Export of internal Abseil changes
-- 0acc8470116819a62fd5ebbc2c64fdd703c93331 by Abseil Team <absl-team@google.com>: Add an attribute to HashtablezInfo which performs a bitwise XOR on all hashes. The purposes of this attribute is to identify if identical hash tables are being created. If we see a large number of identical tables, it's likely the code can be improved by using a common table as opposed to keep rebuilding the same one. PiperOrigin-RevId: 356338043 GitOrigin-RevId: 0acc8470116819a62fd5ebbc2c64fdd703c93331 Change-Id: If7d0a96629144fb41e6bef1ec93345a22df40733
Diffstat (limited to 'absl/container/internal/hashtablez_sampler.cc')
-rw-r--r--absl/container/internal/hashtablez_sampler.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/absl/container/internal/hashtablez_sampler.cc b/absl/container/internal/hashtablez_sampler.cc
index e4484fbb..7024e54e 100644
--- a/absl/container/internal/hashtablez_sampler.cc
+++ b/absl/container/internal/hashtablez_sampler.cc
@@ -72,6 +72,7 @@ void HashtablezInfo::PrepareForSampling() {
total_probe_length.store(0, std::memory_order_relaxed);
hashes_bitwise_or.store(0, std::memory_order_relaxed);
hashes_bitwise_and.store(~size_t{}, std::memory_order_relaxed);
+ hashes_bitwise_xor.store(0, std::memory_order_relaxed);
create_time = absl::Now();
// The inliner makes hardcoded skip_count difficult (especially when combined
@@ -235,6 +236,7 @@ void RecordInsertSlow(HashtablezInfo* info, size_t hash,
info->hashes_bitwise_and.fetch_and(hash, std::memory_order_relaxed);
info->hashes_bitwise_or.fetch_or(hash, std::memory_order_relaxed);
+ info->hashes_bitwise_xor.fetch_xor(hash, std::memory_order_relaxed);
info->max_probe_length.store(
std::max(info->max_probe_length.load(std::memory_order_relaxed),
probe_length),