summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2021-04-08 18:37:46 +0200
committerTor Egge <Tor.Egge@online.no>2021-04-08 18:37:46 +0200
commite7a87bcc61345ecbf052a9af1ea6de48f247ce2c (patch)
treee704f34acae631fcf1846889d67a9737db633f24 /vespalib
parenteff866c032cc63600073e8874502d2454ea58eda (diff)
Report hash and B-tree memory usage separately for enum store dictionary.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp20
3 files changed, 24 insertions, 0 deletions
diff --git a/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h b/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h
index 8493e8990e3..4f53a872822 100644
--- a/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h
+++ b/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h
@@ -37,6 +37,8 @@ public:
virtual std::unique_ptr<IUniqueStoreDictionaryReadSnapshot> get_read_snapshot() const = 0;
virtual bool get_has_btree_dictionary() const = 0;
virtual bool get_has_hash_dictionary() const = 0;
+ virtual vespalib::MemoryUsage get_btree_memory_usage() const = 0;
+ virtual vespalib::MemoryUsage get_hash_memory_usage() const = 0;
};
}
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h
index 612188b4653..faaa2294ff3 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h
@@ -88,6 +88,8 @@ public:
std::unique_ptr<IUniqueStoreDictionaryReadSnapshot> get_read_snapshot() const override;
bool get_has_btree_dictionary() const override;
bool get_has_hash_dictionary() const override;
+ vespalib::MemoryUsage get_btree_memory_usage() const override;
+ vespalib::MemoryUsage get_hash_memory_usage() const override;
};
}
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp
index 825db1a8cb5..4a9cf3d96b2 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp
@@ -298,4 +298,24 @@ UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::get_has_hash_
return has_hash_dictionary;
}
+template <typename BTreeDictionaryT, typename ParentT, typename HashDictionaryT>
+vespalib::MemoryUsage
+UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::get_btree_memory_usage() const
+{
+ if constexpr (has_btree_dictionary) {
+ return this->_btree_dict.getMemoryUsage();
+ }
+ return {};
+}
+
+template <typename BTreeDictionaryT, typename ParentT, typename HashDictionaryT>
+vespalib::MemoryUsage
+UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::get_hash_memory_usage() const
+{
+ if constexpr (has_hash_dictionary) {
+ return this->_hash_dict.get_memory_usage();
+ }
+ return {};
+}
+
}