Home | History | Annotate | Download | only in xray
      1 //===-- xray_log_interface.h ----------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file is a part of XRay, a function call tracing system.
     11 //
     12 // APIs for installing a new logging implementation.
     13 //===----------------------------------------------------------------------===//
     14 #ifndef XRAY_XRAY_LOG_INTERFACE_H
     15 #define XRAY_XRAY_LOG_INTERFACE_H
     16 
     17 #include "xray/xray_interface.h"
     18 #include <stddef.h>
     19 
     20 extern "C" {
     21 
     22 enum XRayLogInitStatus {
     23   XRAY_LOG_UNINITIALIZED = 0,
     24   XRAY_LOG_INITIALIZING = 1,
     25   XRAY_LOG_INITIALIZED = 2,
     26   XRAY_LOG_FINALIZING = 3,
     27   XRAY_LOG_FINALIZED = 4,
     28 };
     29 
     30 enum XRayLogFlushStatus {
     31   XRAY_LOG_NOT_FLUSHING = 0,
     32   XRAY_LOG_FLUSHING = 1,
     33   XRAY_LOG_FLUSHED = 2,
     34 };
     35 
     36 struct XRayLogImpl {
     37   XRayLogInitStatus (*log_init)(size_t, size_t, void *, size_t);
     38   XRayLogInitStatus (*log_finalize)();
     39   void (*handle_arg0)(int32_t, XRayEntryType);
     40   XRayLogFlushStatus (*flush_log)();
     41 };
     42 
     43 void __xray_set_log_impl(XRayLogImpl Impl);
     44 XRayLogInitStatus __xray_log_init(size_t BufferSize, size_t MaxBuffers,
     45                                   void *Args, size_t ArgsSize);
     46 XRayLogInitStatus __xray_log_finalize();
     47 XRayLogFlushStatus __xray_log_flushLog();
     48 
     49 } // extern "C"
     50 
     51 namespace __xray {
     52 // Options used by the LLVM XRay FDR implementation.
     53 struct FDRLoggingOptions {
     54   bool ReportErrors = false;
     55   int Fd = -1;
     56 };
     57 
     58 } // namespace __xray
     59 
     60 #endif // XRAY_XRAY_LOG_INTERFACE_H
     61