[compiler-rt] b8aa9b0 - tsan: include internal allocator info in mem profile
Dmitry Vyukov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 22 01:17:06 PDT 2021
Author: Dmitry Vyukov
Date: 2021-09-22T10:17:01+02:00
New Revision: b8aa9b0c37f4914cdd68aef5cf32fb411d2674c0
URL: https://github.com/llvm/llvm-project/commit/b8aa9b0c37f4914cdd68aef5cf32fb411d2674c0
DIFF: https://github.com/llvm/llvm-project/commit/b8aa9b0c37f4914cdd68aef5cf32fb411d2674c0.diff
LOG: tsan: include internal allocator info in mem profile
We allocate things from the internal allocator,
it's useful to know how much it consumes.
Depends on D110150.
Reviewed By: melver, vitalybuka
Differential Revision: https://reviews.llvm.org/D110151
Added:
Modified:
compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
index feec6413063d..57a6945d5ebd 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
@@ -127,20 +127,24 @@ void WriteMemoryProfile(char *buf, uptr buf_size) {
StackDepotStats *stacks = StackDepotGetStats();
uptr nthread, nlive;
ctx->thread_registry.GetNumberOfThreads(&nthread, &nlive);
+ uptr internal_stats[AllocatorStatCount];
+ internal_allocator()->GetStats(internal_stats);
// All these are allocated from the common mmap region.
- mem[MemMmap] -= meta.mem_block + meta.sync_obj + stacks->allocated;
+ mem[MemMmap] -= meta.mem_block + meta.sync_obj + stacks->allocated +
+ internal_stats[AllocatorStatMapped];
if (s64(mem[MemMmap]) < 0)
mem[MemMmap] = 0;
- internal_snprintf(buf, buf_size,
- "RSS %zd MB: shadow:%zd meta:%zd file:%zd mmap:%zd"
- " trace:%zd heap:%zd other:%zd memblocks:%zd syncobj:%zu"
- " stacks=%zd[%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, meta.mem_block >> 20,
- meta.sync_obj >> 20, stacks->allocated >> 20,
- stacks->n_uniq_ids, nlive, nthread);
+ internal_snprintf(
+ buf, buf_size,
+ "RSS %zd MB: shadow:%zd meta:%zd file:%zd mmap:%zd"
+ " trace:%zd heap:%zd other:%zd intalloc:%zd memblocks:%zd syncobj:%zu"
+ " stacks=%zd[%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,
+ internal_stats[AllocatorStatMapped] >> 20, meta.mem_block >> 20,
+ meta.sync_obj >> 20, stacks->allocated >> 20, stacks->n_uniq_ids, nlive,
+ nthread);
}
# if SANITIZER_LINUX
More information about the llvm-commits
mailing list