summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2024-02-28 12:33:25 +1100
committerMaxime Coste <mawww@kakoune.org>2024-02-28 12:33:25 +1100
commit9a299b001607df2fc846fe8d1a5ee90cbb9e8332 (patch)
treee97ab8e0491b9dc2402ad560bebb8c5dcd452cae
parente56ffd9d3659a4f74133e5d137bb56459d838cfd (diff)
improve :debug shared-strings
-rw-r--r--src/shared_string.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/shared_string.cc b/src/shared_string.cc
index 7291699c..862277bd 100644
--- a/src/shared_string.cc
+++ b/src/shared_string.cc
@@ -51,15 +51,16 @@ void StringData::Registry::remove(StringView str)
void StringData::Registry::debug_stats() const
{
- write_to_debug_buffer("Shared Strings stats:");
+ write_to_debug_buffer("Interned Strings stats:");
+ size_t count = m_strings.size();
size_t total_refcount = 0;
size_t total_size = 0;
- size_t count = m_strings.size();
for (auto& st : m_strings)
{
- total_refcount += (st.value->refcount & refcount_mask) - 1;
+ total_refcount += st.value->refcount & refcount_mask;
total_size += (int)st.value->length;
}
+ write_to_debug_buffer(format(" count: {}", count));
write_to_debug_buffer(format(" data size: {}, mean: {}", total_size, (float)total_size/count));
write_to_debug_buffer(format(" refcounts: {}, mean: {}", total_refcount, (float)total_refcount/count));
}