1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-08-16 16:20:38 +03:00

improve :debug shared-strings

This commit is contained in:
Maxime Coste 2024-02-28 12:33:25 +11:00
parent e56ffd9d36
commit 9a299b0016

View File

@ -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));
}