summaryrefslogtreecommitdiff
path: root/lib/asan/asan_stats.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-06-06 13:11:29 +0000
committerAlexey Samsonov <samsonov@google.com>2012-06-06 13:11:29 +0000
commite954101f6602ac181a2c3accfbbad0ae51b0bf7c (patch)
tree59996ca17d614af49772a8c83e378e6829ebb212 /lib/asan/asan_stats.cc
parente4309e8141382372465ea065e86d8f946aa99c38 (diff)
downloadcompiler-rt-e954101f6602ac181a2c3accfbbad0ae51b0bf7c.tar.gz
[Sanitizer]: Introduce a common internal printf function. For now, also use tool-specific wrappers TsanPrintf (its output is controlled by TSan flags) and AsanPrintf (which copies its results to the ASan-private buffer). Supported formats: %[z]{d,u,x}, %s, %p. Re-write all format strings in TSan according to this format (this should have no effect on 64-bit platforms).
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158065 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_stats.cc')
-rw-r--r--lib/asan/asan_stats.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/asan/asan_stats.cc b/lib/asan/asan_stats.cc
index eb687bdf0..ef5e53a8b 100644
--- a/lib/asan/asan_stats.cc
+++ b/lib/asan/asan_stats.cc
@@ -27,30 +27,30 @@ AsanStats::AsanStats() {
static void PrintMallocStatsArray(const char *prefix,
uptr (&array)[kNumberOfSizeClasses]) {
- Printf("%s", prefix);
+ AsanPrintf("%s", prefix);
for (uptr i = 0; i < kNumberOfSizeClasses; i++) {
if (!array[i]) continue;
- Printf("%zu:%zu; ", i, array[i]);
+ AsanPrintf("%zu:%zu; ", i, array[i]);
}
- Printf("\n");
+ AsanPrintf("\n");
}
void AsanStats::Print() {
- Printf("Stats: %zuM malloced (%zuM for red zones) by %zu calls\n",
- malloced>>20, malloced_redzones>>20, mallocs);
- Printf("Stats: %zuM realloced by %zu calls\n", realloced>>20, reallocs);
- Printf("Stats: %zuM freed by %zu calls\n", freed>>20, frees);
- Printf("Stats: %zuM really freed by %zu calls\n",
- really_freed>>20, real_frees);
- Printf("Stats: %zuM (%zu full pages) mmaped in %zu calls\n",
- mmaped>>20, mmaped / kPageSize, mmaps);
+ AsanPrintf("Stats: %zuM malloced (%zuM for red zones) by %zu calls\n",
+ malloced>>20, malloced_redzones>>20, mallocs);
+ AsanPrintf("Stats: %zuM realloced by %zu calls\n", realloced>>20, reallocs);
+ AsanPrintf("Stats: %zuM freed by %zu calls\n", freed>>20, frees);
+ AsanPrintf("Stats: %zuM really freed by %zu calls\n",
+ really_freed>>20, real_frees);
+ AsanPrintf("Stats: %zuM (%zu full pages) mmaped in %zu calls\n",
+ mmaped>>20, mmaped / kPageSize, mmaps);
PrintMallocStatsArray(" mmaps by size class: ", mmaped_by_size);
PrintMallocStatsArray(" mallocs by size class: ", malloced_by_size);
PrintMallocStatsArray(" frees by size class: ", freed_by_size);
PrintMallocStatsArray(" rfrees by size class: ", really_freed_by_size);
- Printf("Stats: malloc large: %zu small slow: %zu\n",
- malloc_large, malloc_small_slow);
+ AsanPrintf("Stats: malloc large: %zu small slow: %zu\n",
+ malloc_large, malloc_small_slow);
}
static AsanLock print_lock(LINKER_INITIALIZED);