diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2013-03-21 06:24:31 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2013-03-21 06:24:31 +0000 |
commit | 78693730a41bce7254b366d37b618233571dbdb8 (patch) | |
tree | c82353fd095558d02be788eda286be2d8ab7ea31 /compiler-rt/lib/sanitizer_common/sanitizer_linux.cc | |
parent | c962f9a624dc748a1c5b5a1c623db65312fed865 (diff) | |
download | bcm5719-llvm-78693730a41bce7254b366d37b618233571dbdb8.tar.gz bcm5719-llvm-78693730a41bce7254b366d37b618233571dbdb8.zip |
tsan: use a single background thread for memory profiler and memory flush (and later for symbolizer flush)
llvm-svn: 177627
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_linux.cc')
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_linux.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc index 3c9ae418af7..5f490145c0c 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -44,6 +44,12 @@ #include <sys/signal.h> #endif +// <linux/time.h> +struct kernel_timeval { + long tv_sec; + long tv_usec; +}; + // <linux/futex.h> is broken on some linux distributions. const int FUTEX_WAIT = 0; const int FUTEX_WAKE = 1; @@ -177,6 +183,12 @@ uptr GetTid() { return syscall(__NR_gettid); } +u64 NanoTime() { + kernel_timeval tv; + syscall(__NR_gettimeofday, &tv, 0); + return (u64)tv.tv_sec * 1000*1000*1000 + tv.tv_usec * 1000; +} + void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top, uptr *stack_bottom) { static const uptr kMaxThreadStackSize = 256 * (1 << 20); // 256M |