[PATCH] D40164: [XRay][compiler-rt] Migrate basic mode logging to the XRay framework

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 21:43:59 PST 2017


dberris created this revision.

Before this patch, XRay's basic (naive mode) logging would be
initialised and installed in an adhoc manner. This patch ports the
implementation of the basic (naive mode) logging implementation to use
the common XRay framework.

We also make the following changes to reduce the variance between the
usage model of basic mode from FDR (flight data recorder) mode:

- Allow programmatic control of the size of the buffers dedicated to per-thread records. This removes some hard-coded constants and turns them into runtime-controllable flags and through an Options structure.
- Default the `xray_naive_log` option to false. For now, the only way to start basic mode is to set the environment variable, or set the default at build-time compiler options. Because of this change we've had to update a couple of tests relying on basic mode being always on.
- Removed the reliance on a non-trivially destructible per-thread resource manager. We use a similar trick done in https://reviews.llvm.org/D39526 to use pthread_key_create() and pthread_setspecific() to ensure that the per-thread cleanup handling is performed at thread-exit time.

We also radically simplify the code structure for basic mode, to move
most of the implementation in the `__xray` namespace.


https://reviews.llvm.org/D40164

Files:
  compiler-rt/include/xray/xray_log_interface.h
  compiler-rt/lib/xray/xray_flags.inc
  compiler-rt/lib/xray/xray_inmemory_log.cc
  compiler-rt/lib/xray/xray_inmemory_log.h
  compiler-rt/test/xray/TestCases/Linux/arg1-logger.cc
  compiler-rt/test/xray/TestCases/Linux/pic_test.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40164.123289.patch
Type: text/x-patch
Size: 19078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171117/1bc788eb/attachment.bin>


More information about the llvm-commits mailing list