mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-13 03:12:13 +00:00
partition: add method to calculate memory size of a partition
Once that is added, also add a method to a memtable entry to calculate the entire size of a memtable entry. Right now we only have one method to calculate the size minus rows. Signed-off-by: Glauber Costa <glauber@scylladb.com>
This commit is contained in:
@@ -70,6 +70,14 @@ public:
|
||||
return allocator.object_memory_size_in_allocator(this) + external_memory_usage_without_rows();
|
||||
}
|
||||
|
||||
size_t size_in_allocator(allocation_strategy& allocator) {
|
||||
auto size = size_in_allocator_without_rows(allocator);
|
||||
for (auto&& v : _pe.versions()) {
|
||||
size += v.size_in_allocator(allocator);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
struct compare {
|
||||
dht::decorated_key::less_comparator _c;
|
||||
|
||||
|
||||
@@ -63,6 +63,11 @@ partition_version::~partition_version()
|
||||
}
|
||||
}
|
||||
|
||||
size_t partition_version::size_in_allocator(allocation_strategy& allocator) const {
|
||||
return allocator.object_memory_size_in_allocator(this) +
|
||||
partition().external_memory_usage();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
GCC6_CONCEPT(
|
||||
|
||||
@@ -130,6 +130,8 @@ public:
|
||||
|
||||
bool is_referenced() const { return _backref; }
|
||||
partition_version_ref& back_reference() { return *_backref; }
|
||||
|
||||
size_t size_in_allocator(allocation_strategy& allocator) const;
|
||||
};
|
||||
|
||||
using partition_version_range = anchorless_list_base_hook<partition_version>::range;
|
||||
|
||||
Reference in New Issue
Block a user