summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-04-28 04:10:31 +0000
committerTed Kremenek <kremenek@apple.com>2011-04-28 04:10:31 +0000
commit21735e608df5c0a028bc3f121e7e89113328f992 (patch)
tree2e53e3ca4ec7326f79dd0dd0bc012d75ea81928c /clang/tools/libclang/CIndex.cpp
parent2eeee8cfef106782eefa249b275df91055441d39 (diff)
downloadbcm5719-llvm-21735e608df5c0a028bc3f121e7e89113328f992.tar.gz
bcm5719-llvm-21735e608df5c0a028bc3f121e7e89113328f992.zip
Enhance clang_getCXTUResourceUsage() to report the amount of memory used by SourceManager's content cache allocator.
llvm-svn: 130380
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 673f3eb5091..c72d49634bd 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -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(),
OpenPOWER on IntegriCloud