[PATCH] D48956: [XRay][compiler-rt] Profiling Mode: Flush logs on exit

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 20:36:26 PDT 2018


dberris marked an inline comment as done.
dberris added inline comments.


================
Comment at: compiler-rt/lib/xray/xray_profiling.cc:296-300
+      // Finalize and flush.
+      if (profilingFinalize() != XRAY_LOG_FINALIZED)
+        return;
+      if (profilingFlush() != XRAY_LOG_FLUSHED)
+        return;
----------------
kpw wrote:
> Isn't it an error to unconditionally finalize and flush without checking the state first?
Not in this situation. Consider that this code is running in the initialisation of the profiling mode -- this means that in the lifetime of a program this mode has been initialised once. Notice that we're calling the profiling-mode specific finalization and flushing implementations at program exit. The implementation of either of these functions are then performing the invariant checks independently.


https://reviews.llvm.org/D48956





More information about the llvm-commits mailing list