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

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 10:38:57 PST 2018


cryptoad added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_win.cc:505
 u64 NanoTime() {
-  return 0;
+  static LARGE_INTEGER frequency = {0};
+  LARGE_INTEGER counter;
----------------
alekseyshl wrote:
> Why function static, why not at the top level?
It's only used here, I didn't feel like it warranted being outside of the scope of the function.


================
Comment at: lib/sanitizer_common/sanitizer_win.cc:513
+  counter.QuadPart *= 1000U * 1000000U;
+  counter.QuadPart /= frequency.QuadPart;
+  return counter.QuadPart;
----------------
alekseyshl wrote:
> I wonder what frequency.QuadPart values typically are.
On my test machine: 0x2fcd8 (ticks/s).


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D42579





More information about the llvm-commits mailing list