diff options
| author | Ted Kremenek <kremenek@apple.com> | 2011-04-28 04:53:38 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2011-04-28 04:53:38 +0000 |
| commit | f5df0ce94985cd785c1709ab2df92552f0b8577e (patch) | |
| tree | dbbd90874dc8d1e318e671cbca02eac78dd18884 /clang/tools/libclang/CIndex.cpp | |
| parent | 290173155355c5b84f76a10f09151b642f8abce5 (diff) | |
| download | bcm5719-llvm-f5df0ce94985cd785c1709ab2df92552f0b8577e.tar.gz bcm5719-llvm-f5df0ce94985cd785c1709ab2df92552f0b8577e.zip | |
Enhance clang_getCXTUResourceUsage() to report the amount of memory used by ASTContext's side tables.
llvm-svn: 130383
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
| -rw-r--r-- | clang/tools/libclang/CIndex.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index c72d49634bd..26e4af40491 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -5198,7 +5198,7 @@ typedef std::vector<CXTUResourceUsageEntry> MemUsageEntries; static inline void createCXTUResourceUsageEntry(MemUsageEntries &entries, enum CXTUResourceUsageKind k, - double amount) { + unsigned long amount) { CXTUResourceUsageEntry entry = { k, amount }; entries.push_back(entry); } @@ -5223,6 +5223,9 @@ const char *clang_getTUResourceUsageName(CXTUResourceUsageKind kind) { case CXTUResourceUsage_SourceManagerContentCache: str = "SourceManager: content cache allocator"; break; + case CXTUResourceUsage_AST_SideTables: + str = "ASTContext: side tables"; + break; } return str; } @@ -5239,7 +5242,7 @@ CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU) { // How much memory is used by AST nodes and types? createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_AST, - (unsigned long) astContext.getTotalAllocatedMemory()); + (unsigned long) astContext.getASTAllocatedMemory()); // How much memory is used by identifiers? createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_Identifiers, @@ -5249,6 +5252,10 @@ CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU) { createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_Selectors, (unsigned long) astContext.Selectors.getTotalMemory()); + // How much memory is used by ASTContext's side tables? + createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_AST_SideTables, + (unsigned long) astContext.getSideTableAllocatedMemory()); + // How much memory is used for caching global code completion results? unsigned long completionBytes = 0; if (GlobalCodeCompletionAllocator *completionAllocator = |

