[PATCH] D21982: WIP: Implement a per-thread inmemory log
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 5 01:11:09 PDT 2016
dberris marked 2 inline comments as done.
================
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;
----------------
majnemer wrote:
> 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` ?
Using the __rdtscp intrinsic, let's cross the bridge for non-x86 later?
================
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;
----------------
majnemer wrote:
> What if you get a partial write?
Good catch! Makes the code a bit more complicated, but more correct AFAICT now.
http://reviews.llvm.org/D21982
More information about the llvm-commits
mailing list