[PATCH] D43278: Add Xray instrumentation support to FreeBSD

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 07:46:26 PST 2018


krytarowski added inline comments.


================
Comment at: lib/xray/tests/CMakeLists.txt:28
           -lstdc++ -lm ${CMAKE_THREAD_LIBS_INIT}
           -lpthread
+          ${CMAKE_DL_LIBS} -lrt)
----------------
while there - `${CMAKE_THREAD_LIBS_INIT}` is equivalent to `-lpthread`


================
Comment at: lib/xray/tests/unit/fdr_logging_test.cc:162
       fdrLoggingHandleArg0(I + 1, XRayEntryType::EXIT);
+#ifdef __linux__
       Threads[I] = syscall(SYS_gettid);
----------------
Can we encapsulate this in something like `xray_gettid()`?


================
Comment at: lib/xray/xray_x86_64.cc:286
+#else
+  __asm__ __volatile__("cpuid" : "=a"(EAX), "=b"(EBX), "=c"(ECX), "=d"(EDX)
+    : "0"(0x80000001));
----------------
This should be used for all OSes. `__get_cpuid` is GLIBC specific.


================
Comment at: lib/xray/xray_x86_64.inc:30
+  unsigned Rax, Rdx;
+  __asm__ __volatile__("rdtscp\n" : "=a"(Rax), "=b"(Rdx), "=c"(LongCPU) ::);
+  CPU = LongCPU;
----------------
This should be used for all OSes.


https://reviews.llvm.org/D43278





More information about the llvm-commits mailing list