зеркало из https://github.com/microsoft/clang.git
Enhance clang_getCXTUResourceUsage() to report the amount of memory used by SourceManager's content cache allocator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130380 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d7f02df6e9
Коммит
457aaf0692
|
@ -1021,13 +1021,14 @@ enum CXTUResourceUsageKind {
|
|||
CXTUResourceUsage_Identifiers = 2,
|
||||
CXTUResourceUsage_Selectors = 3,
|
||||
CXTUResourceUsage_GlobalCompletionResults = 4,
|
||||
CXTUResourceUsage_SourceManagerContentCache = 5,
|
||||
|
||||
CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST,
|
||||
CXTUResourceUsage_MEMORY_IN_BYTES_END =
|
||||
CXTUResourceUsage_GlobalCompletionResults,
|
||||
CXTUResourceUsage_SourceManagerContentCache,
|
||||
|
||||
CXTUResourceUsage_First = CXTUResourceUsage_AST,
|
||||
CXTUResourceUsage_Last = CXTUResourceUsage_GlobalCompletionResults
|
||||
CXTUResourceUsage_Last = CXTUResourceUsage_SourceManagerContentCache
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -849,6 +849,16 @@ public:
|
|||
/// \brief Retrieve the stored line table.
|
||||
LineTableInfo &getLineTable();
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Queries for performance analysis.
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
/// Return the total amount of physical memory allocated by the
|
||||
/// ContentCache allocator.
|
||||
size_t getContentCacheSize() const {
|
||||
return ContentCacheAlloc.getTotalMemory();
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Other miscellaneous methods.
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
|
|
@ -5220,6 +5220,9 @@ const char *clang_getTUResourceUsageName(CXTUResourceUsageKind kind) {
|
|||
case CXTUResourceUsage_GlobalCompletionResults:
|
||||
str = "Code completion: cached global results";
|
||||
break;
|
||||
case CXTUResourceUsage_SourceManagerContentCache:
|
||||
str = "SourceManager: content cache allocator";
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
@ -5252,8 +5255,14 @@ CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU) {
|
|||
astUnit->getCachedCompletionAllocator().getPtr()) {
|
||||
completionBytes = completionAllocator-> getTotalMemory();
|
||||
}
|
||||
createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_GlobalCompletionResults,
|
||||
completionBytes);
|
||||
createCXTUResourceUsageEntry(*entries,
|
||||
CXTUResourceUsage_GlobalCompletionResults,
|
||||
completionBytes);
|
||||
|
||||
// How much memory is being used by SourceManager's content cache?
|
||||
createCXTUResourceUsageEntry(*entries,
|
||||
CXTUResourceUsage_SourceManagerContentCache,
|
||||
(unsigned long) astContext.getSourceManager().getContentCacheSize());
|
||||
|
||||
|
||||
CXTUResourceUsage usage = { (void*) entries.get(),
|
||||
|
|
Загрузка…
Ссылка в новой задаче