diff options
Diffstat (limited to 'vespalib/src/tests')
4 files changed, 32 insertions, 29 deletions
diff --git a/vespalib/src/tests/btree/btree_test.cpp b/vespalib/src/tests/btree/btree_test.cpp index ef64549e16a..b8da9ea6042 100644 --- a/vespalib/src/tests/btree/btree_test.cpp +++ b/vespalib/src/tests/btree/btree_test.cpp @@ -1064,7 +1064,8 @@ adjustAllocatedBytes(size_t nodeCount, size_t nodeSize) TEST_F(BTreeTest, require_that_memory_usage_is_calculated) { - constexpr size_t BASE = 163912; + constexpr size_t BASE_ALLOCATED = 28744u; + constexpr size_t BASE_USED = 24984; typedef BTreeNodeAllocator<int32_t, int8_t, btree::NoAggregated, MyTraits::INTERNAL_SLOTS, MyTraits::LEAF_SLOTS> NodeAllocator; @@ -1083,8 +1084,8 @@ TEST_F(BTreeTest, require_that_memory_usage_is_calculated) const uint32_t initialLeafNodes = 128u; mu.incAllocatedBytes(adjustAllocatedBytes(initialInternalNodes, sizeof(INode))); mu.incAllocatedBytes(adjustAllocatedBytes(initialLeafNodes, sizeof(LNode))); - mu.incAllocatedBytes(BASE); - mu.incUsedBytes(BASE); + mu.incAllocatedBytes(BASE_ALLOCATED); + mu.incUsedBytes(BASE_USED); mu.incUsedBytes(sizeof(INode)); mu.incDeadBytes(sizeof(INode)); EXPECT_TRUE(assertMemoryUsage(mu, tm.getMemoryUsage())); @@ -1115,8 +1116,8 @@ TEST_F(BTreeTest, require_that_memory_usage_is_calculated) mu = vespalib::MemoryUsage(); mu.incAllocatedBytes(adjustAllocatedBytes(initialInternalNodes, sizeof(INode))); mu.incAllocatedBytes(adjustAllocatedBytes(initialLeafNodes, sizeof(LNode))); - mu.incAllocatedBytes(BASE); - mu.incUsedBytes(BASE); + mu.incAllocatedBytes(BASE_ALLOCATED); + mu.incUsedBytes(BASE_USED); mu.incUsedBytes(sizeof(INode) * 2); mu.incDeadBytes(sizeof(INode) * 2); mu.incUsedBytes(sizeof(LNode)); 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 97e1ddb985d..c32554232ef 100644 --- a/vespalib/src/tests/datastore/array_store/array_store_test.cpp +++ b/vespalib/src/tests/datastore/array_store/array_store_test.cpp @@ -210,16 +210,16 @@ INSTANTIATE_TEST_SUITE_P(NumberStoreFreeListsDisabledMultiTest, TEST_P(NumberStoreTest, control_static_sizes) { #ifdef _LIBCPP_VERSION - EXPECT_EQ(472u, sizeof(store)); - EXPECT_EQ(296u, sizeof(NumberStoreTest::ArrayStoreType::DataStoreType)); + EXPECT_EQ(464u, sizeof(store)); + EXPECT_EQ(280u, sizeof(NumberStoreTest::ArrayStoreType::DataStoreType)); #else - EXPECT_EQ(504u, sizeof(store)); - EXPECT_EQ(328u, sizeof(NumberStoreTest::ArrayStoreType::DataStoreType)); + EXPECT_EQ(496u, sizeof(store)); + EXPECT_EQ(320u, sizeof(NumberStoreTest::ArrayStoreType::DataStoreType)); #endif EXPECT_EQ(112u, sizeof(NumberStoreTest::ArrayStoreType::SmallBufferType)); MemoryUsage usage = store.getMemoryUsage(); - EXPECT_EQ(1312160u, usage.allocatedBytes()); - EXPECT_EQ(1311232u, usage.usedBytes()); + EXPECT_EQ(202144u, usage.allocatedBytes()); + EXPECT_EQ(197776u, usage.usedBytes()); } TEST_P(NumberStoreTest, add_and_get_small_arrays_of_trivial_type) diff --git a/vespalib/src/tests/datastore/datastore/datastore_test.cpp b/vespalib/src/tests/datastore/datastore/datastore_test.cpp index 794be39ae9b..7121bf5ce11 100644 --- a/vespalib/src/tests/datastore/datastore/datastore_test.cpp +++ b/vespalib/src/tests/datastore/datastore/datastore_test.cpp @@ -474,7 +474,8 @@ TEST(DataStoreTest, require_that_memory_stats_are_calculated) TEST(DataStoreTest, require_that_memory_usage_is_calculated) { - constexpr size_t BASE = 676; + constexpr size_t BASE_ALLOCATED = 4228; + constexpr size_t BASE_USED = 308; MyStore s; MyRef r = s.addEntry(10); s.addEntry(20); @@ -483,8 +484,8 @@ TEST(DataStoreTest, require_that_memory_usage_is_calculated) s.holdBuffer(r.bufferId()); s.assign_generation(100); vespalib::MemoryUsage m = s.getMemoryUsage(); - EXPECT_EQ(MyRef::offsetSize() * sizeof(int) + BASE, m.allocatedBytes()); - EXPECT_EQ(5 * sizeof(int) + BASE, m.usedBytes()); + EXPECT_EQ(MyRef::offsetSize() * sizeof(int) + BASE_ALLOCATED, m.allocatedBytes()); + EXPECT_EQ(5 * sizeof(int) + BASE_USED, m.usedBytes()); EXPECT_EQ(0 * sizeof(int), m.deadBytes()); EXPECT_EQ(5 * sizeof(int), m.allocatedBytesOnHold()); s.reclaim_memory(101); @@ -492,28 +493,29 @@ TEST(DataStoreTest, require_that_memory_usage_is_calculated) TEST(DataStoreTest, require_that_we_can_disable_elemement_hold_list) { - constexpr size_t BASE = 676; + constexpr size_t BASE_ALLOCATED = 4228; + constexpr size_t BASE_USED = 308; MyStore s; MyRef r1 = s.addEntry(10); MyRef r2 = s.addEntry(20); MyRef r3 = s.addEntry(30); (void) r3; vespalib::MemoryUsage m = s.getMemoryUsage(); - EXPECT_EQ(MyRef::offsetSize() * sizeof(int) + BASE, m.allocatedBytes()); - EXPECT_EQ(4 * sizeof(int) + BASE, m.usedBytes()); + EXPECT_EQ(MyRef::offsetSize() * sizeof(int) + BASE_ALLOCATED, m.allocatedBytes()); + EXPECT_EQ(4 * sizeof(int) + BASE_USED, m.usedBytes()); EXPECT_EQ(1 * sizeof(int), m.deadBytes()); EXPECT_EQ(0 * sizeof(int), m.allocatedBytesOnHold()); s.holdElem(r1, 1); m = s.getMemoryUsage(); - EXPECT_EQ(MyRef::offsetSize() * sizeof(int) + BASE, m.allocatedBytes()); - EXPECT_EQ(4 * sizeof(int) + BASE, m.usedBytes()); + EXPECT_EQ(MyRef::offsetSize() * sizeof(int) + BASE_ALLOCATED, m.allocatedBytes()); + EXPECT_EQ(4 * sizeof(int) + BASE_USED, m.usedBytes()); EXPECT_EQ(1 * sizeof(int), m.deadBytes()); EXPECT_EQ(1 * sizeof(int), m.allocatedBytesOnHold()); s.disableElemHoldList(); s.holdElem(r2, 1); m = s.getMemoryUsage(); - EXPECT_EQ(MyRef::offsetSize() * sizeof(int) + BASE, m.allocatedBytes()); - EXPECT_EQ(4 * sizeof(int) + BASE, m.usedBytes()); + EXPECT_EQ(MyRef::offsetSize() * sizeof(int) + BASE_ALLOCATED, m.allocatedBytes()); + EXPECT_EQ(4 * sizeof(int) + BASE_USED, m.usedBytes()); EXPECT_EQ(2 * sizeof(int), m.deadBytes()); EXPECT_EQ(1 * sizeof(int), m.allocatedBytesOnHold()); s.assign_generation(100); @@ -538,7 +540,7 @@ void assertGrowStats(GrowthStats expSizes, TEST(DataStoreTest, require_that_buffer_growth_works) { - constexpr size_t BASE = 41032u; + constexpr size_t BASE = 10312; // Always switch to new buffer, min size 4 assertGrowStats({ 4, 4, 4, 4, 8, 16, 16, 32, 64, 64 }, { 4 }, 20 + BASE, 4, 0); 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 cf62d238d53..1781a680bac 100644 --- a/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp +++ b/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp @@ -470,14 +470,14 @@ TEST_F(DoubleTest, nan_is_handled) } TEST_F(DoubleTest, control_memory_usage) { - EXPECT_EQ(464, sizeof(store)); + EXPECT_EQ(456u, sizeof(store)); EXPECT_EQ(144u, sizeof(BufferState)); - EXPECT_EQ(163908u, store.get_values_memory_usage().allocatedBytes()); - EXPECT_EQ(163892u, store.get_values_memory_usage().usedBytes()); - EXPECT_EQ(262120u, store.get_dictionary_memory_usage().allocatedBytes()); - EXPECT_EQ(164176u, store.get_dictionary_memory_usage().usedBytes()); - EXPECT_EQ(426028u, store.getMemoryUsage().allocatedBytes()); - EXPECT_EQ(328068u, store.getMemoryUsage().usedBytes()); + EXPECT_EQ(28740u, store.get_values_memory_usage().allocatedBytes()); + EXPECT_EQ(24804u, store.get_values_memory_usage().usedBytes()); + EXPECT_EQ(126952u, store.get_dictionary_memory_usage().allocatedBytes()); + EXPECT_EQ(25248u, store.get_dictionary_memory_usage().usedBytes()); + EXPECT_EQ(155692u, store.getMemoryUsage().allocatedBytes()); + EXPECT_EQ(50052, store.getMemoryUsage().usedBytes()); } GTEST_MAIN_RUN_ALL_TESTS() |