diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-10-24 21:46:57 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-10-24 21:46:57 +0000 |
commit | 87334d3bff77431a249e15c68182007ba7505534 (patch) | |
tree | b710f613c7b0e9ff4c77bd1beac040df5136c970 /eval | |
parent | c65802a4b5811e890cc578afc3f651ec8835cd74 (diff) |
Add dimension memory cost too.
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/tests/eval/fast_value/fast_value_test.cpp | 12 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/fast_value.hpp | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/eval/src/tests/eval/fast_value/fast_value_test.cpp b/eval/src/tests/eval/fast_value/fast_value_test.cpp index 72c9df397de..2332ab3bf8a 100644 --- a/eval/src/tests/eval/fast_value/fast_value_test.cpp +++ b/eval/src/tests/eval/fast_value/fast_value_test.cpp @@ -152,13 +152,13 @@ verifyFastValueSize(TensorSpec spec, uint32_t elems, size_t expected) { TEST(FastValueTest, document_fast_value_memory_usage) { EXPECT_EQ(232, sizeof(FastValue<float,true>)); FastValue<float,true> test(ValueType::from_spec("tensor<float>(country{})"), 1, 1, 1); - EXPECT_EQ(340, test.get_memory_usage().allocatedBytes()); + EXPECT_EQ(412, test.get_memory_usage().allocatedBytes()); - verifyFastValueSize(TensorSpec("tensor<float>(country{})"), 1, 340); - verifyFastValueSize(TensorSpec("tensor<float>(country{})"), 10, 720); - verifyFastValueSize(TensorSpec("tensor<float>(country{})"), 20, 1208); - verifyFastValueSize(TensorSpec("tensor<float>(country{})"), 50, 2224); - verifyFastValueSize(TensorSpec("tensor<float>(country{})"), 100, 4216); + verifyFastValueSize(TensorSpec("tensor<float>(country{})"), 1, 412); + verifyFastValueSize(TensorSpec("tensor<float>(country{})"), 10, 792); + verifyFastValueSize(TensorSpec("tensor<float>(country{})"), 20, 1280); + verifyFastValueSize(TensorSpec("tensor<float>(country{})"), 50, 2296); + verifyFastValueSize(TensorSpec("tensor<float>(country{})"), 100, 4288); } using SA = std::vector<vespalib::stringref>; diff --git a/eval/src/vespa/eval/eval/fast_value.hpp b/eval/src/vespa/eval/eval/fast_value.hpp index 0ad5124a6c9..cc9eb663b76 100644 --- a/eval/src/vespa/eval/eval/fast_value.hpp +++ b/eval/src/vespa/eval/eval/fast_value.hpp @@ -36,7 +36,7 @@ struct FastCells { size_t capacity; size_t size; mutable alloc::Alloc memory; - FastCells(size_t initial_capacity); + explicit FastCells(size_t initial_capacity); FastCells(const FastCells &) = delete; FastCells & operator = (const FastCells &) = delete; ~FastCells(); @@ -184,6 +184,7 @@ struct FastValue final : Value, ValueBuilder<T> { } MemoryUsage get_memory_usage() const override { MemoryUsage usage = self_memory_usage<FastValue<T,transient>>(); + usage.merge(vector_extra_memory_usage(my_type.dimensions())); usage.merge(vector_extra_memory_usage(get_view(my_handles))); usage.merge(my_index.map.estimate_extra_memory_usage()); usage.merge(my_cells.estimate_extra_memory_usage()); |