summaryrefslogtreecommitdiffstats
path: root/lldb/source/DataFormatters/FormatManager.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2013-06-26 01:03:38 +0000
committerEnrico Granata <egranata@apple.com>2013-06-26 01:03:38 +0000
commitc2a96407c5fc10198a8640445c2b44d057addd26 (patch)
treec4a6926b459c660c1c3e94c529bef3b01b4630cf /lldb/source/DataFormatters/FormatManager.cpp
parent15571f1571d3454c60c9709283e337c359abab42 (diff)
downloadbcm5719-llvm-c2a96407c5fc10198a8640445c2b44d057addd26.tar.gz
bcm5719-llvm-c2a96407c5fc10198a8640445c2b44d057addd26.zip
Remove the #define USE_CACHE since the formatters cache has been operational for a while now and has not caused issues that warrant disabling it
Also, print the cache hits statistics if the log is in debugging mode vs. LLDB being a debug build - this should make it easier to gather useful metrics on cache success rate for real users llvm-svn: 184900
Diffstat (limited to 'lldb/source/DataFormatters/FormatManager.cpp')
-rw-r--r--lldb/source/DataFormatters/FormatManager.cpp30
1 files changed, 7 insertions, 23 deletions
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 366642144a6..af599a77c78 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -334,13 +334,11 @@ GetTypeForCache (ValueObject& valobj,
return ConstString();
}
-#define USE_CACHE 1
lldb::TypeSummaryImplSP
FormatManager::GetSummaryFormat (ValueObject& valobj,
lldb::DynamicValueType use_dynamic)
{
TypeSummaryImplSP retval;
-#if USE_CACHE
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
if (valobj_type)
@@ -352,39 +350,32 @@ FormatManager::GetSummaryFormat (ValueObject& valobj,
if (log)
{
log->Printf("[FormatManager::GetSummaryFormat] Cache search success. Returning.");
-#ifdef LLDB_CONFIGURATION_DEBUG
- log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-#endif
+ if (log->GetDebug())
+ log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
}
return retval;
}
if (log)
log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. Going normal route");
}
-#endif
retval = m_categories_map.GetSummaryFormat(valobj, use_dynamic);
-#if USE_CACHE
if (valobj_type)
{
if (log)
log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>"));
m_format_cache.SetSummary(valobj_type,retval);
}
-#ifdef LLDB_CONFIGURATION_DEBUG
- if (log)
+ if (log && log->GetDebug())
log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-#endif
-#endif
return retval;
}
#ifndef LLDB_DISABLE_PYTHON
lldb::SyntheticChildrenSP
FormatManager::GetSyntheticChildren (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
+ lldb::DynamicValueType use_dynamic)
{
SyntheticChildrenSP retval;
-#if USE_CACHE
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
if (valobj_type)
@@ -396,33 +387,26 @@ FormatManager::GetSyntheticChildren (ValueObject& valobj,
if (log)
{
log->Printf("[FormatManager::GetSyntheticChildren] Cache search success. Returning.");
-#ifdef LLDB_CONFIGURATION_DEBUG
- log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-#endif
+ if (log->GetDebug())
+ log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
}
return retval;
}
if (log)
log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. Going normal route");
}
-#endif
retval = m_categories_map.GetSyntheticChildren(valobj, use_dynamic);
-#if USE_CACHE
if (valobj_type)
{
if (log)
log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>"));
m_format_cache.SetSynthetic(valobj_type,retval);
}
-#ifdef LLDB_CONFIGURATION_DEBUG
- if (log)
+ if (log && log->GetDebug())
log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-#endif
-#endif
return retval;
}
#endif
-#undef USE_CACHE
FormatManager::FormatManager() :
m_format_cache(),
OpenPOWER on IntegriCloud