aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-03-15 12:42:58 +0100
committerGitHub <noreply@github.com>2023-03-15 12:42:58 +0100
commite54a7a0bb3470adb1cfb373c348c43da6d79e239 (patch)
treee6c82a18bd466404b3164fccf6def181c1b1b2ba
parent9b8239bc7351f161154d537b8a03e2a4d0e93ba1 (diff)
parentc260a19f8137f9ebe6f47077b72d35a97cae68b3 (diff)
Merge pull request #26447 from vespa-engine/toregge/expose-static-size-of-entry-ref-hold-list-deque-in-datastore-base
Expose static size of entry ref hold list dequeue in DataStoreBase.
-rw-r--r--vespalib/src/tests/datastore/array_store/array_store_test.cpp10
-rw-r--r--vespalib/src/tests/datastore/unique_store/unique_store_test.cpp3
-rw-r--r--vespalib/src/vespa/vespalib/datastore/datastorebase.h4
-rw-r--r--vespalib/src/vespa/vespalib/util/generation_hold_list.h2
4 files changed, 11 insertions, 8 deletions
diff --git a/vespalib/src/tests/datastore/array_store/array_store_test.cpp b/vespalib/src/tests/datastore/array_store/array_store_test.cpp
index c32554232ef..8ee9eaeb4f7 100644
--- a/vespalib/src/tests/datastore/array_store/array_store_test.cpp
+++ b/vespalib/src/tests/datastore/array_store/array_store_test.cpp
@@ -209,13 +209,9 @@ INSTANTIATE_TEST_SUITE_P(NumberStoreFreeListsDisabledMultiTest,
testing::PrintToStringParamName());
TEST_P(NumberStoreTest, control_static_sizes) {
-#ifdef _LIBCPP_VERSION
- EXPECT_EQ(464u, sizeof(store));
- EXPECT_EQ(280u, sizeof(NumberStoreTest::ArrayStoreType::DataStoreType));
-#else
- EXPECT_EQ(496u, sizeof(store));
- EXPECT_EQ(320u, sizeof(NumberStoreTest::ArrayStoreType::DataStoreType));
-#endif
+ static constexpr size_t sizeof_deque = vespalib::datastore::DataStoreBase::sizeof_entry_ref_hold_list_deque;
+ EXPECT_EQ(416u + sizeof_deque, sizeof(store));
+ EXPECT_EQ(240u + sizeof_deque, sizeof(NumberStoreTest::ArrayStoreType::DataStoreType));
EXPECT_EQ(112u, sizeof(NumberStoreTest::ArrayStoreType::SmallBufferType));
MemoryUsage usage = store.getMemoryUsage();
EXPECT_EQ(202144u, usage.allocatedBytes());
diff --git a/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp b/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp
index 1781a680bac..0de44eb373e 100644
--- a/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp
+++ b/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp
@@ -470,7 +470,8 @@ TEST_F(DoubleTest, nan_is_handled)
}
TEST_F(DoubleTest, control_memory_usage) {
- EXPECT_EQ(456u, sizeof(store));
+ static constexpr size_t sizeof_deque = vespalib::datastore::DataStoreBase::sizeof_entry_ref_hold_list_deque;
+ EXPECT_EQ(376u + sizeof_deque, sizeof(store));
EXPECT_EQ(144u, sizeof(BufferState));
EXPECT_EQ(28740u, store.get_values_memory_usage().allocatedBytes());
EXPECT_EQ(24804u, store.get_values_memory_usage().usedBytes());
diff --git a/vespalib/src/vespa/vespalib/datastore/datastorebase.h b/vespalib/src/vespa/vespalib/datastore/datastorebase.h
index ecbac451c5a..9cab7a2e375 100644
--- a/vespalib/src/vespa/vespalib/datastore/datastorebase.h
+++ b/vespalib/src/vespa/vespalib/datastore/datastorebase.h
@@ -202,6 +202,10 @@ protected:
using EntryRefHoldList = GenerationHoldList<EntryRefHoldElem, false, true>;
EntryRefHoldList _entry_ref_hold_list;
+public:
+ // Static size of dequeue in _entry_ref_hold_list._phase_2_list
+ // might depend on std::deque implementation
+ static constexpr size_t sizeof_entry_ref_hold_list_deque = EntryRefHoldList::sizeof_phase_2_list;
private:
/**
diff --git a/vespalib/src/vespa/vespalib/util/generation_hold_list.h b/vespalib/src/vespa/vespalib/util/generation_hold_list.h
index bdb58afb504..ff58456dc2a 100644
--- a/vespalib/src/vespa/vespalib/util/generation_hold_list.h
+++ b/vespalib/src/vespa/vespalib/util/generation_hold_list.h
@@ -101,6 +101,8 @@ public:
size_t get_held_bytes() const { return _held_bytes.load(std::memory_order_relaxed); }
+ // Static size of _phase_2_list might depend on std::deque implementation
+ static constexpr size_t sizeof_phase_2_list = sizeof(ElemWithGenList);
};
}