summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/xray/xray_log_interface.cc
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-05-01 00:52:57 +0000
committerDean Michael Berris <dberris@google.com>2017-05-01 00:52:57 +0000
commitfea2d0b8bf28a12ad54b8061fa72f996abcbe12a (patch)
treec024376409bd13656219514eee16bc0a9221a51a /compiler-rt/lib/xray/xray_log_interface.cc
parentbe4773c2c47490ec023c8d9779c10c14bf46588c (diff)
downloadbcm5719-llvm-fea2d0b8bf28a12ad54b8061fa72f996abcbe12a.tar.gz
bcm5719-llvm-fea2d0b8bf28a12ad54b8061fa72f996abcbe12a.zip
[XRay][compiler-rt] Document and update the XRay Logging API
Summary: In this patch we document the requirements for implementations that want to install handlers for the dynamically-controlled XRay "framework". This clarifies what the expectations are for implementations that want to install their handlers using this API (similar to how the FDR logging implementation does so). It also gives users some guarantees on semantics for the APIs. If all goes well, users can decide to use the XRay APIs to control the tracing/logging at the application level, without having to depend on implementation details of the installed logging implementation. This lets users choose the implementation that comes with compiler-rt, or potentially multiple other implementations that use the same APIs. We also add one convenience function (__xray_remove_log_impl()) for explicitly removing the currently installed log implementation. Reviewers: kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32579 llvm-svn: 301784
Diffstat (limited to 'compiler-rt/lib/xray/xray_log_interface.cc')
-rw-r--r--compiler-rt/lib/xray/xray_log_interface.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler-rt/lib/xray/xray_log_interface.cc b/compiler-rt/lib/xray/xray_log_interface.cc
index ffed601c05c..ee14ae4b1b6 100644
--- a/compiler-rt/lib/xray/xray_log_interface.cc
+++ b/compiler-rt/lib/xray/xray_log_interface.cc
@@ -27,12 +27,22 @@ void __xray_set_log_impl(XRayLogImpl Impl) XRAY_NEVER_INSTRUMENT {
Impl.handle_arg0 == nullptr || Impl.flush_log == nullptr) {
__sanitizer::SpinMutexLock Guard(&XRayImplMutex);
GlobalXRayImpl.reset();
+ __xray_remove_handler();
+ __xray_remove_handler_arg1();
return;
}
__sanitizer::SpinMutexLock Guard(&XRayImplMutex);
GlobalXRayImpl.reset(new XRayLogImpl);
*GlobalXRayImpl = Impl;
+ __xray_set_handler(Impl.handle_arg0);
+}
+
+void __xray_remove_log_impl() XRAY_NEVER_INSTRUMENT {
+ __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ GlobalXRayImpl.reset();
+ __xray_remove_handler();
+ __xray_remove_handler_arg1();
}
XRayLogInitStatus __xray_log_init(size_t BufferSize, size_t MaxBuffers,
OpenPOWER on IntegriCloud