[PATCH] D31967: [XRay][compiler-rt] Add another work-around to XRay FDR tests when TSC emulation is needed

Douglas Yung via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 11 18:37:28 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL300017: [XRay][compiler-rt] Add another work-around to XRay FDR tests when TSC… (authored by dyung).

Changed prior to commit:
  https://reviews.llvm.org/D31967?vs=94915&id=94926#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31967

Files:
  compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
  compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h


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
@@ -120,7 +120,8 @@
   XRayFileHeader Header;
   Header.Version = 1;
   Header.Type = FileTypes::FDR_LOG;
-  Header.CycleFrequency = getTSCFrequency();
+  Header.CycleFrequency = probeRequiredCPUFeatures()
+                          ? getTSCFrequency() : __xray::NanosecondsPerSecond;
   // FIXME: Actually check whether we have 'constant_tsc' and 'nonstop_tsc'
   // before setting the values in the header.
   Header.ConstantTSC = 1;
Index: compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
===================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
@@ -423,7 +423,9 @@
       return;
     }
 
-    uint64_t CycleFrequency = getTSCFrequency();
+    uint64_t CycleFrequency = probeRequiredCPUFeatures()
+                              ? getTSCFrequency()
+                              : __xray::NanosecondsPerSecond;
     NumberOfTicksThreshold = CycleFrequency *
                              flags()->xray_fdr_log_func_duration_threshold_us /
                              1000000;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31967.94926.patch
Type: text/x-patch
Size: 1329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170412/03856b62/attachment.bin>


More information about the llvm-commits mailing list