diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-04-18 23:42:53 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-04-18 23:42:53 +0000 |
commit | 4e6a3f7310d3d9232877ed6f439247b1054b1e47 (patch) | |
tree | d6cbb08a2c7fc77ff67340be512ff75c5cb5e601 /tools/c-index-test/c-index-test.c | |
parent | 3c683367073e2d98a9046060f9bc7db872a1c63d (diff) |
Report memory usage for global code completion results in CXTUMemoryUsage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129733 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r-- | tools/c-index-test/c-index-test.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index b7025fc396..a1065a832f 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -371,19 +371,18 @@ void PrintDiagnostics(CXTranslationUnit TU) { } void PrintMemoryUsage(CXTranslationUnit TU) { - CXTUMemoryUsage usage = clang_getCXTUMemoryUsage(TU); unsigned long total = 0.0; - unsigned i, n; - + unsigned i = 0; + CXTUMemoryUsage usage = clang_getCXTUMemoryUsage(TU); fprintf(stderr, "Memory usage:\n"); - for (i = 0, n = usage.numEntries; i != n; ++i) { + for (i = 0 ; i != usage.numEntries; ++i) { const char *name = clang_getTUMemoryUsageName(usage.entries[i].kind); unsigned long amount = usage.entries[i].amount; total += amount; - fprintf(stderr, " %s : %ld bytes (%lf MBytes)\n", name, amount, + fprintf(stderr, " %s : %ld bytes (%f MBytes)\n", name, amount, ((double) amount)/(1024*1024)); } - fprintf(stderr, " TOTAL = %ld bytes (%lf MBytes)\n", total, + fprintf(stderr, " TOTAL = %ld bytes (%f MBytes)\n", total, ((double) total)/(1024*1024)); clang_disposeCXTUMemoryUsage(usage); } @@ -1548,9 +1547,9 @@ static void print_usage(void) { "<symbol filter> {<args>}*\n" " c-index-test -test-annotate-tokens=<range> {<args>}*\n" " c-index-test -test-inclusion-stack-source {<args>}*\n" - " c-index-test -test-inclusion-stack-tu <AST file>\n" - " c-index-test -test-print-linkage-source {<args>}*\n"); + " c-index-test -test-inclusion-stack-tu <AST file>\n"); fprintf(stderr, + " c-index-test -test-print-linkage-source {<args>}*\n" " c-index-test -test-print-typekind {<args>}*\n" " c-index-test -print-usr [<CursorKind> {<args>}]*\n" " c-index-test -print-usr-file <file>\n" |