[PATCH] D42579: [sanitizer] Implement NanoTime & MonotonicNanoTime for Windows

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 10:28:19 PST 2018


alekseyshl added a comment.

Should we turn return-to-os off by default on Windows then? So that we won't waste time walking free lists.



================
Comment at: lib/sanitizer_common/sanitizer_win.cc:505
 u64 NanoTime() {
-  return 0;
+  static LARGE_INTEGER frequency = {0};
+  LARGE_INTEGER counter;
----------------
Why function static, why not at the top level?


================
Comment at: lib/sanitizer_common/sanitizer_win.cc:512
+  QueryPerformanceCounter(&counter);
+  counter.QuadPart *= 1000U * 1000000U;
+  counter.QuadPart /= frequency.QuadPart;
----------------
ULL


================
Comment at: lib/sanitizer_common/sanitizer_win.cc:513
+  counter.QuadPart *= 1000U * 1000000U;
+  counter.QuadPart /= frequency.QuadPart;
+  return counter.QuadPart;
----------------
I wonder what frequency.QuadPart values typically are.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D42579





More information about the llvm-commits mailing list