forked from OSchip/llvm-project
tsan: allow to write memory profile to stdout/stderr
llvm-svn: 209811
This commit is contained in:
parent
bde4c9c773
commit
ef5f26bf19
|
|
@ -131,7 +131,11 @@ static void BackgroundThread(void *arg) {
|
||||||
|
|
||||||
fd_t mprof_fd = kInvalidFd;
|
fd_t mprof_fd = kInvalidFd;
|
||||||
if (flags()->profile_memory && flags()->profile_memory[0]) {
|
if (flags()->profile_memory && flags()->profile_memory[0]) {
|
||||||
// FIXME(dvyukov): support stdout/stderr
|
if (internal_strcmp(flags()->profile_memory, "stdout") == 0) {
|
||||||
|
mprof_fd = 1;
|
||||||
|
} else if (internal_strcmp(flags()->profile_memory, "stderr") == 0) {
|
||||||
|
mprof_fd = 2;
|
||||||
|
} else {
|
||||||
InternalScopedBuffer<char> filename(4096);
|
InternalScopedBuffer<char> filename(4096);
|
||||||
internal_snprintf(filename.data(), filename.size(), "%s.%d",
|
internal_snprintf(filename.data(), filename.size(), "%s.%d",
|
||||||
flags()->profile_memory, (int)internal_getpid());
|
flags()->profile_memory, (int)internal_getpid());
|
||||||
|
|
@ -143,6 +147,7 @@ static void BackgroundThread(void *arg) {
|
||||||
mprof_fd = openrv;
|
mprof_fd = openrv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
u64 last_flush = NanoTime();
|
u64 last_flush = NanoTime();
|
||||||
u64 last_rss_check = NanoTime();
|
u64 last_rss_check = NanoTime();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue