[PATCH] D42579: [sanitizer] Implement NanoTime & MonotonicNanoTime for Windows
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 1 13:41:00 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT324011: [sanitizer] Implement NanoTime & MonotonicNanoTime for Windows (authored by cryptoad, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D42579?vs=132447&id=132467#toc
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D42579
Files:
lib/sanitizer_common/sanitizer_flags.inc
lib/sanitizer_common/sanitizer_win.cc
Index: lib/sanitizer_common/sanitizer_flags.inc
===================================================================
--- lib/sanitizer_common/sanitizer_flags.inc
+++ lib/sanitizer_common/sanitizer_flags.inc
@@ -132,7 +132,8 @@
" This limit does not affect memory allocations other than"
" malloc/new.")
COMMON_FLAG(bool, heap_profile, false, "Experimental heap profiler, asan-only")
-COMMON_FLAG(s32, allocator_release_to_os_interval_ms, 5000,
+COMMON_FLAG(s32, allocator_release_to_os_interval_ms,
+ (SANITIZER_FUCHSIA || SANITIZER_WINDOWS) ? -1 : 5000,
"Only affects a 64-bit allocator. If set, tries to release unused "
"memory to the OS, but not more often than this interval (in "
"milliseconds). Negative values mean do not attempt to release "
Index: lib/sanitizer_common/sanitizer_win.cc
===================================================================
--- lib/sanitizer_common/sanitizer_win.cc
+++ lib/sanitizer_common/sanitizer_win.cc
@@ -502,12 +502,19 @@
}
u64 NanoTime() {
- return 0;
+ static LARGE_INTEGER frequency = {0};
+ LARGE_INTEGER counter;
+ if (UNLIKELY(frequency.QuadPart == 0)) {
+ QueryPerformanceFrequency(&frequency);
+ CHECK_NE(frequency.QuadPart, 0);
+ }
+ QueryPerformanceCounter(&counter);
+ counter.QuadPart *= 1000ULL * 1000000ULL;
+ counter.QuadPart /= frequency.QuadPart;
+ return counter.QuadPart;
}
-u64 MonotonicNanoTime() {
- return 0;
-}
+u64 MonotonicNanoTime() { return NanoTime(); }
void Abort() {
internal__exit(3);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42579.132467.patch
Type: text/x-patch
Size: 1570 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180201/7cf0b969/attachment.bin>
More information about the llvm-commits
mailing list