[PATCH] D21982: [compiler-rt][XRay] Initial per-thread inmemory logging implementation

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 23:31:35 PDT 2016


dberris added inline comments.

================
Comment at: lib/xray/xray_inmemory_log.cc:71
@@ +70,3 @@
+  explicit ThreadExitFlusher(int Fd, XRayRecord *Start, size_t &Offset)
+      : Fd(Fd), Start(Start), Offset(Offset) {}
+
----------------
majnemer wrote:
> Should we assert that Fd > 0?
Instead of asserting, I check that Fd is valid before using it in the write in the destructor.


================
Comment at: lib/xray/xray_inmemory_log.cc:77
@@ +76,3 @@
+                  reinterpret_cast<char *>(Start + Offset));
+    fsync(Fd);
+  }
----------------
majnemer wrote:
> Why do we have this `fsync`? Might deserve a comment.
Explained a little in a comment, essentially because we're not doing any sort of reference counting (for simplicity's sake) we rely on the sync to flush the data at a thread's exit. We can implement reference counting, but that would complicate this a bit more than necessary IMO.


https://reviews.llvm.org/D21982





More information about the llvm-commits mailing list