Kernel: Deduplicate signpost perf event strings

This commit is contained in:
Ali Mohammad Pur 2021-09-11 16:48:15 +04:30 committed by Ali Mohammad Pur
parent d600f0d5b3
commit e1e91f6c85
2 changed files with 3 additions and 3 deletions

View file

@ -169,7 +169,7 @@ KResult PerformanceEventBuffer::to_json_impl(Serializer& object) const
{
auto strings = object.add_array("strings");
for (auto& it : m_strings) {
strings.add(it.view());
strings.add(it->view());
}
}
@ -309,7 +309,7 @@ KResultOr<FlatPtr> PerformanceEventBuffer::register_string(NonnullOwnPtr<KString
{
FlatPtr string_id = m_strings.size();
if (!m_strings.try_append(move(string)))
if (m_strings.try_set(move(string)) == AK::HashSetResult::Failed)
return ENOBUFS;
return string_id;

View file

@ -133,7 +133,7 @@ private:
size_t m_count { 0 };
NonnullOwnPtr<KBuffer> m_buffer;
NonnullOwnPtrVector<KString> m_strings;
HashTable<NonnullOwnPtr<KString>> m_strings;
};
extern bool g_profiling_all_threads;