Rename RecordInsert -> RecordInsertMiss.
This is to distinguish it from insert operations that find an existing value.
PiperOrigin-RevId: 828654839
Change-Id: I7ef1ffef22e978d806932537962292f81526521f
diff --git a/absl/container/internal/hashtablez_sampler.cc b/absl/container/internal/hashtablez_sampler.cc
index 965476a..1b8204b 100644
--- a/absl/container/internal/hashtablez_sampler.cc
+++ b/absl/container/internal/hashtablez_sampler.cc
@@ -230,8 +230,8 @@
}
}
-void RecordInsertSlow(HashtablezInfo* info, size_t hash,
- size_t distance_from_desired) {
+void RecordInsertMissSlow(HashtablezInfo* info, size_t hash,
+ size_t distance_from_desired) {
// SwissTables probe in groups of 16, so scale this to count items probes and
// not offset from desired.
size_t probe_length = distance_from_desired;
diff --git a/absl/container/internal/hashtablez_sampler.h b/absl/container/internal/hashtablez_sampler.h
index 55ce7ed..5c59a9e 100644
--- a/absl/container/internal/hashtablez_sampler.h
+++ b/absl/container/internal/hashtablez_sampler.h
@@ -118,8 +118,8 @@
void RecordStorageChangedSlow(HashtablezInfo* info, size_t size,
size_t capacity);
-void RecordInsertSlow(HashtablezInfo* info, size_t hash,
- size_t distance_from_desired);
+void RecordInsertMissSlow(HashtablezInfo* info, size_t hash,
+ size_t distance_from_desired);
void RecordEraseSlow(HashtablezInfo* info);
@@ -174,9 +174,9 @@
RecordClearedReservationSlow(info_);
}
- inline void RecordInsert(size_t hash, size_t distance_from_desired) {
+ inline void RecordInsertMiss(size_t hash, size_t distance_from_desired) {
if (ABSL_PREDICT_TRUE(info_ == nullptr)) return;
- RecordInsertSlow(info_, hash, distance_from_desired);
+ RecordInsertMissSlow(info_, hash, distance_from_desired);
}
inline void RecordErase() {
@@ -207,7 +207,8 @@
inline void RecordRehash(size_t /*total_probe_length*/) {}
inline void RecordReservation(size_t /*target_capacity*/) {}
inline void RecordClearedReservation() {}
- inline void RecordInsert(size_t /*hash*/, size_t /*distance_from_desired*/) {}
+ inline void RecordInsertMiss(size_t /*hash*/,
+ size_t /*distance_from_desired*/) {}
inline void RecordErase() {}
friend inline void swap(HashtablezInfoHandle& /*lhs*/,
diff --git a/absl/container/internal/hashtablez_sampler_test.cc b/absl/container/internal/hashtablez_sampler_test.cc
index ef80cb0..80fe3cf 100644
--- a/absl/container/internal/hashtablez_sampler_test.cc
+++ b/absl/container/internal/hashtablez_sampler_test.cc
@@ -166,7 +166,7 @@
EXPECT_EQ(info.capacity.load(), 20);
}
-TEST(HashtablezInfoTest, RecordInsert) {
+TEST(HashtablezInfoTest, RecordInsertMiss) {
HashtablezInfo info;
absl::MutexLock l(info.init_mu);
const int64_t test_stride = 25;
@@ -179,17 +179,17 @@
/*value_size=*/test_value_size,
/*soo_capacity_value=*/0);
EXPECT_EQ(info.max_probe_length.load(), 0);
- RecordInsertSlow(&info, 0x0000FF00, 6 * kProbeLength);
+ RecordInsertMissSlow(&info, 0x0000FF00, 6 * kProbeLength);
EXPECT_EQ(info.max_probe_length.load(), 6);
EXPECT_EQ(info.hashes_bitwise_and.load(), 0x0000FF00);
EXPECT_EQ(info.hashes_bitwise_or.load(), 0x0000FF00);
EXPECT_EQ(info.hashes_bitwise_xor.load(), 0x0000FF00);
- RecordInsertSlow(&info, 0x000FF000, 4 * kProbeLength);
+ RecordInsertMissSlow(&info, 0x000FF000, 4 * kProbeLength);
EXPECT_EQ(info.max_probe_length.load(), 6);
EXPECT_EQ(info.hashes_bitwise_and.load(), 0x0000F000);
EXPECT_EQ(info.hashes_bitwise_or.load(), 0x000FFF00);
EXPECT_EQ(info.hashes_bitwise_xor.load(), 0x000F0F00);
- RecordInsertSlow(&info, 0x00FF0000, 12 * kProbeLength);
+ RecordInsertMissSlow(&info, 0x00FF0000, 12 * kProbeLength);
EXPECT_EQ(info.max_probe_length.load(), 12);
EXPECT_EQ(info.hashes_bitwise_and.load(), 0x00000000);
EXPECT_EQ(info.hashes_bitwise_or.load(), 0x00FFFF00);
@@ -210,7 +210,7 @@
/*soo_capacity_value=*/1);
EXPECT_EQ(info.num_erases.load(), 0);
EXPECT_EQ(info.size.load(), 0);
- RecordInsertSlow(&info, 0x0000FF00, 6 * kProbeLength);
+ RecordInsertMissSlow(&info, 0x0000FF00, 6 * kProbeLength);
EXPECT_EQ(info.size.load(), 1);
RecordEraseSlow(&info);
EXPECT_EQ(info.size.load(), 0);
@@ -233,10 +233,10 @@
/*value_size=*/test_value_size,
/*soo_capacity_value=*/0);
- RecordInsertSlow(&info, 0x1, 0);
- RecordInsertSlow(&info, 0x2, kProbeLength);
- RecordInsertSlow(&info, 0x4, kProbeLength);
- RecordInsertSlow(&info, 0x8, 2 * kProbeLength);
+ RecordInsertMissSlow(&info, 0x1, 0);
+ RecordInsertMissSlow(&info, 0x2, kProbeLength);
+ RecordInsertMissSlow(&info, 0x4, kProbeLength);
+ RecordInsertMissSlow(&info, 0x8, 2 * kProbeLength);
EXPECT_EQ(info.size.load(), 4);
EXPECT_EQ(info.total_probe_length.load(), 4);
diff --git a/absl/container/internal/raw_hash_set.cc b/absl/container/internal/raw_hash_set.cc
index ea3a3bf..0ef10ef 100644
--- a/absl/container/internal/raw_hash_set.cc
+++ b/absl/container/internal/raw_hash_set.cc
@@ -503,7 +503,7 @@
ResetGrowthLeft(common);
FindInfo find_info = find_first_non_full(common, new_hash);
SetCtrlInLargeTable(common, find_info.offset, H2(new_hash), slot_size);
- common.infoz().RecordInsert(new_hash, find_info.probe_length);
+ common.infoz().RecordInsertMiss(new_hash, find_info.probe_length);
common.infoz().RecordRehash(total_probe_length);
return find_info.offset;
}
@@ -719,7 +719,7 @@
ABSL_SWISSTABLE_ASSERT(infoz.IsSampled());
infoz.RecordStorageChanged(common.size() - 1, common.capacity());
infoz.RecordRehash(total_probe_length);
- infoz.RecordInsert(hash, distance_from_desired);
+ infoz.RecordInsertMiss(hash, distance_from_desired);
common.set_has_infoz();
// TODO(b/413062340): we could potentially store infoz in place of the
// control pointer for the capacity 1 case.
@@ -1637,7 +1637,7 @@
PrepareInsertCommon(common);
common.growth_info().OverwriteControlAsFull(common.control()[target.offset]);
SetCtrlInLargeTable(common, target.offset, H2(hash), policy.slot_size);
- common.infoz().RecordInsert(hash, target.probe_length);
+ common.infoz().RecordInsertMiss(hash, target.probe_length);
return target.offset;
}
@@ -1658,7 +1658,7 @@
const size_t new_hash = get_hash(common.seed().seed());
SetCtrlInSingleGroupTable(common, SooSlotIndex(), H2(new_hash),
policy.slot_size);
- common.infoz().RecordInsert(new_hash, /*distance_from_desired=*/0);
+ common.infoz().RecordInsertMiss(new_hash, /*distance_from_desired=*/0);
return SooSlotIndex();
}
@@ -1921,7 +1921,7 @@
// a full `insert`.
const size_t hash = (*hasher)(hash_fn, that_slot, seed);
FindInfo target = find_first_non_full(common, hash);
- infoz.RecordInsert(hash, target.probe_length);
+ infoz.RecordInsertMiss(hash, target.probe_length);
offset = target.offset;
SetCtrl(common, offset, H2(hash), slot_size);
copy_fn(SlotAddress(common.slot_array(), offset, slot_size), that_slot);
@@ -1971,7 +1971,7 @@
target_group.offset += mask_empty.LowestBitSet();
target_group.offset &= common.capacity();
SetCtrl(common, target_group.offset, H2(hash), policy.slot_size);
- common.infoz().RecordInsert(hash, target_group.probe_length);
+ common.infoz().RecordInsertMiss(hash, target_group.probe_length);
return target_group.offset;
}
} // namespace