From e7a87bcc61345ecbf052a9af1ea6de48f247ce2c Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Thu, 8 Apr 2021 18:37:46 +0200 Subject: Report hash and B-tree memory usage separately for enum store dictionary. --- .../vespalib/datastore/i_unique_store_dictionary.h | 2 ++ .../vespalib/datastore/unique_store_dictionary.h | 2 ++ .../vespalib/datastore/unique_store_dictionary.hpp | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+) (limited to 'vespalib') 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 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 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::get_has_hash_ return has_hash_dictionary; } +template +vespalib::MemoryUsage +UniqueStoreDictionary::get_btree_memory_usage() const +{ + if constexpr (has_btree_dictionary) { + return this->_btree_dict.getMemoryUsage(); + } + return {}; +} + +template +vespalib::MemoryUsage +UniqueStoreDictionary::get_hash_memory_usage() const +{ + if constexpr (has_hash_dictionary) { + return this->_hash_dict.get_memory_usage(); + } + return {}; +} + } -- cgit v1.2.3