[PATCH] D38493: [XRay] [compiler-rt] make sure single threaded programs get traced too

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 04:52:15 PDT 2017


dberris added inline comments.


================
Comment at: lib/xray/xray_fdr_logging.cc:119-127
+
+  // The buffer for this particular thread would have been finalised after
+  // we've written everything to disk, and we'd lose the thread's trace.
+  auto &TLD = __xray::__xray_fdr_internal::getThreadLocalData();
+  if (TLD.Buffer.Buffer != nullptr) {
+    __xray::__xray_fdr_internal::writeEOBMetadata();
+    auto Start = reinterpret_cast<char *>(TLD.Buffer.Buffer);
----------------
Shouldn't this happen before we write out the data instead, so we don't need to do a special write here?


================
Comment at: test/xray/TestCases/Linux/fdr-single-thread.cc:2
+// RUN: %clangxx_xray -g -std=c++11 %s -o %t
+// RUN: XRAY_OPTIONS=XRAY_OPTIONS="verbosity=1 patch_premain=true xray_naive_log=false xray_fdr_log=true xray_fdr_log_func_duration_threshold_us=0 xray_logfile_base=fdr-logging-1thr-" %run %t 2>&1
+// RUN: %llvm_xray convert --output-format=yaml --symbolize --instr_map=%t "`ls fdr-logging-1thr-* | head -n1`" | FileCheck %s --check-prefix=TRACE
----------------
Consider breaking these up with slashes:

```
// RUN: ... \
// RUN:     ... \
// RUN:     ...
```


https://reviews.llvm.org/D38493





More information about the llvm-commits mailing list