summaryrefslogtreecommitdiff
path: root/lib/tsan/rtl/tsan_platform_linux.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2014-05-29 14:11:38 +0000
committerDmitry Vyukov <dvyukov@google.com>2014-05-29 14:11:38 +0000
commit1ca74c96b0ce4cb9fdfe903c47e337dc24ed2fc6 (patch)
treea23a5330ae55a8a6e6f2b55d96028f8ce0fc91f1 /lib/tsan/rtl/tsan_platform_linux.cc
parent8113ec81a6732cf42863fb4406dc983fb05ac7b9 (diff)
downloadcompiler-rt-1ca74c96b0ce4cb9fdfe903c47e337dc24ed2fc6.tar.gz
tsan: write memory profile in one line (which is much more readable)
e.g.: RSS 420 MB: shadow:35 meta:231 file:2 mmap:129 trace:19 heap:0 other:0 nthr=1/31 RSS 365 MB: shadow:3 meta:231 file:2 mmap:106 trace:19 heap:0 other:0 nthr=1/31 RSS 429 MB: shadow:23 meta:234 file:2 mmap:143 trace:19 heap:6 other:0 nthr=1/31 RSS 509 MB: shadow:78 meta:241 file:2 mmap:147 trace:19 heap:19 other:0 nthr=1/31 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209813 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_platform_linux.cc')
-rw-r--r--lib/tsan/rtl/tsan_platform_linux.cc17
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/tsan/rtl/tsan_platform_linux.cc b/lib/tsan/rtl/tsan_platform_linux.cc
index 7ad81d726..bfcceefb3 100644
--- a/lib/tsan/rtl/tsan_platform_linux.cc
+++ b/lib/tsan/rtl/tsan_platform_linux.cc
@@ -55,8 +55,6 @@
# undef sa_sigaction
#endif
-extern "C" struct mallinfo __libc_mallinfo();
-
namespace __tsan {
const uptr kPageSize = 4096;
@@ -93,21 +91,16 @@ void FillProfileCallback(uptr start, uptr rss, bool file,
mem[MemOther] += rss;
}
-void WriteMemoryProfile(char *buf, uptr buf_size) {
+void WriteMemoryProfile(char *buf, uptr buf_size, uptr nthread, uptr nlive) {
uptr mem[MemCount] = {};
__sanitizer::GetMemoryProfile(FillProfileCallback, mem, 7);
- char *buf_pos = buf;
- char *buf_end = buf + buf_size;
- buf_pos += internal_snprintf(buf_pos, buf_end - buf_pos,
+ internal_snprintf(buf, buf_size,
"RSS %zd MB: shadow:%zd meta:%zd file:%zd mmap:%zd"
- " trace:%zd heap:%zd other:%zd\n",
+ " trace:%zd heap:%zd other:%zd nthr=%zd/%zd\n",
mem[MemTotal] >> 20, mem[MemShadow] >> 20, mem[MemMeta] >> 20,
mem[MemFile] >> 20, mem[MemMmap] >> 20, mem[MemTrace] >> 20,
- mem[MemHeap] >> 20, mem[MemOther] >> 20);
- struct mallinfo mi = __libc_mallinfo();
- buf_pos += internal_snprintf(buf_pos, buf_end - buf_pos,
- "mallinfo: arena=%d mmap=%d fordblks=%d keepcost=%d\n",
- mi.arena >> 20, mi.hblkhd >> 20, mi.fordblks >> 20, mi.keepcost >> 20);
+ mem[MemHeap] >> 20, mem[MemOther] >> 20,
+ nlive, nthread);
}
uptr GetRSS() {