Author: Raphael Isemann Date: 2020-03-24T20:16:43+01:00 New Revision: 6b6a779ca8ce4025ed0a38fbcfcb6c07334ace57
URL: https://github.com/llvm/llvm-project/commit/6b6a779ca8ce4025ed0a38fbcfcb6c07334ace57 DIFF: https://github.com/llvm/llvm-project/commit/6b6a779ca8ce4025ed0a38fbcfcb6c07334ace57.diff LOG: [lldb][NFC] Always update m_cache_{hits/misses} in FormatCache Summary: These two variables are only incremented under LLDB_CONFIGURATION_DEBUG but their value is always logged when verbose lldb formatter logging is enabled, which causes that our cache hit/miss log looks like this in non-Debug builds: ``` Cache hits: 0 - Cache Misses: 0 ... Cache hits: 0 - Cache Misses: 0 ... Cache hits: 0 - Cache Misses: 0 ``` This just always increments those two counters independent of build mode. Reviewers: JDevlieghere Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D76687 Added: Modified: lldb/include/lldb/DataFormatters/FormatCache.h lldb/source/DataFormatters/FormatCache.cpp Removed: ################################################################################ diff --git a/lldb/include/lldb/DataFormatters/FormatCache.h b/lldb/include/lldb/DataFormatters/FormatCache.h index 581744c04f79..e75aaee1a7bb 100644 --- a/lldb/include/lldb/DataFormatters/FormatCache.h +++ b/lldb/include/lldb/DataFormatters/FormatCache.h @@ -49,13 +49,13 @@ class FormatCache { CacheMap m_map; std::recursive_mutex m_mutex; - uint64_t m_cache_hits; - uint64_t m_cache_misses; + uint64_t m_cache_hits = 0; + uint64_t m_cache_misses = 0; Entry &GetEntry(ConstString type); public: - FormatCache(); + FormatCache() = default; template <typename ImplSP> bool Get(ConstString type, ImplSP &format_impl_sp); void Set(ConstString type, lldb::TypeFormatImplSP &format_sp); diff --git a/lldb/source/DataFormatters/FormatCache.cpp b/lldb/source/DataFormatters/FormatCache.cpp index f7e5c72f7781..5e0965fcdae4 100644 --- a/lldb/source/DataFormatters/FormatCache.cpp +++ b/lldb/source/DataFormatters/FormatCache.cpp @@ -51,15 +51,6 @@ void FormatCache::Entry::Set(lldb::SyntheticChildrenSP synthetic_sp) { m_synthetic_sp = synthetic_sp; } -FormatCache::FormatCache() - : m_map(), m_mutex() -#ifdef LLDB_CONFIGURATION_DEBUG - , - m_cache_hits(0), m_cache_misses(0) -#endif -{ -} - FormatCache::Entry &FormatCache::GetEntry(ConstString type) { auto i = m_map.find(type), e = m_map.end(); if (i != e) @@ -87,15 +78,11 @@ bool FormatCache::Get(ConstString type, ImplSP &format_impl_sp) { std::lock_guard<std::recursive_mutex> guard(m_mutex); auto entry = GetEntry(type); if (entry.IsCached<ImplSP>()) { -#ifdef LLDB_CONFIGURATION_DEBUG m_cache_hits++; -#endif entry.Get(format_impl_sp); return true; } -#ifdef LLDB_CONFIGURATION_DEBUG m_cache_misses++; -#endif format_impl_sp.reset(); return false; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits