tsan: output stats about stackdepot in memory profiler
quite amusing on some programs: RSS 9152 MB: shadow:2456 meta:1736 file:454 mmap:3442 trace:196 heap:866 other:0 stacks=176[1065994] nthr=157/159 ... RSS 30192 MB: shadow:613 meta:5550 file:1839 mmap:20487 trace:212 heap:1489 other:0 stacks=12870[1599445] nthr=162/165 ... RSS 42232 MB: shadow:599 meta:8199 file:2304 mmap:29420 trace:213 heap:1494 other:0 stacks=17794[1690645] nthr=162/165 llvm-svn: 218988
This commit is contained in:
parent
40d809399f
commit
7e1accefa2
@ -20,6 +20,7 @@
|
||||
#include "sanitizer_common/sanitizer_libc.h"
|
||||
#include "sanitizer_common/sanitizer_procmaps.h"
|
||||
#include "sanitizer_common/sanitizer_stoptheworld.h"
|
||||
#include "sanitizer_common/sanitizer_stackdepot.h"
|
||||
#include "tsan_platform.h"
|
||||
#include "tsan_rtl.h"
|
||||
#include "tsan_flags.h"
|
||||
@ -99,12 +100,14 @@ void FillProfileCallback(uptr start, uptr rss, bool file,
|
||||
void WriteMemoryProfile(char *buf, uptr buf_size, uptr nthread, uptr nlive) {
|
||||
uptr mem[MemCount] = {};
|
||||
__sanitizer::GetMemoryProfile(FillProfileCallback, mem, 7);
|
||||
StackDepotStats *stacks = StackDepotGetStats();
|
||||
internal_snprintf(buf, buf_size,
|
||||
"RSS %zd MB: shadow:%zd meta:%zd file:%zd mmap:%zd"
|
||||
" trace:%zd heap:%zd other:%zd nthr=%zd/%zd\n",
|
||||
" trace:%zd heap:%zd other:%zd 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,
|
||||
stacks->allocated >> 20, stacks->n_uniq_ids,
|
||||
nlive, nthread);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user