[PATCH] D21982: WIP: Implement a per-thread inmemory log

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 00:45:19 PDT 2016


majnemer added a subscriber: majnemer.

================
Comment at: lib/xray/xray_inmemory_log.cc:107
@@ +106,3 @@
+  uint32_t CPU;
+  __asm__ __volatile__("rdtscp" : "=a"(Lo), "=d"(Hi), "=c"(CPU));
+  R.CPU = CPU;
----------------
Could you please use the `__rdtscp` intrinsic?
Might be good to only do so if you are on X86 with a fallback of `__builtin_readcyclecounter` ?

================
Comment at: lib/xray/xray_inmemory_log.cc:116
@@ +115,3 @@
+    std::lock_guard<std::mutex> L(__xray::LogMutex);
+    write(Fd, InMemoryBuffer, sizeof(__xray::XRayRecord) * __xray::BuffLen);
+    Offset = 0;
----------------
What if you get a partial write?


http://reviews.llvm.org/D21982





More information about the llvm-commits mailing list