[PATCH] D31909: [XRay][compiler-rt] Add support for TSC emulation for x86_64 to xray_fdr_logging.cc
Douglas Yung via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 00:58:04 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299922: [XRay][compiler-rt] Add support for TSC emulation for x86_64 to… (authored by dyung).
Changed prior to commit:
https://reviews.llvm.org/D31909?vs=94748&id=94790#toc
Repository:
rL LLVM
https://reviews.llvm.org/D31909
Files:
compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
Index: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
===================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
@@ -192,7 +192,21 @@
// we've seen this CPU before. We also do it before we load anything else, to
// allow for forward progress with the scheduling.
unsigned char CPU;
- uint64_t TSC = __xray::readTSC(CPU);
+ uint64_t TSC;
+
+ if(probeRequiredCPUFeatures()) {
+ TSC = __xray::readTSC(CPU);
+ } else {
+ // FIXME: This code needs refactoring as it appears in multiple locations
+ timespec TS;
+ int result = clock_gettime(CLOCK_REALTIME, &TS);
+ if (result != 0) {
+ Report("clock_gettime(2) return %d, errno=%d", result, int(errno));
+ TS = {0, 0};
+ }
+ CPU = 0;
+ TSC = TS.tv_sec * __xray::NanosecondsPerSecond + TS.tv_nsec;
+ }
__xray_fdr_internal::processFunctionHook(FuncId, Entry, TSC, CPU,
clock_gettime, LoggingStatus, BQ);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31909.94790.patch
Type: text/x-patch
Size: 1054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170411/f6ffc8cf/attachment.bin>
More information about the llvm-commits
mailing list