From 11d1a42e841e972478df47aa6a2758d0fc66e3e5 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 18 Apr 2011 23:42:53 +0000 Subject: Report memory usage for global code completion results in CXTUMemoryUsage. llvm-svn: 129733 --- clang/tools/c-index-test/c-index-test.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'clang/tools/c-index-test/c-index-test.c') 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) { " {}*\n" " c-index-test -test-annotate-tokens= {}*\n" " c-index-test -test-inclusion-stack-source {}*\n" - " c-index-test -test-inclusion-stack-tu \n" - " c-index-test -test-print-linkage-source {}*\n"); + " c-index-test -test-inclusion-stack-tu \n"); fprintf(stderr, + " c-index-test -test-print-linkage-source {}*\n" " c-index-test -test-print-typekind {}*\n" " c-index-test -print-usr [ {}]*\n" " c-index-test -print-usr-file \n" -- cgit v1.2.3