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 | 11d1a42e841e972478df47aa6a2758d0fc66e3e5 (patch) | |
tree | 062654ee10214db309b68c69f890dce6102d9b97 /clang/tools/c-index-test/c-index-test.c | |
parent | 45cc546271d5e2bc90bf6e8fd23fa629e20af47a (diff) | |
download | bcm5719-llvm-11d1a42e841e972478df47aa6a2758d0fc66e3e5.tar.gz bcm5719-llvm-11d1a42e841e972478df47aa6a2758d0fc66e3e5.zip |
Report memory usage for global code completion results in CXTUMemoryUsage.
llvm-svn: 129733
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index b7025fc3965..a1065a832f4 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/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" |