Commit 04672c69 by Gennadiy Rozental Committed by Copybara-Service

No changes in OSS.

PiperOrigin-RevId: 478869244
Change-Id: Id16eb1e5036e95a5e2a990a647f1f7090129a009
parent e225d0b2
...@@ -637,6 +637,8 @@ cc_test( ...@@ -637,6 +637,8 @@ cc_test(
], ],
deps = [ deps = [
":container_memory", ":container_memory",
":flat_hash_map",
":flat_hash_set",
":hash_function_defaults", ":hash_function_defaults",
":hash_policy_testing", ":hash_policy_testing",
":hashtable_debug", ":hashtable_debug",
...@@ -646,6 +648,7 @@ cc_test( ...@@ -646,6 +648,7 @@ cc_test(
"//absl/base:core_headers", "//absl/base:core_headers",
"//absl/base:prefetch", "//absl/base:prefetch",
"//absl/base:raw_logging_internal", "//absl/base:raw_logging_internal",
"//absl/log",
"//absl/strings", "//absl/strings",
"@com_google_googletest//:gtest_main", "@com_google_googletest//:gtest_main",
], ],
......
...@@ -722,12 +722,15 @@ absl_cc_test( ...@@ -722,12 +722,15 @@ absl_cc_test(
${ABSL_TEST_COPTS} ${ABSL_TEST_COPTS}
DEPS DEPS
absl::container_memory absl::container_memory
absl::flat_hash_map
absl::flat_hash_set
absl::hash_function_defaults absl::hash_function_defaults
absl::hash_policy_testing absl::hash_policy_testing
absl::hashtable_debug absl::hashtable_debug
absl::raw_hash_set absl::raw_hash_set
absl::base absl::base
absl::config absl::config
absl::log
absl::core_headers absl::core_headers
absl::prefetch absl::prefetch
absl::raw_logging_internal absl::raw_logging_internal
......
...@@ -14,17 +14,25 @@ ...@@ -14,17 +14,25 @@
#include "absl/container/internal/raw_hash_set.h" #include "absl/container/internal/raw_hash_set.h"
#include <algorithm>
#include <atomic> #include <atomic>
#include <cmath> #include <cmath>
#include <cstdint> #include <cstdint>
#include <deque> #include <deque>
#include <functional> #include <functional>
#include <iterator>
#include <list>
#include <map>
#include <memory> #include <memory>
#include <numeric> #include <numeric>
#include <ostream>
#include <random> #include <random>
#include <string> #include <string>
#include <type_traits>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <utility>
#include <vector>
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
...@@ -33,10 +41,13 @@ ...@@ -33,10 +41,13 @@
#include "absl/base/internal/cycleclock.h" #include "absl/base/internal/cycleclock.h"
#include "absl/base/internal/prefetch.h" #include "absl/base/internal/prefetch.h"
#include "absl/base/internal/raw_logging.h" #include "absl/base/internal/raw_logging.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "absl/container/internal/container_memory.h" #include "absl/container/internal/container_memory.h"
#include "absl/container/internal/hash_function_defaults.h" #include "absl/container/internal/hash_function_defaults.h"
#include "absl/container/internal/hash_policy_testing.h" #include "absl/container/internal/hash_policy_testing.h"
#include "absl/container/internal/hashtable_debug.h" #include "absl/container/internal/hashtable_debug.h"
#include "absl/log/log.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
namespace absl { namespace absl {
...@@ -339,7 +350,7 @@ class StringPolicy { ...@@ -339,7 +350,7 @@ class StringPolicy {
struct ctor {}; struct ctor {};
template <class... Ts> template <class... Ts>
slot_type(ctor, Ts&&... ts) : pair(std::forward<Ts>(ts)...) {} explicit slot_type(ctor, Ts&&... ts) : pair(std::forward<Ts>(ts)...) {}
std::pair<std::string, std::string> pair; std::pair<std::string, std::string> pair;
}; };
...@@ -411,7 +422,7 @@ struct CustomAlloc : std::allocator<T> { ...@@ -411,7 +422,7 @@ struct CustomAlloc : std::allocator<T> {
CustomAlloc() {} CustomAlloc() {}
template <typename U> template <typename U>
CustomAlloc(const CustomAlloc<U>& other) {} explicit CustomAlloc(const CustomAlloc<U>& /*other*/) {}
template<class U> struct rebind { template<class U> struct rebind {
using other = CustomAlloc<U>; using other = CustomAlloc<U>;
...@@ -1275,6 +1286,7 @@ TEST(Table, DISABLED_EnsureNonQuadraticTopNXorSeedByProbeSeqLength) { ...@@ -1275,6 +1286,7 @@ TEST(Table, DISABLED_EnsureNonQuadraticTopNXorSeedByProbeSeqLength) {
for (size_t size : sizes) { for (size_t size : sizes) {
auto& stat = stats[size]; auto& stat = stats[size];
VerifyStats(size, expected, stat); VerifyStats(size, expected, stat);
LOG(INFO) << size << " " << stat;
} }
} }
...@@ -1370,6 +1382,7 @@ TEST(Table, DISABLED_EnsureNonQuadraticTopNLinearTransformByProbeSeqLength) { ...@@ -1370,6 +1382,7 @@ TEST(Table, DISABLED_EnsureNonQuadraticTopNLinearTransformByProbeSeqLength) {
for (size_t size : sizes) { for (size_t size : sizes) {
auto& stat = stats[size]; auto& stat = stats[size];
VerifyStats(size, expected, stat); VerifyStats(size, expected, stat);
LOG(INFO) << size << " " << stat;
} }
} }
...@@ -1504,7 +1517,7 @@ TEST(Table, RehashZeroForcesRehash) { ...@@ -1504,7 +1517,7 @@ TEST(Table, RehashZeroForcesRehash) {
TEST(Table, ConstructFromInitList) { TEST(Table, ConstructFromInitList) {
using P = std::pair<std::string, std::string>; using P = std::pair<std::string, std::string>;
struct Q { struct Q {
operator P() const { return {}; } operator P() const { return {}; } // NOLINT
}; };
StringTable t = {P(), Q(), {}, {{}, {}}}; StringTable t = {P(), Q(), {}, {{}, {}}};
} }
...@@ -2027,7 +2040,7 @@ TEST(Table, UnstablePointers) { ...@@ -2027,7 +2040,7 @@ TEST(Table, UnstablePointers) {
TEST(TableDeathTest, EraseOfEndAsserts) { TEST(TableDeathTest, EraseOfEndAsserts) {
// Use an assert with side-effects to figure out if they are actually enabled. // Use an assert with side-effects to figure out if they are actually enabled.
bool assert_enabled = false; bool assert_enabled = false;
assert([&]() { assert([&]() { // NOLINT
assert_enabled = true; assert_enabled = true;
return true; return true;
}()); }());
...@@ -2047,7 +2060,7 @@ TEST(RawHashSamplerTest, Sample) { ...@@ -2047,7 +2060,7 @@ TEST(RawHashSamplerTest, Sample) {
auto& sampler = GlobalHashtablezSampler(); auto& sampler = GlobalHashtablezSampler();
size_t start_size = 0; size_t start_size = 0;
std::unordered_set<const HashtablezInfo*> preexisting_info; absl::flat_hash_set<const HashtablezInfo*> preexisting_info;
start_size += sampler.Iterate([&](const HashtablezInfo& info) { start_size += sampler.Iterate([&](const HashtablezInfo& info) {
preexisting_info.insert(&info); preexisting_info.insert(&info);
++start_size; ++start_size;
...@@ -2074,8 +2087,8 @@ TEST(RawHashSamplerTest, Sample) { ...@@ -2074,8 +2087,8 @@ TEST(RawHashSamplerTest, Sample) {
} }
} }
size_t end_size = 0; size_t end_size = 0;
std::unordered_map<size_t, int> observed_checksums; absl::flat_hash_map<size_t, int> observed_checksums;
std::unordered_map<ssize_t, int> reservations; absl::flat_hash_map<ssize_t, int> reservations;
end_size += sampler.Iterate([&](const HashtablezInfo& info) { end_size += sampler.Iterate([&](const HashtablezInfo& info) {
if (preexisting_info.count(&info) == 0) { if (preexisting_info.count(&info) == 0) {
observed_checksums[info.hashes_bitwise_xor.load( observed_checksums[info.hashes_bitwise_xor.load(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment