summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/CMakeLists.txt1
-rw-r--r--searchlib/src/tests/attribute/attribute_test.cpp2
-rw-r--r--searchlib/src/tests/attribute/enumstore/enumstore_test.cpp6
-rw-r--r--searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp2
-rw-r--r--searchlib/src/tests/btree/btree_test.cpp8
-rw-r--r--searchlib/src/tests/common/rcuvector/.gitignore4
-rw-r--r--searchlib/src/tests/common/rcuvector/CMakeLists.txt8
-rw-r--r--searchlib/src/tests/common/rcuvector/rcuvector_test.cpp301
-rw-r--r--searchlib/src/tests/datastore/array_store/array_store_test.cpp2
-rw-r--r--searchlib/src/tests/datastore/datastore/datastore_test.cpp6
-rw-r--r--searchlib/src/tests/datastore/unique_store/unique_store_test.cpp2
-rw-r--r--searchlib/src/tests/docstore/document_store/document_store_test.cpp2
-rw-r--r--searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp4
-rw-r--r--searchlib/src/tests/memoryindex/compact_words_store/compact_words_store_test.cpp1
-rw-r--r--searchlib/src/tests/predicate/simple_index_test.cpp2
-rw-r--r--searchlib/src/tests/util/searchable_stats/searchable_stats_test.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/changevector.h6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/changevector.hpp6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp14
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstorebase.h10
-rw-r--r--searchlib/src/vespa/searchlib/attribute/floatbase.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/floatbase.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/integerbase.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/integerbase.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/ipostinglistattributebase.h14
-rw-r--r--searchlib/src/vespa/searchlib/attribute/load_utils.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp7
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp12
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.h14
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multienumattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postingstore.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postingstore.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/attribute/predicate_attribute.h6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/reference_attribute.h6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/reference_attribute_saver.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/reference_mappings.h8
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singleenumattribute.h6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/stringbase.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/stringbase.h2
-rw-r--r--searchlib/src/vespa/searchlib/btree/btree.h2
-rw-r--r--searchlib/src/vespa/searchlib/btree/btreenodeallocator.h4
-rw-r--r--searchlib/src/vespa/searchlib/btree/btreenodeallocator.hpp4
-rw-r--r--searchlib/src/vespa/searchlib/btree/btreenodestore.h2
-rw-r--r--searchlib/src/vespa/searchlib/btree/btreestore.h4
-rw-r--r--searchlib/src/vespa/searchlib/common/CMakeLists.txt1
-rw-r--r--searchlib/src/vespa/searchlib/common/condensedbitvectors.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/common/rcuvector.cpp37
-rw-r--r--searchlib/src/vespa/searchlib/common/rcuvector.h163
-rw-r--r--searchlib/src/vespa/searchlib/common/rcuvector.hpp205
-rw-r--r--searchlib/src/vespa/searchlib/datastore/array_store.h2
-rw-r--r--searchlib/src/vespa/searchlib/datastore/datastore.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/datastore/datastorebase.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/datastore/datastorebase.h6
-rw-r--r--searchlib/src/vespa/searchlib/datastore/unique_store.h2
-rw-r--r--searchlib/src/vespa/searchlib/datastore/unique_store.hpp4
-rw-r--r--searchlib/src/vespa/searchlib/docstore/chunk.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/docstore/chunk.h4
-rw-r--r--searchlib/src/vespa/searchlib/docstore/documentstore.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/docstore/documentstore.h2
-rw-r--r--searchlib/src/vespa/searchlib/docstore/filechunk.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/docstore/filechunk.h4
-rw-r--r--searchlib/src/vespa/searchlib/docstore/idatastore.h4
-rw-r--r--searchlib/src/vespa/searchlib/docstore/idocumentstore.h2
-rw-r--r--searchlib/src/vespa/searchlib/docstore/logdatastore.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/docstore/logdatastore.h7
-rw-r--r--searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h2
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/compact_words_store.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/compact_words_store.h6
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/feature_store.h2
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_index.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_index.h4
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_index_collection.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_index_collection.h2
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/memory_index.h4
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/word_store.h2
-rw-r--r--searchlib/src/vespa/searchlib/predicate/document_features_store.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/predicate/document_features_store.h2
-rw-r--r--searchlib/src/vespa/searchlib/predicate/predicate_index.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/predicate/predicate_index.h2
-rw-r--r--searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h2
-rw-r--r--searchlib/src/vespa/searchlib/predicate/simple_index.h14
-rw-r--r--searchlib/src/vespa/searchlib/predicate/simple_index.hpp8
-rw-r--r--searchlib/src/vespa/searchlib/tensor/generic_tensor_attribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/tensor/tensor_attribute.h4
-rw-r--r--searchlib/src/vespa/searchlib/tensor/tensor_store.h2
-rw-r--r--searchlib/src/vespa/searchlib/test/datastore/memstats.h10
-rw-r--r--searchlib/src/vespa/searchlib/util/memoryusage.h60
-rw-r--r--searchlib/src/vespa/searchlib/util/searchable_stats.h8
116 files changed, 216 insertions, 1000 deletions
diff --git a/searchlib/CMakeLists.txt b/searchlib/CMakeLists.txt
index 10231fb4634..bde467087da 100644
--- a/searchlib/CMakeLists.txt
+++ b/searchlib/CMakeLists.txt
@@ -103,7 +103,6 @@ vespa_define_module(
src/tests/common/foregroundtaskexecutor
src/tests/common/location
src/tests/common/packets
- src/tests/common/rcuvector
src/tests/common/resultset
src/tests/common/sequencedtaskexecutor
src/tests/common/summaryfeatures
diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp
index 537fa07bada..c71e51b2040 100644
--- a/searchlib/src/tests/attribute/attribute_test.cpp
+++ b/searchlib/src/tests/attribute/attribute_test.cpp
@@ -1816,7 +1816,7 @@ AttributeTest::testGeneration(const AttributePtr & attr, bool exactStatus)
EXPECT_EQUAL(1u, ia.getCurrentGeneration());
uint64_t lastAllocated;
uint64_t lastOnHold;
- MemoryUsage changeVectorMemoryUsage(attr->getChangeVectorMemoryUsage());
+ vespalib::MemoryUsage changeVectorMemoryUsage(attr->getChangeVectorMemoryUsage());
size_t changeVectorAllocated = changeVectorMemoryUsage.allocatedBytes();
if (exactStatus) {
EXPECT_EQUAL(2u + changeVectorAllocated, ia.getStatus().getAllocated());
diff --git a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp
index 0bcee1fcb02..c71f75fd396 100644
--- a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp
+++ b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp
@@ -702,7 +702,7 @@ EnumStoreTest::testMemoryUsage()
uint32_t entrySize = StringEnumStore::alignEntrySize(8 + 1 + 5); // enum(4) + refcount(4) + 1(\0) + strlen("enumx")
// usage before inserting enums
- MemoryUsage usage = ses.getMemoryUsage();
+ vespalib::MemoryUsage usage = ses.getMemoryUsage();
EXPECT_EQUAL(ses.getNumUniques(), uint32_t(0));
// Note: Sizes of underlying data store buffers are power of 2.
EXPECT_EQUAL(vespalib::roundUp2inN(enumStoreAlign(200u) + RESERVED_BYTES), usage.allocatedBytes());
@@ -748,7 +748,7 @@ EnumStoreTest::testMemoryUsage()
ses.performCompaction(400, old2New);
// usage after compaction
- MemoryUsage usage2 = ses.getMemoryUsage();
+ vespalib::MemoryUsage usage2 = ses.getMemoryUsage();
EXPECT_EQUAL(ses.getNumUniques(), num / 2);
EXPECT_EQUAL(usage.usedBytes() + (num / 2) * entrySize, usage2.usedBytes());
EXPECT_EQUAL(usage.deadBytes(), usage2.deadBytes());
@@ -758,7 +758,7 @@ EnumStoreTest::testMemoryUsage()
ses.trimHoldLists(sesGen + 1);
// usage after hold list trimming
- MemoryUsage usage3 = ses.getMemoryUsage();
+ vespalib::MemoryUsage usage3 = ses.getMemoryUsage();
EXPECT_EQUAL((num / 2) * entrySize, usage3.usedBytes());
EXPECT_EQUAL(0u, usage3.deadBytes());
EXPECT_EQUAL(0u, usage3.allocatedBytesOnHold());
diff --git a/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp b/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp
index def939aa725..e534153d004 100644
--- a/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp
+++ b/searchlib/src/tests/attribute/reference_attribute/reference_attribute_test.cpp
@@ -12,7 +12,7 @@ LOG_SETUP("reference_attribute_test");
#include <vespa/searchlib/test/mock_gid_to_lid_mapping.h>
#include <vespa/document/base/documentid.h>
-using search::MemoryUsage;
+using vespalib::MemoryUsage;
using vespalib::ArrayRef;
using generation_t = vespalib::GenerationHandler::generation_t;
using search::attribute::Reference;
diff --git a/searchlib/src/tests/btree/btree_test.cpp b/searchlib/src/tests/btree/btree_test.cpp
index 1f39c7315e8..32c3f952e47 100644
--- a/searchlib/src/tests/btree/btree_test.cpp
+++ b/searchlib/src/tests/btree/btree_test.cpp
@@ -172,7 +172,7 @@ private:
bool assertLeafNode(const std::string & exp, const LeafNodeType & n);
bool assertSeek(int skey, int ekey, const MyTree & tree);
bool assertSeek(int skey, int ekey, MyTree::Iterator & itr);
- bool assertMemoryUsage(const MemoryUsage & exp, const MemoryUsage & act);
+ bool assertMemoryUsage(const vespalib::MemoryUsage & exp, const vespalib::MemoryUsage & act);
void
buildSubTree(const std::vector<LeafPair> &sub,
@@ -251,7 +251,7 @@ Test::assertSeek(int skey, int ekey, MyTree::Iterator & itr)
}
bool
-Test::assertMemoryUsage(const MemoryUsage & exp, const MemoryUsage & act)
+Test::assertMemoryUsage(const vespalib::MemoryUsage & exp, const vespalib::MemoryUsage & act)
{
if (!EXPECT_EQUAL(exp.allocatedBytes(), act.allocatedBytes())) return false;
if (!EXPECT_EQUAL(exp.usedBytes(), act.usedBytes())) return false;
@@ -1047,7 +1047,7 @@ Test::requireThatMemoryUsageIsCalculated()
GenerationHandler gh;
gh.incGeneration();
NodeAllocator tm;
- MemoryUsage mu;
+ vespalib::MemoryUsage mu;
const uint32_t initialInternalNodes = 128u;
const uint32_t initialLeafNodes = 128u;
mu.incAllocatedBytes(adjustAllocatedBytes(initialInternalNodes, sizeof(INode)));
@@ -1079,7 +1079,7 @@ Test::requireThatMemoryUsageIsCalculated()
tm.transferHoldLists(gh.getCurrentGeneration());
gh.incGeneration();
tm.trimHoldLists(gh.getFirstUsedGeneration());
- mu = MemoryUsage();
+ mu = vespalib::MemoryUsage();
mu.incAllocatedBytes(adjustAllocatedBytes(initialInternalNodes, sizeof(INode)));
mu.incAllocatedBytes(adjustAllocatedBytes(initialLeafNodes, sizeof(LNode)));
mu.incUsedBytes(sizeof(INode) * 2);
diff --git a/searchlib/src/tests/common/rcuvector/.gitignore b/searchlib/src/tests/common/rcuvector/.gitignore
deleted file mode 100644
index d88533ed6af..00000000000
--- a/searchlib/src/tests/common/rcuvector/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.depend
-Makefile
-rcuvector_test
-searchlib_rcuvector_test_app
diff --git a/searchlib/src/tests/common/rcuvector/CMakeLists.txt b/searchlib/src/tests/common/rcuvector/CMakeLists.txt
deleted file mode 100644
index 074e94ea61c..00000000000
--- a/searchlib/src/tests/common/rcuvector/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(searchlib_rcuvector_test_app TEST
- SOURCES
- rcuvector_test.cpp
- DEPENDS
- searchlib
-)
-vespa_add_test(NAME searchlib_rcuvector_test_app COMMAND searchlib_rcuvector_test_app)
diff --git a/searchlib/src/tests/common/rcuvector/rcuvector_test.cpp b/searchlib/src/tests/common/rcuvector/rcuvector_test.cpp
deleted file mode 100644
index dfd8bd97fed..00000000000
--- a/searchlib/src/tests/common/rcuvector/rcuvector_test.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/searchlib/common/rcuvector.h>
-
-using namespace search::attribute;
-using search::MemoryUsage;
-using vespalib::alloc::Alloc;
-using vespalib::GenerationHandler;
-using vespalib::GenerationHolder;
-using vespalib::GenerationHeldBase;
-
-bool
-assertUsage(const MemoryUsage & exp, const MemoryUsage & act)
-{
- bool retval = true;
- if (!EXPECT_EQUAL(exp.allocatedBytes(), act.allocatedBytes())) retval = false;
- if (!EXPECT_EQUAL(exp.usedBytes(), act.usedBytes())) retval = false;
- if (!EXPECT_EQUAL(exp.deadBytes(), act.deadBytes())) retval = false;
- if (!EXPECT_EQUAL(exp.allocatedBytesOnHold(), act.allocatedBytesOnHold())) retval = false;
- return retval;
-}
-
-TEST("test generation holder")
-{
- typedef std::unique_ptr<int32_t> IntPtr;
- GenerationHolder gh;
- gh.hold(GenerationHeldBase::UP(new RcuVectorHeld<int32_t>(sizeof(int32_t),
- IntPtr(new int32_t(0)))));
- gh.transferHoldLists(0);
- gh.hold(GenerationHeldBase::UP(new RcuVectorHeld<int32_t>(sizeof(int32_t),
- IntPtr(new int32_t(1)))));
- gh.transferHoldLists(1);
- gh.hold(GenerationHeldBase::UP(new RcuVectorHeld<int32_t>(sizeof(int32_t),
- IntPtr(new int32_t(2)))));
- gh.transferHoldLists(2);
- gh.hold(GenerationHeldBase::UP(new RcuVectorHeld<int32_t>(sizeof(int32_t),
- IntPtr(new int32_t(4)))));
- gh.transferHoldLists(4);
- EXPECT_EQUAL(4u * sizeof(int32_t), gh.getHeldBytes());
- gh.trimHoldLists(0);
- EXPECT_EQUAL(4u * sizeof(int32_t), gh.getHeldBytes());
- gh.trimHoldLists(1);
- EXPECT_EQUAL(3u * sizeof(int32_t), gh.getHeldBytes());
- gh.trimHoldLists(2);
- EXPECT_EQUAL(2u * sizeof(int32_t), gh.getHeldBytes());
- gh.hold(GenerationHeldBase::UP(new RcuVectorHeld<int32_t>(sizeof(int32_t),
- IntPtr(new int32_t(6)))));
- gh.transferHoldLists(6);
- EXPECT_EQUAL(3u * sizeof(int32_t), gh.getHeldBytes());
- gh.trimHoldLists(6);
- EXPECT_EQUAL(1u * sizeof(int32_t), gh.getHeldBytes());
- gh.trimHoldLists(7);
- EXPECT_EQUAL(0u * sizeof(int32_t), gh.getHeldBytes());
- gh.trimHoldLists(7);
- EXPECT_EQUAL(0u * sizeof(int32_t), gh.getHeldBytes());
-}
-
-TEST("test basic")
-{
- { // insert
- RcuVector<int32_t> v(4, 0, 4);
- for (int32_t i = 0; i < 100; ++i) {
- v.push_back(i);
- EXPECT_EQUAL(i, v[i]);
- EXPECT_EQUAL((size_t)i + 1, v.size());
- }
- for (int32_t i = 0; i < 100; ++i) {
- v[i] = i + 1;
- EXPECT_EQUAL(i + 1, v[i]);
- EXPECT_EQUAL(100u, v.size());
- }
- }
-}
-
-TEST("test resize")
-{
- { // resize percent
- RcuVector<int32_t> v(2, 50, 0);
- EXPECT_EQUAL(2u, v.capacity());
- v.push_back(0);
- EXPECT_EQUAL(2u, v.capacity());
- v.push_back(0);
- EXPECT_EQUAL(2u, v.capacity());
- EXPECT_TRUE(v.isFull());
- v.push_back(0);
- EXPECT_EQUAL(3u, v.capacity());
- EXPECT_TRUE(v.isFull());
- }
- { // resize delta
- RcuVector<int32_t> v(1, 0, 3);
- EXPECT_EQUAL(1u, v.capacity());
- v.push_back(0);
- EXPECT_EQUAL(1u, v.capacity());
- EXPECT_TRUE(v.isFull());
- v.push_back(0);
- EXPECT_EQUAL(4u, v.capacity());
- EXPECT_TRUE(!v.isFull());
- }
- { // resize both
- RcuVector<int32_t> v(2, 200, 3);
- EXPECT_EQUAL(2u, v.capacity());
- v.push_back(0);
- EXPECT_EQUAL(2u, v.capacity());
- v.push_back(0);
- EXPECT_EQUAL(2u, v.capacity());
- EXPECT_TRUE(v.isFull());
- v.push_back(0);
- EXPECT_EQUAL(9u, v.capacity());
- EXPECT_TRUE(!v.isFull());
- }
- { // reserve
- RcuVector<int32_t> v(2, 0, 0);
- EXPECT_EQUAL(2u, v.capacity());
- v.unsafe_reserve(8);
- EXPECT_EQUAL(8u, v.capacity());
- }
- { // explicit resize
- GenerationHolder g;
- RcuVectorBase<int8_t> v(g);
- v.push_back(1);
- v.push_back(2);
- g.transferHoldLists(0);
- g.trimHoldLists(1);
- const int8_t *old = &v[0];
- EXPECT_EQUAL(16u, v.capacity());
- EXPECT_EQUAL(2u, v.size());
- v.ensure_size(32, 3);
- v[0] = 3;
- v[1] = 3;
- g.transferHoldLists(1);
- EXPECT_EQUAL(1, old[0]);
- EXPECT_EQUAL(2, old[1]);
- EXPECT_EQUAL(3, v[0]);
- EXPECT_EQUAL(3, v[1]);
- EXPECT_EQUAL(3, v[2]);
- EXPECT_EQUAL(3, v[31]);
- EXPECT_EQUAL(64u, v.capacity());
- EXPECT_EQUAL(32u, v.size());
- g.trimHoldLists(2);
- }
-}
-
-TEST("test generation handling")
-{
- RcuVector<int32_t> v(2, 0, 2);
- v.push_back(0);
- v.push_back(10);
- EXPECT_EQUAL(0u, v.getMemoryUsage().allocatedBytesOnHold());
- v.push_back(20); // new array
- EXPECT_EQUAL(8u, v.getMemoryUsage().allocatedBytesOnHold());
-
- v.setGeneration(1);
- v.push_back(30);
- EXPECT_EQUAL(8u, v.getMemoryUsage().allocatedBytesOnHold());
- v.push_back(40); // new array
- EXPECT_EQUAL(24u, v.getMemoryUsage().allocatedBytesOnHold());
-
- v.setGeneration(2);
- v.push_back(50);
- v.removeOldGenerations(3);
- EXPECT_EQUAL(0u, v.getMemoryUsage().allocatedBytesOnHold());
- v.push_back(60); // new array
- EXPECT_EQUAL(24u, v.getMemoryUsage().allocatedBytesOnHold());
-}
-
-TEST("test reserve") {
- RcuVector<int32_t> v(2, 0, 2);
- EXPECT_EQUAL(2u, v.capacity());
- EXPECT_EQUAL(0u, v.size());
- v.push_back(0);
- v.push_back(10);
- EXPECT_EQUAL(2u, v.size());
- EXPECT_EQUAL(2u, v.capacity());
- EXPECT_EQUAL(0u, v.getMemoryUsage().allocatedBytesOnHold());
- v.reserve(30);
- EXPECT_EQUAL(2u, v.size());
- EXPECT_EQUAL(32u, v.capacity());
- EXPECT_EQUAL(8u, v.getMemoryUsage().allocatedBytesOnHold());
- v.reserve(32);
- EXPECT_EQUAL(2u, v.size());
- EXPECT_EQUAL(32u, v.capacity());
- EXPECT_EQUAL(8u, v.getMemoryUsage().allocatedBytesOnHold());
- v.reserve(100);
- EXPECT_EQUAL(2u, v.size());
- EXPECT_EQUAL(102u, v.capacity());
- EXPECT_EQUAL(8u + 32u*4u, v.getMemoryUsage().allocatedBytesOnHold());
-}
-
-TEST("test memory usage")
-{
- RcuVector<int8_t> v(2, 0, 2);
- EXPECT_TRUE(assertUsage(MemoryUsage(2,0,0,0), v.getMemoryUsage()));
- v.push_back(0);
- EXPECT_TRUE(assertUsage(MemoryUsage(2,1,0,0), v.getMemoryUsage()));
- v.push_back(1);
- EXPECT_TRUE(assertUsage(MemoryUsage(2,2,0,0), v.getMemoryUsage()));
- v.push_back(2);
- EXPECT_TRUE(assertUsage(MemoryUsage(6,5,0,2), v.getMemoryUsage()));
- v.push_back(3);
- EXPECT_TRUE(assertUsage(MemoryUsage(6,6,0,2), v.getMemoryUsage()));
- v.push_back(4);
- EXPECT_TRUE(assertUsage(MemoryUsage(12,11,0,6), v.getMemoryUsage()));
- v.removeOldGenerations(1);
- EXPECT_TRUE(assertUsage(MemoryUsage(6,5,0,0), v.getMemoryUsage()));
-}
-
-TEST("test shrink() with buffer copying")
-{
- GenerationHolder g;
- RcuVectorBase<int8_t> v(16, 100, 0, g);
- v.push_back(1);
- v.push_back(2);
- v.push_back(3);
- v.push_back(4);
- g.transferHoldLists(0);
- g.trimHoldLists(1);
- MemoryUsage mu;
- mu = v.getMemoryUsage();
- mu.incAllocatedBytesOnHold(g.getHeldBytes());
- EXPECT_TRUE(assertUsage(MemoryUsage(16, 4, 0, 0), mu));
- EXPECT_EQUAL(4u, v.size());
- EXPECT_EQUAL(16u, v.capacity());
- EXPECT_EQUAL(1, v[0]);
- EXPECT_EQUAL(2, v[1]);
- EXPECT_EQUAL(3, v[2]);
- EXPECT_EQUAL(4, v[3]);
- const int8_t *old = &v[0];
- v.shrink(2);
- g.transferHoldLists(1);
- EXPECT_EQUAL(2u, v.size());
- EXPECT_EQUAL(4u, v.capacity());
- EXPECT_EQUAL(1, v[0]);
- EXPECT_EQUAL(2, v[1]);
- EXPECT_EQUAL(1, old[0]);
- EXPECT_EQUAL(2, old[1]);
- g.trimHoldLists(2);
- EXPECT_EQUAL(1, v[0]);
- EXPECT_EQUAL(2, v[1]);
- mu = v.getMemoryUsage();
- mu.incAllocatedBytesOnHold(g.getHeldBytes());
- EXPECT_TRUE(assertUsage(MemoryUsage(4, 2, 0, 0), mu));
-}
-
-struct ShrinkFixture {
- GenerationHolder g;
- RcuVectorBase<int> vec;
- int *oldPtr;
- ShrinkFixture() : g(), vec(4096, 50, 0, g, Alloc::allocMMap()), oldPtr()
- {
- for (size_t i = 0; i < 4000; ++i) {
- vec.push_back(7);
- }
- EXPECT_EQUAL(4000u, vec.size());
- EXPECT_EQUAL(4096u, vec.capacity());
- assertEmptyHoldList();
- oldPtr = &vec[0];
- }
- void assertOldEqualNewBuffer() {
- EXPECT_EQUAL(oldPtr, &vec[0]);
- }
- void assertEmptyHoldList() {
- EXPECT_EQUAL(0u, g.getHeldBytes());
- }
-};
-
-TEST_F("require that shrink() does not increase allocated memory", ShrinkFixture)
-{
- f.vec.shrink(2732);
- EXPECT_EQUAL(2732u, f.vec.size());
- EXPECT_EQUAL(4096u, f.vec.capacity());
- TEST_DO(f.assertOldEqualNewBuffer());
- TEST_DO(f.assertEmptyHoldList());
-}
-
-TEST_F("require that shrink() can shrink mmap allocation", ShrinkFixture)
-{
- f.vec.shrink(2048);
- EXPECT_EQUAL(2048u, f.vec.size());
- EXPECT_EQUAL(3072u, f.vec.capacity());
- TEST_DO(f.assertOldEqualNewBuffer());
- TEST_DO(f.assertEmptyHoldList());
-}
-
-TEST("test small expand")
-{
- GenerationHolder g;
- RcuVectorBase<int8_t> v(1, 50, 0, g);
- EXPECT_EQUAL(1u, v.capacity());
- EXPECT_EQUAL(0u, v.size());
- v.push_back(1);
- EXPECT_EQUAL(1u, v.capacity());
- EXPECT_EQUAL(1u, v.size());
- v.push_back(2);
- EXPECT_EQUAL(2u, v.capacity());
- EXPECT_EQUAL(2u, v.size());
- g.transferHoldLists(1);
- g.trimHoldLists(2);
-}
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchlib/src/tests/datastore/array_store/array_store_test.cpp b/searchlib/src/tests/datastore/array_store/array_store_test.cpp
index b99d74cf475..0af9002ae75 100644
--- a/searchlib/src/tests/datastore/array_store/array_store_test.cpp
+++ b/searchlib/src/tests/datastore/array_store/array_store_test.cpp
@@ -8,7 +8,7 @@
#include <vector>
using namespace search::datastore;
-using search::MemoryUsage;
+using vespalib::MemoryUsage;
using vespalib::ArrayRef;
using generation_t = vespalib::GenerationHandler::generation_t;
using MemStats = search::datastore::test::MemStats;
diff --git a/searchlib/src/tests/datastore/datastore/datastore_test.cpp b/searchlib/src/tests/datastore/datastore/datastore_test.cpp
index c364bc2b0e3..281e5d52365 100644
--- a/searchlib/src/tests/datastore/datastore/datastore_test.cpp
+++ b/searchlib/src/tests/datastore/datastore/datastore_test.cpp
@@ -133,7 +133,7 @@ public:
++i;
}
}
- MemoryUsage getMemoryUsage() const { return _store.getMemoryUsage(); }
+ vespalib::MemoryUsage getMemoryUsage() const { return _store.getMemoryUsage(); }
};
using MyRef = MyStore::RefType;
@@ -461,7 +461,7 @@ TEST(DataStoreTest, require_that_memory_usage_is_calculated)
s.incDead(r, 1);
s.holdBuffer(r.bufferId());
s.transferHoldLists(100);
- MemoryUsage m = s.getMemoryUsage();
+ vespalib::MemoryUsage m = s.getMemoryUsage();
EXPECT_EQ(MyRef::offsetSize() * sizeof(int), m.allocatedBytes());
EXPECT_EQ(5 * sizeof(int), m.usedBytes());
EXPECT_EQ(2 * sizeof(int), m.deadBytes());
@@ -476,7 +476,7 @@ TEST(DataStoreTest, require_that_we_can_disable_elemement_hold_list)
MyRef r2 = s.addEntry(20);
MyRef r3 = s.addEntry(30);
(void) r3;
- MemoryUsage m = s.getMemoryUsage();
+ vespalib::MemoryUsage m = s.getMemoryUsage();
EXPECT_EQ(MyRef::offsetSize() * sizeof(int), m.allocatedBytes());
EXPECT_EQ(4 * sizeof(int), m.usedBytes());
EXPECT_EQ(1 * sizeof(int), m.deadBytes());
diff --git a/searchlib/src/tests/datastore/unique_store/unique_store_test.cpp b/searchlib/src/tests/datastore/unique_store/unique_store_test.cpp
index f92f0c0b405..d60144c18f1 100644
--- a/searchlib/src/tests/datastore/unique_store/unique_store_test.cpp
+++ b/searchlib/src/tests/datastore/unique_store/unique_store_test.cpp
@@ -9,7 +9,7 @@ LOG_SETUP("unique_store_test");
#include <vector>
using namespace search::datastore;
-using search::MemoryUsage;
+using vespalib::MemoryUsage;
using vespalib::ArrayRef;
using generation_t = vespalib::GenerationHandler::generation_t;
using MemStats = search::datastore::test::MemStats;
diff --git a/searchlib/src/tests/docstore/document_store/document_store_test.cpp b/searchlib/src/tests/docstore/document_store/document_store_test.cpp
index 649fb675dca..3597de0dcc5 100644
--- a/searchlib/src/tests/docstore/document_store/document_store_test.cpp
+++ b/searchlib/src/tests/docstore/document_store/document_store_test.cpp
@@ -33,7 +33,7 @@ struct NullDataStore : IDataStore {
DataStoreStorageStats getStorageStats() const override {
return DataStoreStorageStats(0, 0, 0.0, 0, 0, 0);
}
- MemoryUsage getMemoryUsage() const override { return MemoryUsage(); }
+ vespalib::MemoryUsage getMemoryUsage() const override { return vespalib::MemoryUsage(); }
std::vector<DataStoreFileChunkStats>
getFileChunkStats() const override {
std::vector<DataStoreFileChunkStats> result;
diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
index 436bfd97d8f..d636de46426 100644
--- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
+++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
@@ -984,12 +984,12 @@ TEST_F("require that lid space can be compacted and shrunk", Fixture)
EXPECT_FALSE(f.store.canShrinkLidSpace());
f.compactLidSpace(2);
- MemoryUsage before = f.store.getMemoryUsage();
+ vespalib::MemoryUsage before = f.store.getMemoryUsage();
EXPECT_TRUE(f.store.canShrinkLidSpace());
EXPECT_EQUAL(8u, f.store.getEstimatedShrinkLidSpaceGain()); // one lid info entry
f.store.shrinkLidSpace();
- MemoryUsage after = f.store.getMemoryUsage();
+ vespalib::MemoryUsage after = f.store.getMemoryUsage();
EXPECT_LESS(after.usedBytes(), before.usedBytes());
EXPECT_EQUAL(8u, before.usedBytes() - after.usedBytes());
}
diff --git a/searchlib/src/tests/memoryindex/compact_words_store/compact_words_store_test.cpp b/searchlib/src/tests/memoryindex/compact_words_store/compact_words_store_test.cpp
index 04d66396f90..a78e4dead86 100644
--- a/searchlib/src/tests/memoryindex/compact_words_store/compact_words_store_test.cpp
+++ b/searchlib/src/tests/memoryindex/compact_words_store/compact_words_store_test.cpp
@@ -11,6 +11,7 @@
using namespace search;
using namespace search::datastore;
using namespace search::memoryindex;
+using vespalib::MemoryUsage;
typedef CompactWordsStore::Builder Builder;
typedef CompactWordsStore::Iterator Iterator;
diff --git a/searchlib/src/tests/predicate/simple_index_test.cpp b/searchlib/src/tests/predicate/simple_index_test.cpp
index 928897f2134..c9cce14784f 100644
--- a/searchlib/src/tests/predicate/simple_index_test.cpp
+++ b/searchlib/src/tests/predicate/simple_index_test.cpp
@@ -64,7 +64,7 @@ const auto config = SimpleIndexConfig(UPPER_DOCID_FREQ_THRESHOLD,
LOWER_VECTOR_SIZE_THRESHOLD,
VECTOR_PRUNE_FREQUENCY,
FOREACH_VECTOR_THRESHOLD,
- GrowStrategy());
+ vespalib::GrowStrategy());
struct Fixture {
GenerationHolder _generation_holder;
SimpleDocIdLimitProvider _limit_provider;
diff --git a/searchlib/src/tests/util/searchable_stats/searchable_stats_test.cpp b/searchlib/src/tests/util/searchable_stats/searchable_stats_test.cpp
index f0dd6be6197..c91214f5cfe 100644
--- a/searchlib/src/tests/util/searchable_stats/searchable_stats_test.cpp
+++ b/searchlib/src/tests/util/searchable_stats/searchable_stats_test.cpp
@@ -22,7 +22,7 @@ Test::Main()
EXPECT_EQUAL(0u, stats.sizeOnDisk());
{
SearchableStats rhs;
- EXPECT_EQUAL(&rhs.memoryUsage(MemoryUsage(100,0,0,0)), &rhs);
+ EXPECT_EQUAL(&rhs.memoryUsage(vespalib::MemoryUsage(100,0,0,0)), &rhs);
EXPECT_EQUAL(&rhs.docsInMemory(10), &rhs);
EXPECT_EQUAL(&rhs.sizeOnDisk(1000), &rhs);
EXPECT_EQUAL(&stats.add(rhs), &stats);
@@ -30,7 +30,7 @@ Test::Main()
EXPECT_EQUAL(100u, stats.memoryUsage().allocatedBytes());
EXPECT_EQUAL(10u, stats.docsInMemory());
EXPECT_EQUAL(1000u, stats.sizeOnDisk());
- EXPECT_EQUAL(&stats.add(SearchableStats().memoryUsage(MemoryUsage(100,0,0,0)).docsInMemory(10).sizeOnDisk(1000)), &stats);
+ EXPECT_EQUAL(&stats.add(SearchableStats().memoryUsage(vespalib::MemoryUsage(100,0,0,0)).docsInMemory(10).sizeOnDisk(1000)), &stats);
EXPECT_EQUAL(200u, stats.memoryUsage().allocatedBytes());
EXPECT_EQUAL(20u, stats.docsInMemory());
EXPECT_EQUAL(2000u, stats.sizeOnDisk());
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index fbf752d3893..1ac536224af 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -818,10 +818,10 @@ AttributeVector::makeReadGuard(bool stableEnumGuard) const
return std::make_unique<ReadGuard>(this, _genHandler.takeGuard(), stableEnumGuard ? &_enumLock : nullptr);
}
-MemoryUsage
+vespalib::MemoryUsage
AttributeVector::getChangeVectorMemoryUsage() const
{
- return MemoryUsage(0, 0, 0, 0);
+ return vespalib::MemoryUsage(0, 0, 0, 0);
}
void
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index 58779a17e00..92b11d8f360 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -16,10 +16,10 @@
#include <vespa/searchlib/common/address_space.h>
#include <vespa/searchlib/common/i_compactable_lid_space.h>
#include <vespa/searchlib/common/identifiable.h>
-#include <vespa/searchlib/common/rcuvector.h>
#include <vespa/searchlib/queryeval/searchiterator.h>
#include <vespa/vespalib/objects/identifiable.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/rcuvector.h>
#include <vespa/fastos/time.h>
#include <cmath>
#include <mutex>
@@ -662,7 +662,7 @@ public:
static bool isEnumerated(const vespalib::GenericHeader &header);
- virtual MemoryUsage getChangeVectorMemoryUsage() const;
+ virtual vespalib::MemoryUsage getChangeVectorMemoryUsage() const;
};
}
diff --git a/searchlib/src/vespa/searchlib/attribute/changevector.h b/searchlib/src/vespa/searchlib/attribute/changevector.h
index e28f230b49a..75eac911f6c 100644
--- a/searchlib/src/vespa/searchlib/attribute/changevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/changevector.h
@@ -5,9 +5,9 @@
#include <vespa/vespalib/stllike/hash_map.h>
#include <vespa/searchcommon/common/undefinedvalues.h>
-namespace search {
+namespace vespalib { class MemoryUsage; }
-class MemoryUsage;
+namespace search {
struct ChangeBase {
enum Type {
@@ -171,7 +171,7 @@ public:
void clear();
const_iterator begin() const { return const_iterator(_v, 0); }
const_iterator end() const { return const_iterator(_v, size()); }
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
private:
void linkIn(uint32_t doc, size_t index, size_t last);
Vector _v;
diff --git a/searchlib/src/vespa/searchlib/attribute/changevector.hpp b/searchlib/src/vespa/searchlib/attribute/changevector.hpp
index 4b6d0673afc..da18da4e9d5 100644
--- a/searchlib/src/vespa/searchlib/attribute/changevector.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/changevector.hpp
@@ -4,7 +4,7 @@
#include "changevector.h"
#include <vespa/vespalib/util/array.hpp>
-#include <vespa/searchlib/util/memoryusage.h>
+#include <vespa/vespalib/util/memoryusage.h>
namespace search {
@@ -73,12 +73,12 @@ ChangeVectorT<T>::linkIn(uint32_t doc, size_t first, size_t last)
}
template <typename T>
-MemoryUsage
+vespalib::MemoryUsage
ChangeVectorT<T>::getMemoryUsage() const
{
size_t usedBytes = _v.size() * sizeof(T) + _docs.getMemoryUsed();
size_t allocBytes = _v.capacity() * sizeof(T) + _docs.getMemoryConsumption();
- return MemoryUsage(allocBytes, usedBytes, 0, 0);
+ return vespalib::MemoryUsage(allocBytes, usedBytes, 0, 0);
}
} // namespace search
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp b/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp
index 9f3e8bb73c7..6c81feb3bc5 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp
@@ -9,8 +9,8 @@
#include <vespa/searchlib/btree/btreenodeallocator.hpp>
#include <vespa/searchlib/btree/btreeroot.hpp>
#include <vespa/searchlib/util/bufferwriter.h>
-#include <vespa/searchlib/common/rcuvector.hpp>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/rcuvector.hpp>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
@@ -112,7 +112,7 @@ EnumStoreBase::getBufferIndex(datastore::BufferState::State status)
return Index::numBuffers();
}
-MemoryUsage
+vespalib::MemoryUsage
EnumStoreBase::getMemoryUsage() const
{
return _store.getMemoryUsage();
@@ -333,7 +333,7 @@ EnumStoreDict<Dictionary>::getNumUniques() const
template <typename Dictionary>
-MemoryUsage
+vespalib::MemoryUsage
EnumStoreDict<Dictionary>::getTreeMemoryUsage() const
{
return _dict.getMemoryUsage();
@@ -632,10 +632,6 @@ template class EnumStoreDict<EnumTree>;
template class EnumStoreDict<EnumPostingTree>;
-namespace attribute {
- template class RcuVectorBase<EnumStoreIndex>;
-}
-
template
class btree::BTreeNodeT<EnumStoreBase::Index, EnumTreeTraits::INTERNAL_SLOTS>;
@@ -725,6 +721,10 @@ class btree::BTree<EnumStoreBase::Index, datastore::EntryRef, btree::NoAggregate
}
+namespace vespalib {
+template class RcuVectorBase<search::EnumStoreIndex>;
+}
+
VESPALIB_HASH_MAP_INSTANTIATE_H_E_M(search::EnumStoreIndex, search::EnumStoreIndex,
vespalib::hash<search::EnumStoreIndex>, std::equal_to<search::EnumStoreIndex>,
vespalib::hashtable_base::and_modulator);
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h
index c7bba5dd3c6..adbde4253a5 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h
+++ b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h
@@ -5,8 +5,8 @@
#include <vespa/searchcommon/attribute/iattributevector.h>
#include <vespa/searchlib/common/address_space.h>
#include <vespa/searchlib/datastore/datastore.h>
-#include <vespa/searchlib/util/memoryusage.h>
#include <vespa/vespalib/util/array.h>
+#include <vespa/vespalib/util/memoryusage.h>
#include <vespa/vespalib/stllike/hash_map.h>
#include <vespa/searchlib/btree/btree.h>
#include <set>
@@ -66,7 +66,7 @@ public:
virtual void freezeTree() = 0;
virtual uint32_t getNumUniques() const = 0;
- virtual MemoryUsage getTreeMemoryUsage() const = 0;
+ virtual vespalib::MemoryUsage getTreeMemoryUsage() const = 0;
virtual void reEnumerate() = 0;
virtual void writeAllValues(BufferWriter &writer, btree::BTreeNode::Ref rootRef) const = 0;
virtual ssize_t deserialize(const void *src, size_t available, IndexVector &idx) = 0;
@@ -116,7 +116,7 @@ public:
void freezeTree() override;
uint32_t getNumUniques() const override;
- MemoryUsage getTreeMemoryUsage() const override;
+ vespalib::MemoryUsage getTreeMemoryUsage() const override;
void reEnumerate() override;
void writeAllValues(BufferWriter &writer, btree::BTreeNode::Ref rootRef) const override;
ssize_t deserialize(const void *src, size_t available, IndexVector &idx) override;
@@ -297,8 +297,8 @@ public:
uint32_t getCapacity() const {
return _store.getBufferState(_store.getActiveBufferId(TYPE_ID)).capacity();
}
- MemoryUsage getMemoryUsage() const;
- MemoryUsage getTreeMemoryUsage() const { return _enumDict->getTreeMemoryUsage(); }
+ vespalib::MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getTreeMemoryUsage() const { return _enumDict->getTreeMemoryUsage(); }
AddressSpace getAddressSpaceUsage() const;
diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.cpp b/searchlib/src/vespa/searchlib/attribute/floatbase.cpp
index 79a639b6100..813180bc5d7 100644
--- a/searchlib/src/vespa/searchlib/attribute/floatbase.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/floatbase.cpp
@@ -92,7 +92,7 @@ FloatingPointAttribute::getString(DocId doc, char * s, size_t sz) const {
return s;
}
-MemoryUsage
+vespalib::MemoryUsage
FloatingPointAttribute::getChangeVectorMemoryUsage() const
{
return _changes.getMemoryUsage();
diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.h b/searchlib/src/vespa/searchlib/attribute/floatbase.h
index 9e8b19d1f73..892baea742f 100644
--- a/searchlib/src/vespa/searchlib/attribute/floatbase.h
+++ b/searchlib/src/vespa/searchlib/attribute/floatbase.h
@@ -40,7 +40,7 @@ protected:
typedef ChangeVectorT< Change > ChangeVector;
ChangeVector _changes;
- virtual MemoryUsage getChangeVectorMemoryUsage() const override;
+ virtual vespalib::MemoryUsage getChangeVectorMemoryUsage() const override;
private:
uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const override;
uint32_t get(DocId doc, const char ** v, uint32_t sz) const override;
diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp
index d613f264e0d..f065bc63648 100644
--- a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp
@@ -89,7 +89,7 @@ bool IntegerAttribute::apply(DocId doc, const ArithmeticValueUpdate & op)
return retval;
}
-MemoryUsage
+vespalib::MemoryUsage
IntegerAttribute::getChangeVectorMemoryUsage() const
{
return _changes.getMemoryUsage();
diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h
index 9bc1c88bc22..e05952db73e 100644
--- a/searchlib/src/vespa/searchlib/attribute/integerbase.h
+++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h
@@ -39,7 +39,7 @@ protected:
typedef ChangeVectorT< Change > ChangeVector;
ChangeVector _changes;
- MemoryUsage getChangeVectorMemoryUsage() const override;
+ vespalib::MemoryUsage getChangeVectorMemoryUsage() const override;
private:
const char * getString(DocId doc, char * s, size_t sz) const override;
uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const override;
diff --git a/searchlib/src/vespa/searchlib/attribute/ipostinglistattributebase.h b/searchlib/src/vespa/searchlib/attribute/ipostinglistattributebase.h
index 8d44c022062..4652d26f7a3 100644
--- a/searchlib/src/vespa/searchlib/attribute/ipostinglistattributebase.h
+++ b/searchlib/src/vespa/searchlib/attribute/ipostinglistattributebase.h
@@ -2,12 +2,9 @@
#pragma once
+namespace vespalib { class MemoryUsage; }
-namespace search
-{
-
-namespace attribute
-{
+namespace search::attribute {
class IPostingListAttributeBase
{
@@ -23,11 +20,8 @@ public:
uint32_t toLid) = 0;
virtual void forwardedShrinkLidSpace(uint32_t newSize) = 0;
- virtual MemoryUsage getMemoryUsage() const = 0;
+ virtual vespalib::MemoryUsage getMemoryUsage() const = 0;
};
-
-} // namespace attribute
-
-} // namespace search
+} // namespace search::attribute
diff --git a/searchlib/src/vespa/searchlib/attribute/load_utils.cpp b/searchlib/src/vespa/searchlib/attribute/load_utils.cpp
index 47b5ec66a8f..96df7d06b39 100644
--- a/searchlib/src/vespa/searchlib/attribute/load_utils.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/load_utils.cpp
@@ -18,7 +18,7 @@ template uint32_t loadFromEnumeratedMultiValue(MultiValueMapping<Value<ValueType
#define INSTANTIATE_WSET(ValueType, Saver) \
template uint32_t loadFromEnumeratedMultiValue(MultiValueMapping<WeightedValue<ValueType>> &, ReaderBase &, vespalib::ConstArrayRef<ValueType>, Saver)
#define INSTANTIATE_SINGLE(ValueType, Saver) \
-template void loadFromEnumeratedSingleValue(RcuVectorBase<ValueType> &, vespalib::GenerationHolder &, ReaderBase &, vespalib::ConstArrayRef<ValueType>, Saver)
+template void loadFromEnumeratedSingleValue(vespalib::RcuVectorBase<ValueType> &, vespalib::GenerationHolder &, ReaderBase &, vespalib::ConstArrayRef<ValueType>, Saver)
#define INSTANTIATE_SINGLE_ARRAY_WSET(ValueType, Saver) \
INSTANTIATE_SINGLE(ValueType, Saver); \
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h
index dd88393a5e2..30b004cd72f 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h
@@ -27,7 +27,7 @@ public:
MultiValueMapping(const MultiValueMapping &) = delete;
MultiValueMapping & operator = (const MultiValueMapping &) = delete;
MultiValueMapping(const datastore::ArrayStoreConfig &storeCfg,
- const GrowStrategy &gs = GrowStrategy());
+ const vespalib::GrowStrategy &gs = vespalib::GrowStrategy());
~MultiValueMapping() override;
ConstArrayRef get(uint32_t docId) const { return _store.get(_indices[docId]); }
ConstArrayRef getDataForIdx(EntryRef idx) const { return _store.get(idx); }
@@ -47,7 +47,7 @@ public:
void compactWorst(bool compactMemory, bool compactAddressSpace) override;
AddressSpace getAddressSpaceUsage() const override;
- MemoryUsage getArrayStoreMemoryUsage() const override;
+ vespalib::MemoryUsage getArrayStoreMemoryUsage() const override;
static datastore::ArrayStoreConfig optimizedConfigForHugePage(size_t maxSmallArraySize,
size_t hugePageSize,
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp
index 2395cb8b808..bc15a9857d4 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp
@@ -4,12 +4,13 @@
#include "multi_value_mapping.h"
#include <vespa/searchlib/datastore/array_store.hpp>
-#include <vespa/searchlib/common/rcuvector.hpp>
+#include <vespa/vespalib/util/rcuvector.hpp>
namespace search::attribute {
template <typename EntryT, typename RefT>
-MultiValueMapping<EntryT,RefT>::MultiValueMapping(const datastore::ArrayStoreConfig &storeCfg, const GrowStrategy &gs)
+MultiValueMapping<EntryT,RefT>::MultiValueMapping(const datastore::ArrayStoreConfig &storeCfg,
+ const vespalib::GrowStrategy &gs)
: MultiValueMappingBase(gs, _store.getGenerationHolder()),
_store(storeCfg)
{
@@ -54,7 +55,7 @@ MultiValueMapping<EntryT,RefT>::compactWorst(bool compactMemory, bool compactAdd
}
template <typename EntryT, typename RefT>
-MemoryUsage
+vespalib::MemoryUsage
MultiValueMapping<EntryT,RefT>::getArrayStoreMemoryUsage() const
{
return _store.getMemoryUsage();
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp
index bc375845290..552c542b3f7 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp
@@ -13,8 +13,8 @@ constexpr size_t DEAD_ARRAYS_SLACK = 0x10000u;
}
-MultiValueMappingBase::MultiValueMappingBase(const GrowStrategy &gs,
- vespalib::GenerationHolder &genHolder)
+MultiValueMappingBase::MultiValueMappingBase(const vespalib::GrowStrategy &gs,
+ vespalib::GenerationHolder &genHolder)
: _indices(gs, genHolder),
_totalValues(0u),
_cachedArrayStoreMemoryUsage(),
@@ -63,19 +63,19 @@ MultiValueMappingBase::clearDocs(uint32_t lidLow, uint32_t lidLimit, std::functi
}
}
-MemoryUsage
+vespalib::MemoryUsage
MultiValueMappingBase::getMemoryUsage() const
{
- MemoryUsage retval = getArrayStoreMemoryUsage();
+ vespalib::MemoryUsage retval = getArrayStoreMemoryUsage();
retval.merge(_indices.getMemoryUsage());
return retval;
}
-MemoryUsage
+vespalib::MemoryUsage
MultiValueMappingBase::updateStat()
{
_cachedArrayStoreAddressSpaceUsage = getAddressSpaceUsage();
- MemoryUsage retval = getArrayStoreMemoryUsage();
+ vespalib::MemoryUsage retval = getArrayStoreMemoryUsage();
_cachedArrayStoreMemoryUsage = retval;
retval.merge(_indices.getMemoryUsage());
return retval;
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.h b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.h
index faf16a8f624..047bebca003 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.h
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.h
@@ -3,8 +3,8 @@
#pragma once
#include <vespa/searchlib/datastore/entryref.h>
-#include <vespa/searchlib/common/rcuvector.h>
#include <vespa/searchlib/common/address_space.h>
+#include <vespa/vespalib/util/rcuvector.h>
#include <functional>
namespace search { class CompactionStrategy; }
@@ -18,15 +18,15 @@ class MultiValueMappingBase
{
public:
using EntryRef = datastore::EntryRef;
- using RefVector = RcuVectorBase<EntryRef>;
+ using RefVector = vespalib::RcuVectorBase<EntryRef>;
protected:
RefVector _indices;
size_t _totalValues;
- MemoryUsage _cachedArrayStoreMemoryUsage;
+ vespalib::MemoryUsage _cachedArrayStoreMemoryUsage;
AddressSpace _cachedArrayStoreAddressSpaceUsage;
- MultiValueMappingBase(const GrowStrategy &gs, vespalib::GenerationHolder &genHolder);
+ MultiValueMappingBase(const vespalib::GrowStrategy &gs, vespalib::GenerationHolder &genHolder);
virtual ~MultiValueMappingBase();
void updateValueCount(size_t oldValues, size_t newValues) {
@@ -35,10 +35,10 @@ protected:
public:
using RefCopyVector = vespalib::Array<EntryRef>;
- virtual MemoryUsage getArrayStoreMemoryUsage() const = 0;
+ virtual vespalib::MemoryUsage getArrayStoreMemoryUsage() const = 0;
virtual AddressSpace getAddressSpaceUsage() const = 0;
- MemoryUsage getMemoryUsage() const;
- MemoryUsage updateStat();
+ vespalib::MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage updateStat();
size_t getTotalValueCnt() const { return _totalValues; }
RefCopyVector getRefCopy(uint32_t size) const;
diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattribute.h b/searchlib/src/vespa/searchlib/attribute/multienumattribute.h
index ee77baf778f..4dbef0a7955 100644
--- a/searchlib/src/vespa/searchlib/attribute/multienumattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/multienumattribute.h
@@ -79,7 +79,7 @@ protected:
void fillValues(LoadedVector & loaded) override;
void fillEnumIdx(ReaderBase &attrReader, const EnumIndexVector &eidxs, LoadedEnumAttributeVector &loaded) override;
void fillEnumIdx(ReaderBase &attrReader, const EnumIndexVector &eidxs, EnumVector &enumHist) override;
- virtual void mergeMemoryStats(MemoryUsage & total) { (void) total; }
+ virtual void mergeMemoryStats(vespalib::MemoryUsage & total) { (void) total; }
public:
MultiValueEnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg);
diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp
index cb31dbb4b14..720b1c21e8c 100644
--- a/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp
@@ -183,7 +183,7 @@ void
MultiValueEnumAttribute<B, M>::onUpdateStat()
{
// update statistics
- MemoryUsage total;
+ vespalib::MemoryUsage total;
total.merge(this->_enumStore.getMemoryUsage());
total.merge(this->_enumStore.getTreeMemoryUsage());
total.merge(this->_mvMapping.updateStat());
diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp
index f0f9011d934..79018848c94 100644
--- a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp
@@ -75,7 +75,7 @@ MultiValueNumericAttribute<B, M>::onCommit()
template <typename B, typename M>
void MultiValueNumericAttribute<B, M>::onUpdateStat()
{
- MemoryUsage usage = this->_mvMapping.updateStat();
+ vespalib::MemoryUsage usage = this->_mvMapping.updateStat();
usage.merge(this->getChangeVectorMemoryUsage());
this->updateStatistics(this->_mvMapping.getTotalValueCnt(), this->_mvMapping.getTotalValueCnt(), usage.allocatedBytes(),
usage.usedBytes(), usage.deadBytes(), usage.allocatedBytesOnHold());
diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h
index 68aa8d6673c..f1a028de9be 100644
--- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h
@@ -77,7 +77,7 @@ private:
using PostingParent::forwardedOnAddDoc;
void freezeEnumDictionary() override;
- void mergeMemoryStats(MemoryUsage & total) override;
+ void mergeMemoryStats(vespalib::MemoryUsage & total) override;
void applyValueChanges(const DocIndices & docIndices, EnumStoreBase::IndexVector & unused) override;
public:
diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
index 40325cc7270..fe375e7f115 100644
--- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
@@ -15,7 +15,7 @@ MultiValueNumericPostingAttribute<B, M>::freezeEnumDictionary()
template <typename B, typename M>
void
-MultiValueNumericPostingAttribute<B, M>::mergeMemoryStats(MemoryUsage & total)
+MultiValueNumericPostingAttribute<B, M>::mergeMemoryStats(vespalib::MemoryUsage & total)
{
total.merge(this->getPostingList().getMemoryUsage());
}
diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h
index 04f26d232d5..9591cc21149 100644
--- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h
@@ -78,7 +78,7 @@ private:
using PostingParent::forwardedOnAddDoc;
void freezeEnumDictionary() override;
- void mergeMemoryStats(MemoryUsage & total) override;
+ void mergeMemoryStats(vespalib::MemoryUsage & total) override;
void applyValueChanges(const DocIndices & docIndices, EnumStoreBase::IndexVector & unused) override ;
public:
diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
index cc7ec5ec2d9..726c4f5473d 100644
--- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
@@ -61,7 +61,7 @@ MultiValueStringPostingAttributeT<B, T>::freezeEnumDictionary()
template <typename B, typename T>
void
-MultiValueStringPostingAttributeT<B, T>::mergeMemoryStats(MemoryUsage &total)
+MultiValueStringPostingAttributeT<B, T>::mergeMemoryStats(vespalib::MemoryUsage &total)
{
total.merge(this->_postingList.getMemoryUsage());
}
diff --git a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp
index c63f03ed44e..cf707cd290e 100644
--- a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp
@@ -22,7 +22,7 @@ MultiValueAttribute(const vespalib::string &baseFileName,
multivalueattribute::SMALL_MEMORY_PAGE_SIZE,
8 * 1024,
cfg.getGrowStrategy().getMultiValueAllocGrowFactor()),
- cfg.getGrowStrategy())
+ cfg.getGrowStrategy().to_generic_strategy())
{
}
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
index 7750758469b..337ea2e0528 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
@@ -203,7 +203,7 @@ PostingListAttributeBase<P>::forwardedShrinkLidSpace(uint32_t newSize)
}
template <typename P>
-MemoryUsage
+vespalib::MemoryUsage
PostingListAttributeBase<P>::getMemoryUsage() const
{
return _postingList.getMemoryUsage();
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
index a8563ef6027..c180672e798 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
@@ -65,7 +65,7 @@ protected:
uint32_t toLid, EnumStoreComparator &cmp);
void forwardedShrinkLidSpace(uint32_t newSize) override;
- virtual MemoryUsage getMemoryUsage() const override;
+ virtual vespalib::MemoryUsage getMemoryUsage() const override;
public:
const PostingList & getPostingList() const { return _postingList; }
diff --git a/searchlib/src/vespa/searchlib/attribute/postingstore.cpp b/searchlib/src/vespa/searchlib/attribute/postingstore.cpp
index 043777beca8..3f5223118a7 100644
--- a/searchlib/src/vespa/searchlib/attribute/postingstore.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/postingstore.cpp
@@ -615,10 +615,10 @@ PostingStore<DataT>::clear(const EntryRef ref)
template <typename DataT>
-MemoryUsage
+vespalib::MemoryUsage
PostingStore<DataT>::getMemoryUsage() const
{
- MemoryUsage usage;
+ vespalib::MemoryUsage usage;
usage.merge(_allocator.getMemoryUsage());
usage.merge(_store.getMemoryUsage());
uint64_t bvExtraBytes = _bvExtraBytes;
diff --git a/searchlib/src/vespa/searchlib/attribute/postingstore.h b/searchlib/src/vespa/searchlib/attribute/postingstore.h
index b2b01409995..7ca1fa5e641 100644
--- a/searchlib/src/vespa/searchlib/attribute/postingstore.h
+++ b/searchlib/src/vespa/searchlib/attribute/postingstore.h
@@ -175,7 +175,7 @@ public:
}
static inline DataT bitVectorWeight();
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
private:
size_t internalSize(uint32_t typeId, const RefType & iRef) const;
diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp
index d3c2512b2fc..b0e4df65c2b 100644
--- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp
@@ -58,7 +58,8 @@ int64_t adjustUpperBound(int32_t arity, int64_t upper_bound) {
}
SimpleIndexConfig createSimpleIndexConfig(const search::attribute::Config &config) {
- return SimpleIndexConfig(config.predicateParams().dense_posting_list_threshold(), config.getGrowStrategy());
+ return SimpleIndexConfig(config.predicateParams().dense_posting_list_threshold(),
+ config.getGrowStrategy().to_generic_strategy());
}
} // namespace
@@ -72,8 +73,8 @@ PredicateAttribute::PredicateAttribute(const vespalib::string &base_file_name,
_limit_provider, createSimpleIndexConfig(config), config.predicateParams().arity())),
_lower_bound(adjustLowerBound(config.predicateParams().arity(), config.predicateParams().lower_bound())),
_upper_bound(adjustUpperBound(config.predicateParams().arity(), config.predicateParams().upper_bound())),
- _min_feature(config.getGrowStrategy(), getGenerationHolder()),
- _interval_range_vector(config.getGrowStrategy(), getGenerationHolder()),
+ _min_feature(config.getGrowStrategy().to_generic_strategy(), getGenerationHolder()),
+ _interval_range_vector(config.getGrowStrategy().to_generic_strategy(), getGenerationHolder()),
_max_interval_range(1)
{
}
@@ -105,7 +106,7 @@ void
PredicateAttribute::onUpdateStat()
{
// update statistics
- MemoryUsage combined;
+ vespalib::MemoryUsage combined;
combined.merge(_min_feature.getMemoryUsage());
combined.merge(_interval_range_vector.getMemoryUsage());
combined.merge(_index->getMemoryUsage());
diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h
index 12d7f4ee7a2..6e3f0c4399f 100644
--- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.h
@@ -4,7 +4,7 @@
#include "not_implemented_attribute.h"
#include <vespa/searchlib/predicate/common.h>
-#include <vespa/searchlib/common/rcuvector.h>
+#include <vespa/vespalib/util/rcuvector.h>
namespace document { class PredicateFieldValue; }
@@ -36,7 +36,7 @@ public:
typedef uint8_t MinFeature;
typedef std::pair<const MinFeature *, size_t> MinFeatureHandle;
using IntervalRange = uint16_t;
- using IntervalRangeVector = attribute::RcuVectorBase<IntervalRange>;
+ using IntervalRangeVector = vespalib::RcuVectorBase<IntervalRange>;
DECLARE_IDENTIFIABLE_ABSTRACT(PredicateAttribute);
@@ -86,7 +86,7 @@ private:
int64_t _lower_bound;
int64_t _upper_bound;
- typedef attribute::RcuVectorBase<uint8_t> MinFeatureVector;
+ typedef vespalib::RcuVectorBase<uint8_t> MinFeatureVector;
MinFeatureVector _min_feature;
IntervalRangeVector _interval_range_vector;
diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp
index d3fc96d2db2..6cb9def9d8d 100644
--- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp
@@ -180,7 +180,7 @@ ReferenceAttribute::onCommit()
void
ReferenceAttribute::onUpdateStat()
{
- MemoryUsage total = _store.getMemoryUsage();
+ vespalib::MemoryUsage total = _store.getMemoryUsage();
_cachedUniqueStoreMemoryUsage = total;
total.mergeGenerationHeldBytes(getGenerationHolder().getHeldBytes());
total.merge(_indices.getMemoryUsage());
diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.h b/searchlib/src/vespa/searchlib/attribute/reference_attribute.h
index 1670ebdc969..21fb2c7337b 100644
--- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.h
@@ -6,7 +6,7 @@
#include "reference_mappings.h"
#include "reference.h"
#include <vespa/searchlib/datastore/unique_store.h>
-#include <vespa/searchlib/common/rcuvector.h>
+#include <vespa/vespalib/util/rcuvector.h>
namespace search { class IGidToLidMapperFactory; }
@@ -27,7 +27,7 @@ public:
using EntryRef = search::datastore::EntryRef;
using GlobalId = document::GlobalId;
using ReferenceStore = datastore::UniqueStore<Reference>;
- using ReferenceStoreIndices = RcuVectorBase<EntryRef>;
+ using ReferenceStoreIndices = vespalib::RcuVectorBase<EntryRef>;
using IndicesCopyVector = vespalib::Array<EntryRef>;
// Class used to map from target lid to source lids
using ReverseMapping = btree::BTreeStore<uint32_t, btree::BTreeNoLeafData,
@@ -41,7 +41,7 @@ public:
private:
ReferenceStore _store;
ReferenceStoreIndices _indices;
- MemoryUsage _cachedUniqueStoreMemoryUsage;
+ vespalib::MemoryUsage _cachedUniqueStoreMemoryUsage;
std::shared_ptr<IGidToLidMapperFactory> _gidToLidMapperFactory;
ReferenceMappings _referenceMappings;
diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute_saver.h b/searchlib/src/vespa/searchlib/attribute/reference_attribute_saver.h
index 7d85c60c3e6..c86e43d5d95 100644
--- a/searchlib/src/vespa/searchlib/attribute/reference_attribute_saver.h
+++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute_saver.h
@@ -6,7 +6,7 @@
#include <vespa/document/base/globalid.h>
#include <vespa/searchlib/datastore/unique_store.h>
#include <vespa/searchlib/datastore/unique_store_saver.h>
-#include <vespa/searchlib/common/rcuvector.h>
+#include <vespa/vespalib/util/rcuvector.h>
#include "reference_attribute.h"
#include "reference.h"
diff --git a/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp b/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp
index c473e2a40d7..5bba0196d5c 100644
--- a/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp
@@ -140,10 +140,10 @@ ReferenceMappings::shrink(uint32_t docIdLimit)
_targetLids.shrink(docIdLimit);
}
-MemoryUsage
+vespalib::MemoryUsage
ReferenceMappings::getMemoryUsage()
{
- MemoryUsage usage = _reverseMapping.getMemoryUsage();
+ vespalib::MemoryUsage usage = _reverseMapping.getMemoryUsage();
usage.merge(_reverseMappingIndices.getMemoryUsage());
usage.merge(_targetLids.getMemoryUsage());
return usage;
diff --git a/searchlib/src/vespa/searchlib/attribute/reference_mappings.h b/searchlib/src/vespa/searchlib/attribute/reference_mappings.h
index 1e336141811..f9119c6aa02 100644
--- a/searchlib/src/vespa/searchlib/attribute/reference_mappings.h
+++ b/searchlib/src/vespa/searchlib/attribute/reference_mappings.h
@@ -3,7 +3,7 @@
#pragma once
#include <vespa/searchlib/btree/btreestore.h>
-#include <vespa/searchlib/common/rcuvector.h>
+#include <vespa/vespalib/util/rcuvector.h>
#include <atomic>
namespace search::attribute {
@@ -18,7 +18,7 @@ class ReferenceMappings
using GenerationHolder = vespalib::GenerationHolder;
using EntryRef = search::datastore::EntryRef;
// Classes used to map from target lid to source lids
- using ReverseMappingIndices = RcuVectorBase<EntryRef>;
+ using ReverseMappingIndices = vespalib::RcuVectorBase<EntryRef>;
using ReverseMapping = btree::BTreeStore<uint32_t, btree::BTreeNoLeafData,
btree::NoAggregated,
std::less<uint32_t>,
@@ -35,7 +35,7 @@ class ReferenceMappings
// source lids.
ReverseMapping _reverseMapping;
// vector containing target lid given source lid
- RcuVectorBase<uint32_t> _targetLids;
+ vespalib::RcuVectorBase<uint32_t> _targetLids;
const uint32_t &_committedDocIdLimit;
void syncForwardMapping(const Reference &entry);
@@ -74,7 +74,7 @@ public:
// Setup mapping after load
void buildReverseMapping(const Reference &entry, const std::vector<ReverseMapping::KeyDataType> &adds);
- MemoryUsage getMemoryUsage();
+ vespalib::MemoryUsage getMemoryUsage();
// Reader API, reader must hold generation guard
template <typename FunctionType>
diff --git a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
index e4342f08f09..42802cdd5db 100644
--- a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
@@ -83,7 +83,7 @@ SingleBoolAttribute::onAddDocs(DocId docIdLimit) {
void
SingleBoolAttribute::onUpdateStat() {
- MemoryUsage usage;
+ vespalib::MemoryUsage usage;
usage.setAllocatedBytes(_bv.extraByteSize());
usage.setUsedBytes(_bv.sizeBytes());
usage.mergeGenerationHeldBytes(getGenerationHolder().getHeldBytes());
diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h
index 787c8a3d5d5..4abb07cc610 100644
--- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h
@@ -3,7 +3,7 @@
#pragma once
#include "enumattribute.h"
-#include <vespa/searchlib/common/rcuvector.h>
+#include <vespa/vespalib/util/rcuvector.h>
namespace search {
@@ -19,7 +19,7 @@ class SingleValueEnumAttributeBase
{
protected:
typedef EnumStoreBase::Index EnumIndex;
- typedef search::attribute::RcuVectorBase<EnumIndex> EnumIndexVector;
+ typedef vespalib::RcuVectorBase<EnumIndex> EnumIndexVector;
typedef AttributeVector::DocId DocId;
typedef AttributeVector::EnumHandle EnumHandle;
typedef vespalib::GenerationHolder GenerationHolder;
@@ -83,7 +83,7 @@ protected:
this->getEnumStore().freezeTree();
}
- virtual void mergeMemoryStats(MemoryUsage & total) { (void) total; }
+ virtual void mergeMemoryStats(vespalib::MemoryUsage & total) { (void) total; }
void fillValues(LoadedVector & loaded) override;
diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp
index 5648242dd42..4f5cd3f4276 100644
--- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp
@@ -98,7 +98,7 @@ void
SingleValueEnumAttribute<B>::onUpdateStat()
{
// update statistics
- MemoryUsage total = _enumIndices.getMemoryUsage();
+ vespalib::MemoryUsage total = _enumIndices.getMemoryUsage();
total.mergeGenerationHeldBytes(getGenerationHolder().getHeldBytes());
total.merge(this->_enumStore.getMemoryUsage());
total.merge(this->_enumStore.getTreeMemoryUsage());
diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h
index 14f1a25ff40..123072a328f 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.h
@@ -4,7 +4,7 @@
#include "integerbase.h"
#include "floatbase.h"
-#include <vespa/searchlib/common/rcuvector.h>
+#include <vespa/vespalib/util/rcuvector.h>
#include <limits>
namespace search {
@@ -24,7 +24,7 @@ private:
typedef typename B::generation_t generation_t;
using B::getGenerationHolder;
- typedef attribute::RcuVectorBase<T> DataVector;
+ typedef vespalib::RcuVectorBase<T> DataVector;
DataVector _data;
T getFromEnum(EnumHandle e) const override {
diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp
index 1338b1fb547..c581397f17e 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp
@@ -60,7 +60,7 @@ template <typename B>
void
SingleValueNumericAttribute<B>::onUpdateStat()
{
- MemoryUsage usage = _data.getMemoryUsage();
+ vespalib::MemoryUsage usage = _data.getMemoryUsage();
usage.mergeGenerationHeldBytes(getGenerationHolder().getHeldBytes());
usage.merge(this->getChangeVectorMemoryUsage());
this->updateStatistics(_data.size(), _data.size(),
diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h
index b50944492a8..c14d3c925d8 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.h
@@ -67,7 +67,7 @@ private:
using PostingParent::forwardedOnAddDoc;
void freezeEnumDictionary() override;
- void mergeMemoryStats(MemoryUsage & total) override;
+ void mergeMemoryStats(vespalib::MemoryUsage & total) override;
void applyUpdateValueChange(const Change & c, EnumStore & enumStore,
std::map<DocId, EnumIndex> & currEnumIndices);
void makePostingChange(const EnumStoreComparator *cmp,
diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp
index d50b41daadb..61561fe9587 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp
@@ -34,7 +34,7 @@ SingleValueNumericPostingAttribute<B>::freezeEnumDictionary()
template <typename B>
void
-SingleValueNumericPostingAttribute<B>::mergeMemoryStats(MemoryUsage & total)
+SingleValueNumericPostingAttribute<B>::mergeMemoryStats(vespalib::MemoryUsage & total)
{
total.merge(this->_postingList.getMemoryUsage());
}
diff --git a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp
index 96c4565657a..4632f8a2851 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp
@@ -94,7 +94,7 @@ SingleValueSmallNumericAttribute::addDoc(DocId & doc) {
void
SingleValueSmallNumericAttribute::onUpdateStat()
{
- MemoryUsage usage = _wordData.getMemoryUsage();
+ vespalib::MemoryUsage usage = _wordData.getMemoryUsage();
usage.mergeGenerationHeldBytes(getGenerationHolder().getHeldBytes());
uint32_t numDocs = B::getNumDocs();
updateStatistics(numDocs, numDocs,
diff --git a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h
index 5029a632ea1..965d046782b 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.h
@@ -4,7 +4,7 @@
#include "integerbase.h"
#include "floatbase.h"
-#include <vespa/searchlib/common/rcuvector.h>
+#include <vespa/vespalib/util/rcuvector.h>
#include <limits>
namespace search {
@@ -32,7 +32,7 @@ private:
uint32_t _valueShiftMask; // 0x1f, 0x0f or 0x07
uint32_t _wordShift; // 0x05, 0x04 or 0x03
- typedef search::attribute::RcuVectorBase<Word> DataVector;
+ typedef vespalib::RcuVectorBase<Word> DataVector;
DataVector _wordData;
T getFromEnum(EnumHandle) const override {
diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h
index de8baf4473f..e3cf73eb17c 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h
@@ -71,7 +71,7 @@ public:
private:
void freezeEnumDictionary() override;
- void mergeMemoryStats(MemoryUsage & total) override;
+ void mergeMemoryStats(vespalib::MemoryUsage & total) override;
void applyUpdateValueChange(const Change & c,
EnumStore & enumStore,
std::map<DocId, EnumIndex> &currEnumIndices);
diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp
index 976d67a0049..964665811b2 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp
@@ -31,7 +31,7 @@ SingleValueStringPostingAttributeT<B>::freezeEnumDictionary()
template <typename B>
void
-SingleValueStringPostingAttributeT<B>::mergeMemoryStats(MemoryUsage & total)
+SingleValueStringPostingAttributeT<B>::mergeMemoryStats(vespalib::MemoryUsage & total)
{
total.merge(this->_postingList.getMemoryUsage());
}
diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp
index 855bf6c7a57..d62361423bd 100644
--- a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp
@@ -518,7 +518,7 @@ StringAttribute::fixupEnumRefCounts(const EnumVector &)
fprintf(stderr, "StringAttribute::fixupEnumRefCounts\n");
}
-MemoryUsage
+vespalib::MemoryUsage
StringAttribute::getChangeVectorMemoryUsage() const
{
return _changes.getMemoryUsage();
diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.h b/searchlib/src/vespa/searchlib/attribute/stringbase.h
index 11952675c00..8131c87ab85 100644
--- a/searchlib/src/vespa/searchlib/attribute/stringbase.h
+++ b/searchlib/src/vespa/searchlib/attribute/stringbase.h
@@ -71,7 +71,7 @@ protected:
virtual bool onAddDoc(DocId doc) override;
- virtual MemoryUsage getChangeVectorMemoryUsage() const override;
+ virtual vespalib::MemoryUsage getChangeVectorMemoryUsage() const override;
private:
typedef attribute::LoadedStringVectorReal LoadedVectorR;
virtual void fillPostings(LoadedVector & loaded);
diff --git a/searchlib/src/vespa/searchlib/btree/btree.h b/searchlib/src/vespa/searchlib/btree/btree.h
index d9052372875..5d20964e169 100644
--- a/searchlib/src/vespa/searchlib/btree/btree.h
+++ b/searchlib/src/vespa/searchlib/btree/btree.h
@@ -132,7 +132,7 @@ public:
BTreeNode::Ref getRoot() const {
return _tree.getRoot();
}
- MemoryUsage getMemoryUsage() const {
+ vespalib::MemoryUsage getMemoryUsage() const {
return _alloc.getMemoryUsage();
}
diff --git a/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h b/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h
index 46eca13823b..d2d2cf44a46 100644
--- a/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h
+++ b/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h
@@ -7,7 +7,7 @@
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/util/array.h>
#include <vespa/vespalib/util/generationhandler.h>
-#include <vespa/searchlib/util/memoryusage.h>
+#include <vespa/vespalib/util/memoryusage.h>
#include <vector>
namespace search::btree {
@@ -157,7 +157,7 @@ public:
const KeyT &getLastKey(BTreeNode::Ref node) const;
const AggrT &getAggregated(BTreeNode::Ref node) const;
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
vespalib::string toString(BTreeNode::Ref ref) const;
vespalib::string toString(const BTreeNode * node) const;
diff --git a/searchlib/src/vespa/searchlib/btree/btreenodeallocator.hpp b/searchlib/src/vespa/searchlib/btree/btreenodeallocator.hpp
index 1a0df9e397b..197869a7c71 100644
--- a/searchlib/src/vespa/searchlib/btree/btreenodeallocator.hpp
+++ b/searchlib/src/vespa/searchlib/btree/btreenodeallocator.hpp
@@ -376,11 +376,11 @@ getAggregated(BTreeNode::Ref node) const
template <typename KeyT, typename DataT, typename AggrT,
size_t INTERNAL_SLOTS, size_t LEAF_SLOTS>
-MemoryUsage
+vespalib::MemoryUsage
BTreeNodeAllocator<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS>::
getMemoryUsage() const
{
- MemoryUsage usage = _nodeStore.getMemoryUsage();
+ vespalib::MemoryUsage usage = _nodeStore.getMemoryUsage();
return usage;
}
diff --git a/searchlib/src/vespa/searchlib/btree/btreenodestore.h b/searchlib/src/vespa/searchlib/btree/btreenodestore.h
index b53248838f8..d8eae945602 100644
--- a/searchlib/src/vespa/searchlib/btree/btreenodestore.h
+++ b/searchlib/src/vespa/searchlib/btree/btreenodestore.h
@@ -177,7 +177,7 @@ public:
}
// Inherit doc from DataStoreBase
- MemoryUsage getMemoryUsage() const {
+ vespalib::MemoryUsage getMemoryUsage() const {
return _store.getMemoryUsage();
}
diff --git a/searchlib/src/vespa/searchlib/btree/btreestore.h b/searchlib/src/vespa/searchlib/btree/btreestore.h
index 40eeb4e9386..c2242bd6b63 100644
--- a/searchlib/src/vespa/searchlib/btree/btreestore.h
+++ b/searchlib/src/vespa/searchlib/btree/btreestore.h
@@ -358,8 +358,8 @@ public:
// Inherit doc from DataStoreBase
- MemoryUsage getMemoryUsage() const {
- MemoryUsage usage;
+ vespalib::MemoryUsage getMemoryUsage() const {
+ vespalib::MemoryUsage usage;
usage.merge(_allocator.getMemoryUsage());
usage.merge(_store.getMemoryUsage());
return usage;
diff --git a/searchlib/src/vespa/searchlib/common/CMakeLists.txt b/searchlib/src/vespa/searchlib/common/CMakeLists.txt
index f9db738528c..e0149cea455 100644
--- a/searchlib/src/vespa/searchlib/common/CMakeLists.txt
+++ b/searchlib/src/vespa/searchlib/common/CMakeLists.txt
@@ -21,7 +21,6 @@ vespa_add_library(searchlib_common OBJECT
mapnames.cpp
packets.cpp
partialbitvector.cpp
- rcuvector.cpp
resultset.cpp
sequencedtaskexecutor.cpp
sequencedtaskexecutorobserver.cpp
diff --git a/searchlib/src/vespa/searchlib/common/condensedbitvectors.cpp b/searchlib/src/vespa/searchlib/common/condensedbitvectors.cpp
index e3ef7964c13..00b1620903f 100644
--- a/searchlib/src/vespa/searchlib/common/condensedbitvectors.cpp
+++ b/searchlib/src/vespa/searchlib/common/condensedbitvectors.cpp
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "condensedbitvectors.h"
-#include <vespa/searchlib/common/rcuvector.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/rcuvector.h>
using vespalib::IllegalArgumentException;
using vespalib::make_string;
@@ -77,7 +77,7 @@ private:
size_t getCapacity() const override { return _v.capacity(); }
size_t getSize() const override { return _v.size(); }
void adjustDocIdLimit(uint32_t docId) override;
- attribute::RcuVectorBase<T> _v;
+ vespalib::RcuVectorBase<T> _v;
};
template <typename T>
diff --git a/searchlib/src/vespa/searchlib/common/rcuvector.cpp b/searchlib/src/vespa/searchlib/common/rcuvector.cpp
deleted file mode 100644
index d5efb661947..00000000000
--- a/searchlib/src/vespa/searchlib/common/rcuvector.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "rcuvector.hpp"
-
-namespace search::attribute {
-
-template class RcuVectorBase<uint8_t>;
-template class RcuVectorBase<uint16_t>;
-template class RcuVectorBase<uint32_t>;
-template class RcuVectorBase<int8_t>;
-template class RcuVectorBase<int16_t>;
-template class RcuVectorBase<int32_t>;
-template class RcuVectorBase<int64_t>;
-template class RcuVectorBase<float>;
-template class RcuVectorBase<double>;
-
-template class RcuVector<uint8_t>;
-template class RcuVector<uint16_t>;
-template class RcuVector<uint32_t>;
-template class RcuVector<int8_t>;
-template class RcuVector<int16_t>;
-template class RcuVector<int32_t>;
-template class RcuVector<int64_t>;
-template class RcuVector<float>;
-template class RcuVector<double>;
-
-template class RcuVectorHeld<uint8_t>;
-template class RcuVectorHeld<uint16_t>;
-template class RcuVectorHeld<uint32_t>;
-template class RcuVectorHeld<int8_t>;
-template class RcuVectorHeld<int16_t>;
-template class RcuVectorHeld<int32_t>;
-template class RcuVectorHeld<int64_t>;
-template class RcuVectorHeld<float>;
-template class RcuVectorHeld<double>;
-
-}
diff --git a/searchlib/src/vespa/searchlib/common/rcuvector.h b/searchlib/src/vespa/searchlib/common/rcuvector.h
deleted file mode 100644
index b62beeee1f1..00000000000
--- a/searchlib/src/vespa/searchlib/common/rcuvector.h
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <vespa/vespalib/util/generationholder.h>
-#include <vespa/searchlib/util/memoryusage.h>
-#include <vespa/searchcommon/common/growstrategy.h>
-#include <vespa/vespalib/util/alloc.h>
-#include <vespa/vespalib/util/array.h>
-
-namespace search::attribute {
-
-template <typename T>
-class RcuVectorHeld : public vespalib::GenerationHeldBase
-{
- std::unique_ptr<T> _data;
-
-public:
- RcuVectorHeld(size_t size, std::unique_ptr<T> data);
-
- ~RcuVectorHeld();
-};
-
-
-/**
- * Vector class for elements of type T using the read-copy-update
- * mechanism to ensure that reader threads will have a consistent view
- * of the vector while the update thread is inserting new elements.
- * The update thread is also responsible for updating the current
- * generation of the vector, and initiating removing of old underlying
- * data vectors.
- **/
-template <typename T>
-class RcuVectorBase
-{
-private:
- static_assert(std::is_trivially_destructible<T>::value,
- "Value type must be trivially destructible");
-
- using Array = vespalib::Array<T>;
- using Alloc = vespalib::alloc::Alloc;
-protected:
- using generation_t = vespalib::GenerationHandler::generation_t;
- using GenerationHolder = vespalib::GenerationHolder;
-private:
- Array _data;
- size_t _growPercent;
- size_t _growDelta;
- GenerationHolder &_genHolder;
-
- size_t calcNewSize(size_t baseSize) const {
- size_t delta = (baseSize * _growPercent / 100) + _growDelta;
- return baseSize + std::max(delta, static_cast<size_t>(1));
- }
- size_t calcNewSize() const {
- return calcNewSize(_data.capacity());
- }
- void expand(size_t newCapacity);
- void expandAndInsert(const T & v);
- virtual void onReallocation();
-
-public:
- using ValueType = T;
- RcuVectorBase(GenerationHolder &genHolder,
- const Alloc &initialAlloc = Alloc::alloc());
-
- /**
- * Construct a new vector with the given initial capacity and grow
- * parameters.
- *
- * New capacity is calculated based on old capacity and grow parameters:
- * nc = oc + (oc * growPercent / 100) + growDelta.
- **/
- RcuVectorBase(size_t initialCapacity, size_t growPercent, size_t growDelta,
- GenerationHolder &genHolder,
- const Alloc &initialAlloc = Alloc::alloc());
-
- RcuVectorBase(GrowStrategy growStrategy,
- GenerationHolder &genHolder,
- const Alloc &initialAlloc = Alloc::alloc());
-
- virtual ~RcuVectorBase();
-
- /**
- * Return whether all capacity has been used. If true the next
- * call to push_back() will cause an expand of the underlying
- * data.
- **/
- bool isFull() const { return _data.size() == _data.capacity(); }
-
- /**
- * Return the combined memory usage for this instance.
- **/
- virtual MemoryUsage getMemoryUsage() const;
-
- // vector interface
- // no swap method, use reset() to forget old capacity and holds
- // NOTE: Unsafe resize/reserve may invalidate data references held by readers!
- void unsafe_resize(size_t n);
- void unsafe_reserve(size_t n);
- void ensure_size(size_t n, T fill = T());
- void reserve(size_t n) {
- if (n > capacity()) {
- expand(calcNewSize(n));
- }
- }
- void push_back(const T & v) {
- if (_data.size() < _data.capacity()) {
- _data.push_back(v);
- } else {
- expandAndInsert(v);
- }
- }
-
- bool empty() const { return _data.empty(); }
- size_t size() const { return _data.size(); }
- size_t capacity() const { return _data.capacity(); }
- void clear() { _data.clear(); }
- T & operator[](size_t i) { return _data[i]; }
- const T & operator[](size_t i) const { return _data[i]; }
-
- void reset();
- void shrink(size_t newSize) __attribute__((noinline));
- void replaceVector(std::unique_ptr<Array> replacement);
-};
-
-template <typename T>
-class RcuVector : public RcuVectorBase<T>
-{
-private:
- typedef typename RcuVectorBase<T>::generation_t generation_t;
- typedef typename RcuVectorBase<T>::GenerationHolder GenerationHolder;
- generation_t _generation;
- GenerationHolder _genHolderStore;
-
- void onReallocation() override;
-
-public:
- RcuVector();
-
- /**
- * Construct a new vector with the given initial capacity and grow
- * parameters.
- *
- * New capacity is calculated based on old capacity and grow parameters:
- * nc = oc + (oc * growPercent / 100) + growDelta.
- **/
- RcuVector(size_t initialCapacity, size_t growPercent, size_t growDelta);
- RcuVector(GrowStrategy growStrategy);
- ~RcuVector();
-
- generation_t getGeneration() const { return _generation; }
- void setGeneration(generation_t generation) { _generation = generation; }
-
- /**
- * Remove all old data vectors where generation < firstUsed.
- **/
- void removeOldGenerations(generation_t firstUsed);
-
- MemoryUsage getMemoryUsage() const override;
-};
-
-}
diff --git a/searchlib/src/vespa/searchlib/common/rcuvector.hpp b/searchlib/src/vespa/searchlib/common/rcuvector.hpp
deleted file mode 100644
index dde96440935..00000000000
--- a/searchlib/src/vespa/searchlib/common/rcuvector.hpp
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include "rcuvector.h"
-#include <vespa/vespalib/util/array.hpp>
-
-namespace search::attribute {
-
-template <typename T>
-RcuVectorHeld<T>::RcuVectorHeld(size_t size, std::unique_ptr<T> data)
- : vespalib::GenerationHeldBase(size),
- _data(std::move(data))
-{ }
-
-template <typename T>
-RcuVectorHeld<T>::~RcuVectorHeld() = default;
-
-template <typename T>
-void
-RcuVectorBase<T>::unsafe_resize(size_t n) {
- _data.resize(n);
-}
-
-template <typename T>
-void
-RcuVectorBase<T>::unsafe_reserve(size_t n) {
- _data.reserve(n);
-}
-
-template <typename T>
-void
-RcuVectorBase<T>::ensure_size(size_t n, T fill) {
- reserve(n);
- while (size() < n) {
- _data.push_back(fill);
- }
-}
-
-template <typename T>
-void
-RcuVectorBase<T>::reset() {
- // Assumes no readers at this moment
- Array().swap(_data);
- _data.reserve(16);
-}
-
-template <typename T>
-RcuVectorBase<T>::~RcuVectorBase() = default;
-
-template <typename T>
-void
-RcuVectorBase<T>::expand(size_t newCapacity) {
- std::unique_ptr<Array> tmpData(new Array());
- tmpData->reserve(newCapacity);
- for (const T & v : _data) {
- tmpData->push_back_fast(v);
- }
- replaceVector(std::move(tmpData));
-}
-
-template <typename T>
-void
-RcuVectorBase<T>::replaceVector(std::unique_ptr<Array> replacement) {
- replacement->swap(_data); // atomic switch of underlying data
- size_t holdSize = replacement->capacity() * sizeof(T);
- vespalib::GenerationHeldBase::UP hold(new RcuVectorHeld<Array>(holdSize, std::move(replacement)));
- _genHolder.hold(std::move(hold));
- onReallocation();
-}
-
-template <typename T>
-void
-RcuVectorBase<T>::expandAndInsert(const T & v)
-{
- expand(calcNewSize());
- assert(_data.size() < _data.capacity());
- _data.push_back(v);
-}
-
-template <typename T>
-void
-RcuVectorBase<T>::shrink(size_t newSize)
-{
- assert(newSize <= _data.size());
- _data.resize(newSize);
- size_t wantedCapacity = calcNewSize(newSize);
- if (wantedCapacity >= _data.capacity()) {
- return;
- }
- if (!_data.try_unreserve(wantedCapacity)) {
- std::unique_ptr <Array> tmpData(new Array());
- tmpData->reserve(wantedCapacity);
- tmpData->resize(newSize);
- for (uint32_t i = 0; i < newSize; ++i) {
- (*tmpData)[i] = _data[i];
- }
- // Users of RCU vector must ensure that no readers use old size
- // after swap. Attribute vectors uses _committedDocIdLimit for this.
- tmpData->swap(_data); // atomic switch of underlying data
- size_t holdSize = tmpData->capacity() * sizeof(T);
- vespalib::GenerationHeldBase::UP hold(new RcuVectorHeld<Array>(holdSize, std::move(tmpData)));
- _genHolder.hold(std::move(hold));
- onReallocation();
- }
-}
-
-template <typename T>
-RcuVectorBase<T>::RcuVectorBase(GenerationHolder &genHolder,
- const Alloc &initialAlloc)
- : _data(initialAlloc),
- _growPercent(100),
- _growDelta(0),
- _genHolder(genHolder)
-{
- _data.reserve(16);
-}
-
-template <typename T>
-RcuVectorBase<T>::RcuVectorBase(size_t initialCapacity,
- size_t growPercent,
- size_t growDelta,
- GenerationHolder &genHolder,
- const Alloc &initialAlloc)
- : _data(initialAlloc),
- _growPercent(growPercent),
- _growDelta(growDelta),
- _genHolder(genHolder)
-{
- _data.reserve(initialCapacity);
-}
-
-template <typename T>
-RcuVectorBase<T>::RcuVectorBase(GrowStrategy growStrategy,
- GenerationHolder &genHolder,
- const Alloc &initialAlloc)
- : RcuVectorBase(growStrategy.getDocsInitialCapacity(), growStrategy.getDocsGrowPercent(),
- growStrategy.getDocsGrowDelta(), genHolder, initialAlloc)
-{
-}
-
-template <typename T>
-MemoryUsage
-RcuVectorBase<T>::getMemoryUsage() const
-{
- MemoryUsage retval;
- retval.incAllocatedBytes(_data.capacity() * sizeof(T));
- retval.incUsedBytes(_data.size() * sizeof(T));
- return retval;
-}
-
-template <typename T>
-void
-RcuVectorBase<T>::onReallocation() { }
-
-template <typename T>
-void
-RcuVector<T>::onReallocation() {
- _genHolderStore.transferHoldLists(_generation);
-}
-
-template <typename T>
-RcuVector<T>::RcuVector()
- : RcuVectorBase<T>(_genHolderStore),
- _generation(0),
- _genHolderStore()
-{ }
-
-template <typename T>
-RcuVector<T>::RcuVector(size_t initialCapacity, size_t growPercent, size_t growDelta)
- : RcuVectorBase<T>(initialCapacity, growPercent, growDelta, _genHolderStore),
- _generation(0),
- _genHolderStore()
-{ }
-
-template <typename T>
-RcuVector<T>::RcuVector(GrowStrategy growStrategy)
- : RcuVectorBase<T>(growStrategy, _genHolderStore),
- _generation(0),
- _genHolderStore()
-{ }
-
-template <typename T>
-RcuVector<T>::~RcuVector()
-{
- _genHolderStore.clearHoldLists();
-}
-
-template <typename T>
-void
-RcuVector<T>::removeOldGenerations(generation_t firstUsed)
-{
- _genHolderStore.trimHoldLists(firstUsed);
-}
-
-template <typename T>
-MemoryUsage
-RcuVector<T>::getMemoryUsage() const
-{
- MemoryUsage retval(RcuVectorBase<T>::getMemoryUsage());
- retval.mergeGenerationHeldBytes(_genHolderStore.getHeldBytes());
- return retval;
-}
-
-}
diff --git a/searchlib/src/vespa/searchlib/datastore/array_store.h b/searchlib/src/vespa/searchlib/datastore/array_store.h
index 80a11a92f9c..b3a4c561aaf 100644
--- a/searchlib/src/vespa/searchlib/datastore/array_store.h
+++ b/searchlib/src/vespa/searchlib/datastore/array_store.h
@@ -84,7 +84,7 @@ public:
}
void remove(EntryRef ref);
ICompactionContext::UP compactWorst(bool compactMemory, bool compactAddressSpace);
- MemoryUsage getMemoryUsage() const { return _store.getMemoryUsage(); }
+ vespalib::MemoryUsage getMemoryUsage() const { return _store.getMemoryUsage(); }
/**
* Returns the address space usage by this store as the ratio between active buffers
diff --git a/searchlib/src/vespa/searchlib/datastore/datastore.cpp b/searchlib/src/vespa/searchlib/datastore/datastore.cpp
index 5def7461e90..308dc750113 100644
--- a/searchlib/src/vespa/searchlib/datastore/datastore.cpp
+++ b/searchlib/src/vespa/searchlib/datastore/datastore.cpp
@@ -3,7 +3,7 @@
#include "datastore.h"
#include "datastore.hpp"
#include <vespa/vespalib/util/array.hpp>
-#include <vespa/searchlib/common/rcuvector.hpp>
+#include <vespa/vespalib/util/rcuvector.hpp>
namespace search::datastore {
@@ -12,6 +12,6 @@ template class DataStoreT<EntryRefT<22> >;
}
template void vespalib::Array<search::datastore::DataStoreBase::ElemHold1ListElem>::increase(size_t);
-template class search::attribute::RcuVector<search::datastore::EntryRef>;
-template class search::attribute::RcuVectorBase<search::datastore::EntryRef>;
-//template void search::attribute::RcuVectorBase<search::datastore::EntryRef>::expandAndInsert(const search::datastore::EntryRef &);
+template class vespalib::RcuVector<search::datastore::EntryRef>;
+template class vespalib::RcuVectorBase<search::datastore::EntryRef>;
+//template void vespalib::RcuVectorBase<search::datastore::EntryRef>::expandAndInsert(const search::datastore::EntryRef &);
diff --git a/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp b/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp
index 4b4a20ecc4a..c457d40f523 100644
--- a/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp
+++ b/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp
@@ -201,11 +201,11 @@ DataStoreBase::dropBuffers()
_genHolder.clearHoldLists();
}
-MemoryUsage
+vespalib::MemoryUsage
DataStoreBase::getMemoryUsage() const
{
MemStats stats = getMemStats();
- MemoryUsage usage;
+ vespalib::MemoryUsage usage;
usage.setAllocatedBytes(stats._allocBytes);
usage.setUsedBytes(stats._usedBytes);
usage.setDeadBytes(stats._deadBytes);
diff --git a/searchlib/src/vespa/searchlib/datastore/datastorebase.h b/searchlib/src/vespa/searchlib/datastore/datastorebase.h
index 167fc0a7969..8d7f892b690 100644
--- a/searchlib/src/vespa/searchlib/datastore/datastorebase.h
+++ b/searchlib/src/vespa/searchlib/datastore/datastorebase.h
@@ -3,9 +3,9 @@
#pragma once
#include "bufferstate.h"
-#include <vespa/vespalib/util/generationholder.h>
-#include <vespa/searchlib/util/memoryusage.h>
#include <vespa/searchlib/common/address_space.h>
+#include <vespa/vespalib/util/generationholder.h>
+#include <vespa/vespalib/util/memoryusage.h>
#include <vector>
#include <deque>
@@ -228,7 +228,7 @@ public:
void switchOrGrowActiveBuffer(uint32_t typeId, size_t elemsNeeded);
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
AddressSpace getAddressSpaceUsage() const;
diff --git a/searchlib/src/vespa/searchlib/datastore/unique_store.h b/searchlib/src/vespa/searchlib/datastore/unique_store.h
index b5278a289e9..cc261acd53f 100644
--- a/searchlib/src/vespa/searchlib/datastore/unique_store.h
+++ b/searchlib/src/vespa/searchlib/datastore/unique_store.h
@@ -98,7 +98,7 @@ public:
}
void remove(EntryRef ref);
ICompactionContext::UP compactWorst();
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
// Pass on hold list management to underlying store
void transferHoldLists(generation_t generation);
diff --git a/searchlib/src/vespa/searchlib/datastore/unique_store.hpp b/searchlib/src/vespa/searchlib/datastore/unique_store.hpp
index 3bbb7c0155e..e86edb9d3d4 100644
--- a/searchlib/src/vespa/searchlib/datastore/unique_store.hpp
+++ b/searchlib/src/vespa/searchlib/datastore/unique_store.hpp
@@ -190,10 +190,10 @@ UniqueStore<EntryT, RefT>::compactWorst()
}
template <typename EntryT, typename RefT>
-MemoryUsage
+vespalib::MemoryUsage
UniqueStore<EntryT, RefT>::getMemoryUsage() const
{
- MemoryUsage usage = _store.getMemoryUsage();
+ vespalib::MemoryUsage usage = _store.getMemoryUsage();
usage.merge(_dict.getMemoryUsage());
return usage;
}
diff --git a/searchlib/src/vespa/searchlib/docstore/chunk.cpp b/searchlib/src/vespa/searchlib/docstore/chunk.cpp
index e8ca31d6dfb..4707e8001a8 100644
--- a/searchlib/src/vespa/searchlib/docstore/chunk.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/chunk.cpp
@@ -131,10 +131,10 @@ Chunk::getUniqueLids() const
return unique;
}
-MemoryUsage
+vespalib::MemoryUsage
Chunk::getMemoryUsage() const
{
- MemoryUsage result;
+ vespalib::MemoryUsage result;
result.incAllocatedBytes(_format->getBuffer().capacity());
result.incUsedBytes(_format->getBuffer().size());
result.incAllocatedBytes(sizeof(Entry) * _lids.capacity());
diff --git a/searchlib/src/vespa/searchlib/docstore/chunk.h b/searchlib/src/vespa/searchlib/docstore/chunk.h
index 58bdf1d7359..37d13af5a3b 100644
--- a/searchlib/src/vespa/searchlib/docstore/chunk.h
+++ b/searchlib/src/vespa/searchlib/docstore/chunk.h
@@ -2,9 +2,9 @@
#pragma once
-#include <vespa/searchlib/util/memoryusage.h>
#include <vespa/vespalib/util/buffer.h>
#include <vespa/vespalib/util/compressionconfig.h>
+#include <vespa/vespalib/util/memoryusage.h>
#include <memory>
#include <vector>
@@ -102,7 +102,7 @@ public:
vespalib::ConstBufferRef getLid(uint32_t lid) const;
const vespalib::nbostream & getData() const;
bool hasRoom(size_t len) const;
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
private:
vespalib::nbostream & getData();
diff --git a/searchlib/src/vespa/searchlib/docstore/documentstore.cpp b/searchlib/src/vespa/searchlib/docstore/documentstore.cpp
index 003f448ab07..e7efe3f366b 100644
--- a/searchlib/src/vespa/searchlib/docstore/documentstore.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/documentstore.cpp
@@ -422,7 +422,7 @@ DocumentStore::getStorageStats() const
return _backingStore.getStorageStats();
}
-MemoryUsage
+vespalib::MemoryUsage
DocumentStore::getMemoryUsage() const
{
return _backingStore.getMemoryUsage();
diff --git a/searchlib/src/vespa/searchlib/docstore/documentstore.h b/searchlib/src/vespa/searchlib/docstore/documentstore.h
index baeed106531..a2b855deaf6 100644
--- a/searchlib/src/vespa/searchlib/docstore/documentstore.h
+++ b/searchlib/src/vespa/searchlib/docstore/documentstore.h
@@ -90,7 +90,7 @@ public:
const document::DocumentTypeRepo &repo) override;
double getVisitCost() const override;
DataStoreStorageStats getStorageStats() const override;
- MemoryUsage getMemoryUsage() const override;
+ vespalib::MemoryUsage getMemoryUsage() const override;
std::vector<DataStoreFileChunkStats> getFileChunkStats() const override;
/**
diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp
index e175fbd9381..fecee481b77 100644
--- a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp
@@ -523,10 +523,10 @@ FileChunk::getMemoryMetaFootprint() const
return sizeof(*this) + _chunkInfo.byteCapacity();
}
-MemoryUsage
+vespalib::MemoryUsage
FileChunk::getMemoryUsage() const
{
- MemoryUsage result;
+ vespalib::MemoryUsage result;
result.incAllocatedBytes(sizeof(*this));
result.incUsedBytes(sizeof(*this));
result.incAllocatedBytes(_chunkInfo.byteCapacity());
diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.h b/searchlib/src/vespa/searchlib/docstore/filechunk.h
index 567e078b622..9f09d535880 100644
--- a/searchlib/src/vespa/searchlib/docstore/filechunk.h
+++ b/searchlib/src/vespa/searchlib/docstore/filechunk.h
@@ -6,8 +6,8 @@
#include "ibucketizer.h"
#include "lid_info.h"
#include "randread.h"
-#include <vespa/searchlib/util/memoryusage.h>
#include <vespa/searchlib/common/tunefileinfo.h>
+#include <vespa/vespalib/util/memoryusage.h>
#include <vespa/vespalib/util/ptrholder.h>
#include <vespa/vespalib/util/sync.h>
#include <vespa/vespalib/stllike/hash_map.h>
@@ -117,7 +117,7 @@ public:
virtual size_t getDiskFootprint() const { return _diskFootprint; }
virtual size_t getMemoryFootprint() const;
virtual size_t getMemoryMetaFootprint() const;
- virtual MemoryUsage getMemoryUsage() const;
+ virtual vespalib::MemoryUsage getMemoryUsage() const;
virtual size_t getDiskHeaderFootprint(void) const { return _dataHeaderLen + _idxHeaderLen; }
size_t getDiskBloat() const {
diff --git a/searchlib/src/vespa/searchlib/docstore/idatastore.h b/searchlib/src/vespa/searchlib/docstore/idatastore.h
index 4de5ba5be7d..e2d89fc160c 100644
--- a/searchlib/src/vespa/searchlib/docstore/idatastore.h
+++ b/searchlib/src/vespa/searchlib/docstore/idatastore.h
@@ -5,8 +5,8 @@
#include "data_store_file_chunk_stats.h"
#include <vespa/fastos/timestamp.h>
#include <vespa/searchlib/common/i_compactable_lid_space.h>
-#include <vespa/searchlib/util/memoryusage.h>
#include <vespa/vespalib/stllike/string.h>
+#include <vespa/vespalib/util/memoryusage.h>
#include <vector>
namespace vespalib { class DataBuffer; }
@@ -165,7 +165,7 @@ public:
/*
* Return the memory usage for data store.
*/
- virtual MemoryUsage getMemoryUsage() const = 0;
+ virtual vespalib::MemoryUsage getMemoryUsage() const = 0;
/*
* Return detailed stats about underlying files for data store.
diff --git a/searchlib/src/vespa/searchlib/docstore/idocumentstore.h b/searchlib/src/vespa/searchlib/docstore/idocumentstore.h
index 33183f745ad..cceae5d39ee 100644
--- a/searchlib/src/vespa/searchlib/docstore/idocumentstore.h
+++ b/searchlib/src/vespa/searchlib/docstore/idocumentstore.h
@@ -210,7 +210,7 @@ public:
/*
* Return the memory usage for document store.
*/
- virtual MemoryUsage getMemoryUsage() const = 0;
+ virtual vespalib::MemoryUsage getMemoryUsage() const = 0;
/*
* Return detailed stats about underlying files for data store.
diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
index 6db0dee5c85..f17f9459ff9 100644
--- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
@@ -7,8 +7,8 @@
#include <vespa/vespalib/util/benchmark_timer.h>
#include <vespa/vespalib/data/fileheader.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
-#include <vespa/searchlib/common/rcuvector.hpp>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/rcuvector.hpp>
#include <thread>
#include <vespa/log/log.h>
@@ -1156,11 +1156,11 @@ LogDataStore::getStorageStats() const
lastSerialNum, lastFlushedSerialNum, docIdLimit);
}
-MemoryUsage
+vespalib::MemoryUsage
LogDataStore::getMemoryUsage() const
{
LockGuard guard(_updateLock);
- MemoryUsage result;
+ vespalib::MemoryUsage result;
result.merge(_lidInfo.getMemoryUsage());
for (const auto &fileChunk : _fileChunks) {
if (fileChunk) {
diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.h b/searchlib/src/vespa/searchlib/docstore/logdatastore.h
index 91143ecd1d2..c4d1e8bbdb4 100644
--- a/searchlib/src/vespa/searchlib/docstore/logdatastore.h
+++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.h
@@ -6,9 +6,10 @@
#include "lid_info.h"
#include "writeablefilechunk.h"
#include <vespa/vespalib/util/compressionconfig.h>
-#include <vespa/searchlib/common/rcuvector.h>
+#include <vespa/searchcommon/common/growstrategy.h>
#include <vespa/searchlib/common/tunefileinfo.h>
#include <vespa/searchlib/transactionlog/syncproxy.h>
+#include <vespa/vespalib/util/rcuvector.h>
#include <vespa/vespalib/util/threadexecutor.h>
#include <set>
@@ -163,7 +164,7 @@ public:
}
DataStoreStorageStats getStorageStats() const override;
- MemoryUsage getMemoryUsage() const override;
+ vespalib::MemoryUsage getMemoryUsage() const override;
std::vector<DataStoreFileChunkStats> getFileChunkStats() const override;
void compactLidSpace(uint32_t wantedDocLidLimit) override;
@@ -186,7 +187,7 @@ private:
void compactWorst(double bloatLimit, double spreadLimit);
void compactFile(FileId chunkId);
- typedef attribute::RcuVector<uint64_t> LidInfoVector;
+ typedef vespalib::RcuVector<uint64_t> LidInfoVector;
typedef std::vector<FileChunk::UP> FileChunkVector;
void updateLidMap(uint32_t lastFileChunkDocIdLimit);
diff --git a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp
index 35d75300cb1..91f5c37b817 100644
--- a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp
@@ -600,11 +600,11 @@ WriteableFileChunk::getMemoryMetaFootprint() const
return mySizeWithoutMyParent + FileChunk::getMemoryMetaFootprint();
}
-MemoryUsage
+vespalib::MemoryUsage
WriteableFileChunk::getMemoryUsage() const
{
LockGuard guard(_lock);
- MemoryUsage result;
+ vespalib::MemoryUsage result;
for (const auto &chunk : _chunkMap) {
result.merge(chunk.second->getMemoryUsage());
}
diff --git a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h
index bb550096251..4a2ebfc42df 100644
--- a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h
+++ b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h
@@ -62,7 +62,7 @@ public:
size_t getDiskFootprint() const override;
size_t getMemoryFootprint() const override;
size_t getMemoryMetaFootprint() const override;
- MemoryUsage getMemoryUsage() const override;
+ vespalib::MemoryUsage getMemoryUsage() const override;
size_t updateLidMap(const LockGuard &guard, ISetLid &lidMap, uint64_t serialNum, uint32_t docIdLimit) override;
void waitForDiskToCatchUpToNow() const;
void flushPendingChunks(uint64_t serialNum);
diff --git a/searchlib/src/vespa/searchlib/memoryindex/compact_words_store.cpp b/searchlib/src/vespa/searchlib/memoryindex/compact_words_store.cpp
index 27282282c11..7d90ff4bc60 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/compact_words_store.cpp
+++ b/searchlib/src/vespa/searchlib/memoryindex/compact_words_store.cpp
@@ -161,10 +161,10 @@ CompactWordsStore::get(uint32_t docId) const
return Iterator();
}
-MemoryUsage
+vespalib::MemoryUsage
CompactWordsStore::getMemoryUsage() const
{
- MemoryUsage usage;
+ vespalib::MemoryUsage usage;
usage.incAllocatedBytes(_docs.getMemoryConsumption());
usage.incUsedBytes(_docs.getMemoryUsed());
usage.merge(_wordsStore.getMemoryUsage());
diff --git a/searchlib/src/vespa/searchlib/memoryindex/compact_words_store.h b/searchlib/src/vespa/searchlib/memoryindex/compact_words_store.h
index 2fc6ec8d5bb..2ec125826b5 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/compact_words_store.h
+++ b/searchlib/src/vespa/searchlib/memoryindex/compact_words_store.h
@@ -3,8 +3,8 @@
#include <vespa/searchlib/datastore/datastore.h>
#include <vespa/searchlib/datastore/entryref.h>
-#include <vespa/searchlib/util/memoryusage.h>
#include <vespa/vespalib/util/array.h>
+#include <vespa/vespalib/util/memoryusage.h>
#include <vespa/vespalib/stllike/hash_map.h>
namespace search::memoryindex {
@@ -75,7 +75,7 @@ public:
~Store();
datastore::EntryRef insert(const Builder &builder);
Iterator get(datastore::EntryRef wordRef) const;
- MemoryUsage getMemoryUsage() const { return _store.getMemoryUsage(); }
+ vespalib::MemoryUsage getMemoryUsage() const { return _store.getMemoryUsage(); }
};
using DocumentWordsMap = vespalib::hash_map<uint32_t, datastore::EntryRef>;
@@ -90,7 +90,7 @@ public:
void insert(const Builder &builder);
void remove(uint32_t docId);
Iterator get(uint32_t docId) const;
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
};
}
diff --git a/searchlib/src/vespa/searchlib/memoryindex/feature_store.h b/searchlib/src/vespa/searchlib/memoryindex/feature_store.h
index 72b2e8e01bc..3cacacfb03e 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/feature_store.h
+++ b/searchlib/src/vespa/searchlib/memoryindex/feature_store.h
@@ -193,7 +193,7 @@ public:
void clearHoldLists() { _store.clearHoldLists();}
std::vector<uint32_t> startCompact() { return _store.startCompact(_typeId); }
void finishCompact(const std::vector<uint32_t> & toHold) { _store.finishCompact(toHold); }
- MemoryUsage getMemoryUsage() const { return _store.getMemoryUsage(); }
+ vespalib::MemoryUsage getMemoryUsage() const { return _store.getMemoryUsage(); }
datastore::DataStoreBase::MemStats getMemStats() const { return _store.getMemStats(); }
};
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp b/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp
index e79cab28dec..b2e3b2e6ba3 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp
@@ -191,10 +191,10 @@ FieldIndex::dump(search::index::IndexBuilder & indexBuilder)
}
}
-MemoryUsage
+vespalib::MemoryUsage
FieldIndex::getMemoryUsage() const
{
- MemoryUsage usage;
+ vespalib::MemoryUsage usage;
usage.merge(_wordStore.getMemoryUsage());
usage.merge(_dict.getMemoryUsage());
usage.merge(_postingListStore.getMemoryUsage());
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index.h b/searchlib/src/vespa/searchlib/memoryindex/field_index.h
index 918e1a05a07..9d869a7c548 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_index.h
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_index.h
@@ -11,8 +11,8 @@
#include <vespa/searchlib/btree/btreestore.h>
#include <vespa/searchlib/index/docidandfeatures.h>
#include <vespa/searchlib/index/indexbuilder.h>
-#include <vespa/searchlib/util/memoryusage.h>
#include <vespa/vespalib/stllike/string.h>
+#include <vespa/vespalib/util/memoryusage.h>
namespace search::memoryindex {
@@ -150,7 +150,7 @@ public:
void dump(search::index::IndexBuilder & indexBuilder);
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
DictionaryTree &getDictionaryTree() { return _dict; }
PostingListStore &getPostingListStore() { return _postingListStore; }
FieldIndexRemover &getDocumentRemover() { return _remover; }
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.cpp b/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.cpp
index 27944b5fe89..1a396d62c33 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.cpp
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.cpp
@@ -50,10 +50,10 @@ FieldIndexCollection::dump(search::index::IndexBuilder &indexBuilder)
}
}
-MemoryUsage
+vespalib::MemoryUsage
FieldIndexCollection::getMemoryUsage() const
{
- MemoryUsage usage;
+ vespalib::MemoryUsage usage;
for (auto &fieldIndex : _fieldIndexes) {
usage.merge(fieldIndex->getMemoryUsage());
}
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.h b/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.h
index 5c2aa6f9b2c..d259a071f97 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.h
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.h
@@ -47,7 +47,7 @@ public:
void dump(search::index::IndexBuilder & indexBuilder);
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
FieldIndex *getFieldIndex(uint32_t fieldId) const {
return _fieldIndexes[fieldId].get();
diff --git a/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp b/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp
index 3ff2d553a96..df302533192 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp
+++ b/searchlib/src/vespa/searchlib/memoryindex/memory_index.cpp
@@ -244,10 +244,10 @@ MemoryIndex::createBlueprint(const IRequestContext & requestContext,
return visitor.getResult();
}
-MemoryUsage
+vespalib::MemoryUsage
MemoryIndex::getMemoryUsage() const
{
- MemoryUsage usage;
+ vespalib::MemoryUsage usage;
usage.merge(_fieldIndexes->getMemoryUsage());
return usage;
}
diff --git a/searchlib/src/vespa/searchlib/memoryindex/memory_index.h b/searchlib/src/vespa/searchlib/memoryindex/memory_index.h
index f390edd0718..7d94025d9b1 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/memory_index.h
+++ b/searchlib/src/vespa/searchlib/memoryindex/memory_index.h
@@ -4,9 +4,9 @@
#include <vespa/searchlib/common/idestructorcallback.h>
#include <vespa/searchlib/queryeval/searchable.h>
-#include <vespa/searchlib/util/memoryusage.h>
#include <vespa/searchcommon/common/schema.h>
#include <vespa/vespalib/stllike/hash_set.h>
+#include <vespa/vespalib/util/memoryusage.h>
namespace search::index { class IndexBuilder; }
@@ -162,7 +162,7 @@ public:
/**
* Gets an approximation of how much memory the index uses.
*/
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
uint64_t getStaticMemoryFootprint() const { return _staticMemoryFootprint; }
};
diff --git a/searchlib/src/vespa/searchlib/memoryindex/word_store.h b/searchlib/src/vespa/searchlib/memoryindex/word_store.h
index 4c1526df527..6739b6152c8 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/word_store.h
+++ b/searchlib/src/vespa/searchlib/memoryindex/word_store.h
@@ -27,7 +27,7 @@ public:
return _store.getEntry<char>(internalRef);
}
- MemoryUsage getMemoryUsage() const {
+ vespalib::MemoryUsage getMemoryUsage() const {
return _store.getMemoryUsage();
}
};
diff --git a/searchlib/src/vespa/searchlib/predicate/document_features_store.cpp b/searchlib/src/vespa/searchlib/predicate/document_features_store.cpp
index c221f87c3e3..12728c4c7c3 100644
--- a/searchlib/src/vespa/searchlib/predicate/document_features_store.cpp
+++ b/searchlib/src/vespa/searchlib/predicate/document_features_store.cpp
@@ -198,8 +198,8 @@ void DocumentFeaturesStore::remove(uint32_t doc_id) {
}
}
-search::MemoryUsage DocumentFeaturesStore::getMemoryUsage() const {
- search::MemoryUsage usage;
+vespalib::MemoryUsage DocumentFeaturesStore::getMemoryUsage() const {
+ vespalib::MemoryUsage usage;
usage.incAllocatedBytes(_docs.getMemoryConsumption());
usage.incUsedBytes(_docs.getMemoryUsed());
usage.incAllocatedBytes(_ranges.getMemoryConsumption());
diff --git a/searchlib/src/vespa/searchlib/predicate/document_features_store.h b/searchlib/src/vespa/searchlib/predicate/document_features_store.h
index 4c55b67cb11..ad721e7c43a 100644
--- a/searchlib/src/vespa/searchlib/predicate/document_features_store.h
+++ b/searchlib/src/vespa/searchlib/predicate/document_features_store.h
@@ -76,7 +76,7 @@ public:
void insert(const PredicateTreeAnnotations &annotations, uint32_t docId);
FeatureSet get(uint32_t docId) const;
void remove(uint32_t docId);
- search::MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
void serialize(vespalib::DataBuffer &buffer) const;
};
diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp b/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp
index 822434383db..0b8f5c9a921 100644
--- a/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp
+++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp
@@ -224,9 +224,9 @@ void PredicateIndex::transferHoldLists(generation_t generation) {
_zero_constraint_docs.getAllocator().transferHoldLists(generation);
}
-MemoryUsage PredicateIndex::getMemoryUsage() const {
+vespalib::MemoryUsage PredicateIndex::getMemoryUsage() const {
// TODO Include bit vector cache memory usage
- MemoryUsage combined;
+ vespalib::MemoryUsage combined;
combined.merge(_interval_index.getMemoryUsage());
combined.merge(_bounds_index.getMemoryUsage());
combined.merge(_zero_constraint_docs.getMemoryUsage());
diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.h b/searchlib/src/vespa/searchlib/predicate/predicate_index.h
index c0d855fa138..196c1df16de 100644
--- a/searchlib/src/vespa/searchlib/predicate/predicate_index.h
+++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.h
@@ -78,7 +78,7 @@ public:
void commit();
void trimHoldLists(generation_t used_generation);
void transferHoldLists(generation_t generation);
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
int getArity() const { return _arity; }
diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h b/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h
index 52d3a2fc5b8..1f1a9f3fa07 100644
--- a/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h
+++ b/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h
@@ -78,7 +78,7 @@ public:
/**
* Return memory usage (only the data store is included)
*/
- MemoryUsage getMemoryUsage() const {
+ vespalib::MemoryUsage getMemoryUsage() const {
return _store.getMemoryUsage();
}
diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.h b/searchlib/src/vespa/searchlib/predicate/simple_index.h
index 1c205c25bad..abf7aa9af42 100644
--- a/searchlib/src/vespa/searchlib/predicate/simple_index.h
+++ b/searchlib/src/vespa/searchlib/predicate/simple_index.h
@@ -3,9 +3,9 @@
#pragma once
#include "common.h"
-#include <vespa/searchlib/common/rcuvector.h>
#include <vespa/searchlib/btree/btreestore.h>
#include <vespa/vespalib/data/databuffer.h>
+#include <vespa/vespalib/util/rcuvector.h>
#include <experimental/optional>
namespace search::predicate {
@@ -49,7 +49,7 @@ struct SimpleIndexConfig {
// Use vector posting list in foreach_frozen if doc frequency is above
double foreach_vector_threshold = DEFAULT_FOREACH_VECTOR_THRESHOLD;
// Grow strategy for the posting vectors
- GrowStrategy grow_strategy = GrowStrategy();
+ vespalib::GrowStrategy grow_strategy = vespalib::GrowStrategy();
SimpleIndexConfig() {}
SimpleIndexConfig(double upper_docid_freq_threshold_,
@@ -58,7 +58,7 @@ struct SimpleIndexConfig {
size_t lower_vector_size_threshold_,
size_t vector_prune_frequency_,
double foreach_vector_threshold_,
- GrowStrategy grow_strategy_)
+ vespalib::GrowStrategy grow_strategy_)
: upper_docid_freq_threshold(upper_docid_freq_threshold_),
lower_docid_freq_threshold(lower_docid_freq_threshold_),
upper_vector_size_threshold(upper_vector_size_threshold_),
@@ -66,7 +66,7 @@ struct SimpleIndexConfig {
vector_prune_frequency(vector_prune_frequency_),
foreach_vector_threshold(foreach_vector_threshold_),
grow_strategy(grow_strategy_) {}
- SimpleIndexConfig(double upper_docid_freq_threshold_, GrowStrategy grow_strategy_)
+ SimpleIndexConfig(double upper_docid_freq_threshold_, vespalib::GrowStrategy grow_strategy_)
: upper_docid_freq_threshold(upper_docid_freq_threshold_),
lower_docid_freq_threshold(upper_docid_freq_threshold_ * 0.80),
grow_strategy(grow_strategy_) {}
@@ -74,7 +74,7 @@ struct SimpleIndexConfig {
template <typename Posting, typename Key, typename DocId>
class PostingVectorIterator {
- using PostingVector = attribute::RcuVectorBase<Posting>;
+ using PostingVector = vespalib::RcuVectorBase<Posting>;
const Posting * const _vector;
const size_t _size;
@@ -131,7 +131,7 @@ public:
using BTreeStore = btree::BTreeStore<
DocId, Posting, btree::NoAggregated, std::less<DocId>, btree::BTreeDefaultTraits>;
using BTreeIterator = typename BTreeStore::ConstIterator;
- using PostingVector = attribute::RcuVectorBase<Posting>;
+ using PostingVector = vespalib::RcuVectorBase<Posting>;
using VectorStore = btree::BTree<Key, std::shared_ptr<PostingVector>, btree::NoAggregated>;
using VectorIterator = PostingVectorIterator<Posting, Key, DocId>;
@@ -189,7 +189,7 @@ public:
void commit();
void trimHoldLists(generation_t used_generation);
void transferHoldLists(generation_t generation);
- MemoryUsage getMemoryUsage() const;
+ vespalib::MemoryUsage getMemoryUsage() const;
template <typename FunctionType>
void foreach_frozen_key(datastore::EntryRef ref, Key key, FunctionType func) const;
diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp
index b0b70e9dbb5..dcf35cd7d33 100644
--- a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp
+++ b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp
@@ -3,7 +3,7 @@
#include "simple_index.h"
#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/searchlib/common/rcuvector.hpp>
+#include <vespa/vespalib/util/rcuvector.hpp>
namespace search::predicate {
@@ -232,7 +232,7 @@ void SimpleIndex<Posting, Key, DocId>::createVectorIfOverThreshold(datastore::En
size_t size = getDocumentCount(ref);
double ratio = getDocumentRatio(size, doc_id_limit);
if (shouldCreateVectorPosting(size, ratio)) {
- auto vector = new attribute::RcuVectorBase<Posting>(_config.grow_strategy, _generation_holder);
+ auto vector = new vespalib::RcuVectorBase<Posting>(_config.grow_strategy, _generation_holder);
vector->unsafe_resize(doc_id_limit);
_btree_posting_lists.foreach_unfrozen(
ref, [&](DocId d, const Posting &p) { (*vector)[d] = p; });
@@ -301,8 +301,8 @@ void SimpleIndex<Posting, Key, DocId>::transferHoldLists(generation_t generation
}
template <typename Posting, typename Key, typename DocId>
-MemoryUsage SimpleIndex<Posting, Key, DocId>::getMemoryUsage() const {
- MemoryUsage combined;
+vespalib::MemoryUsage SimpleIndex<Posting, Key, DocId>::getMemoryUsage() const {
+ vespalib::MemoryUsage combined;
combined.merge(_dictionary.getMemoryUsage());
combined.merge(_btree_posting_lists.getMemoryUsage());
combined.merge(_vector_posting_lists.getMemoryUsage());
diff --git a/searchlib/src/vespa/searchlib/tensor/generic_tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/generic_tensor_attribute.cpp
index 7b5a22f6966..aac199ae818 100644
--- a/searchlib/src/vespa/searchlib/tensor/generic_tensor_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/generic_tensor_attribute.cpp
@@ -4,10 +4,10 @@
#include "generic_tensor_attribute_saver.h"
#include "tensor_attribute.hpp"
#include <vespa/eval/tensor/tensor.h>
-#include <vespa/searchlib/common/rcuvector.hpp>
#include <vespa/fastlib/io/bufferedfile.h>
#include <vespa/searchlib/attribute/readerbase.h>
#include <vespa/searchlib/util/fileutil.h>
+#include <vespa/vespalib/util/rcuvector.hpp>
using vespalib::eval::ValueType;
using vespalib::tensor::Tensor;
diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
index 39225e867f8..79b02b09cba 100644
--- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
@@ -7,7 +7,7 @@
#include <vespa/eval/tensor/dense/dense_tensor.h>
#include <vespa/eval/tensor/sparse/sparse_tensor.h>
#include <vespa/eval/tensor/wrapped_simple_tensor.h>
-#include <vespa/searchlib/common/rcuvector.hpp>
+#include <vespa/vespalib/util/rcuvector.hpp>
using vespalib::eval::SimpleTensor;
using vespalib::eval::ValueType;
@@ -125,7 +125,7 @@ void
TensorAttribute::onUpdateStat()
{
// update statistics
- MemoryUsage total = _refVector.getMemoryUsage();
+ vespalib::MemoryUsage total = _refVector.getMemoryUsage();
total.merge(_tensorStore.getMemoryUsage());
total.mergeGenerationHeldBytes(getGenerationHolder().getHeldBytes());
this->updateStatistics(_refVector.size(),
diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h
index 4241a899018..64f978a31d7 100644
--- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h
+++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h
@@ -5,7 +5,7 @@
#include "i_tensor_attribute.h"
#include <vespa/searchlib/attribute/not_implemented_attribute.h>
#include "tensor_store.h"
-#include <vespa/searchlib/common/rcuvector.h>
+#include <vespa/vespalib/util/rcuvector.h>
namespace search::tensor {
@@ -16,7 +16,7 @@ class TensorAttribute : public NotImplementedAttribute, public ITensorAttribute
{
protected:
using EntryRef = TensorStore::EntryRef;
- using RefVector = attribute::RcuVectorBase<EntryRef>;
+ using RefVector = vespalib::RcuVectorBase<EntryRef>;
RefVector _refVector; // docId -> ref in data store for serialized tensor
TensorStore &_tensorStore; // data store for serialized tensors
diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_store.h b/searchlib/src/vespa/searchlib/tensor/tensor_store.h
index 43667158d89..4805c5829c9 100644
--- a/searchlib/src/vespa/searchlib/tensor/tensor_store.h
+++ b/searchlib/src/vespa/searchlib/tensor/tensor_store.h
@@ -55,7 +55,7 @@ public:
_store.clearHoldLists();
}
- MemoryUsage
+ vespalib::MemoryUsage
getMemoryUsage() const
{
return _store.getMemoryUsage();
diff --git a/searchlib/src/vespa/searchlib/test/datastore/memstats.h b/searchlib/src/vespa/searchlib/test/datastore/memstats.h
index c7cc4be9a92..0a5373d0c78 100644
--- a/searchlib/src/vespa/searchlib/test/datastore/memstats.h
+++ b/searchlib/src/vespa/searchlib/test/datastore/memstats.h
@@ -2,9 +2,9 @@
#pragma once
-namespace search {
-namespace datastore {
-namespace test {
+#include <vespa/vespalib/util/memoryusage.h>
+
+namespace search::datastore::test {
/*
* Class representing expected memory stats in unit tests.
@@ -15,7 +15,7 @@ struct MemStats
size_t _hold;
size_t _dead;
MemStats() : _used(0), _hold(0), _dead(0) {}
- MemStats(const MemoryUsage &usage)
+ MemStats(const vespalib::MemoryUsage &usage)
: _used(usage.usedBytes()),
_hold(usage.allocatedBytesOnHold()),
_dead(usage.deadBytes()) {}
@@ -35,5 +35,3 @@ struct MemStats
};
}
-}
-}
diff --git a/searchlib/src/vespa/searchlib/util/memoryusage.h b/searchlib/src/vespa/searchlib/util/memoryusage.h
deleted file mode 100644
index a1cec904dfc..00000000000
--- a/searchlib/src/vespa/searchlib/util/memoryusage.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <cstddef>
-
-namespace search {
-
-class MemoryUsage {
-private:
- size_t _allocatedBytes;
- size_t _usedBytes;
- size_t _deadBytes;
- size_t _allocatedBytesOnHold;
-
-public:
- MemoryUsage()
- : _allocatedBytes(0),
- _usedBytes(0),
- _deadBytes(0),
- _allocatedBytesOnHold(0)
- { }
-
- MemoryUsage(size_t allocated, size_t used, size_t dead, size_t onHold)
- : _allocatedBytes(allocated),
- _usedBytes(used),
- _deadBytes(dead),
- _allocatedBytesOnHold(onHold)
- { }
-
- size_t allocatedBytes() const { return _allocatedBytes; }
- size_t usedBytes() const { return _usedBytes; }
- size_t deadBytes() const { return _deadBytes; }
- size_t allocatedBytesOnHold() const { return _allocatedBytesOnHold; }
- void incAllocatedBytes(size_t inc) { _allocatedBytes += inc; }
- void decAllocatedBytes(size_t dec) { _allocatedBytes -= dec; }
- void incUsedBytes(size_t inc) { _usedBytes += inc; }
- void incDeadBytes(size_t inc) { _deadBytes += inc; }
- void incAllocatedBytesOnHold(size_t inc) { _allocatedBytesOnHold += inc; }
- void decAllocatedBytesOnHold(size_t inc) { _allocatedBytesOnHold -= inc; }
- void setAllocatedBytes(size_t alloc) { _allocatedBytes = alloc; }
- void setUsedBytes(size_t used) { _usedBytes = used; }
- void setDeadBytes(size_t dead) { _deadBytes = dead; }
- void setAllocatedBytesOnHold(size_t onHold) { _allocatedBytesOnHold = onHold; }
-
- void mergeGenerationHeldBytes(size_t inc) {
- _allocatedBytes += inc;
- _usedBytes += inc;
- _allocatedBytesOnHold += inc;
- }
-
- void merge(const MemoryUsage & rhs) {
- _allocatedBytes += rhs._allocatedBytes;
- _usedBytes += rhs._usedBytes;
- _deadBytes += rhs._deadBytes;
- _allocatedBytesOnHold += rhs._allocatedBytesOnHold;
- }
-};
-
-} // namespace search
diff --git a/searchlib/src/vespa/searchlib/util/searchable_stats.h b/searchlib/src/vespa/searchlib/util/searchable_stats.h
index e952a2f7286..4772c04f6be 100644
--- a/searchlib/src/vespa/searchlib/util/searchable_stats.h
+++ b/searchlib/src/vespa/searchlib/util/searchable_stats.h
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include "memoryusage.h"
+#include <vespa/vespalib/util/memoryusage.h>
namespace search {
@@ -13,17 +13,17 @@ namespace search {
class SearchableStats
{
private:
- MemoryUsage _memoryUsage;
+ vespalib::MemoryUsage _memoryUsage;
size_t _docsInMemory;
size_t _sizeOnDisk;
public:
SearchableStats() : _memoryUsage(), _docsInMemory(0), _sizeOnDisk(0) {}
- SearchableStats &memoryUsage(const MemoryUsage &usage) {
+ SearchableStats &memoryUsage(const vespalib::MemoryUsage &usage) {
_memoryUsage = usage;
return *this;
}
- const MemoryUsage &memoryUsage() const { return _memoryUsage; }
+ const vespalib::MemoryUsage &memoryUsage() const { return _memoryUsage; }
SearchableStats &docsInMemory(size_t value) {
_docsInMemory = value;
return *this;