[PATCH] D40703: [XRay][compiler-rt] Implement logging implementation registration

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 01:12:19 PST 2017


dberris created this revision.

This change allows for registration of multiple logging implementations
through a central mechanism in XRay, mapping an implementation to a
"mode". Modes are strings that are used as keys to determine which
implementation to install through a single API. This mechanism allows
users to choose which implementation to install either from the
environment variable 'XRAY_OPTIONS' with the `xray_mode=` flag, or
programmatically using the `__xray_select_mode(...)` function.

Here, we introduce two API functions for the XRay logging:

__xray_log_register_mode(Mode, Impl): Associates an XRayLogImpl to a
string Mode. We can only have one implementation associated with a given
Mode.

__xray_log_select_mode(Mode): Finds the associated Impl for Mode and
installs it as if by calling `__xray_set_log_impl(...)`.

Along with these changes, we also deprecate the xray_naive_log and
xray_fdr_log flags and encourage users to instead use the xray_mode
flag.


https://reviews.llvm.org/D40703

Files:
  compiler-rt/include/xray/xray_log_interface.h
  compiler-rt/lib/xray/xray_fdr_logging.cc
  compiler-rt/lib/xray/xray_flags.inc
  compiler-rt/lib/xray/xray_inmemory_log.cc
  compiler-rt/lib/xray/xray_log_interface.cc
  compiler-rt/test/xray/TestCases/Linux/logging-modes.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40703.125083.patch
Type: text/x-patch
Size: 11991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171201/046017a8/attachment.bin>


More information about the llvm-commits mailing list