aboutsummaryrefslogtreecommitdiff
path: root/include/xray/xray_log_interface.h
blob: a8709c3a7c8a97e27eadde0a85ab68f301a2f3b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//===-- xray_log_interface.h ----------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of XRay, a function call tracing system.
//
// APIs for installing a new logging implementation.
//===----------------------------------------------------------------------===//
#ifndef XRAY_XRAY_LOG_INTERFACE_H
#define XRAY_XRAY_LOG_INTERFACE_H

#include "xray/xray_interface.h"
#include <stddef.h>

extern "C" {

enum XRayLogInitStatus {
  XRAY_LOG_UNINITIALIZED = 0,
  XRAY_LOG_INITIALIZING = 1,
  XRAY_LOG_INITIALIZED = 2,
  XRAY_LOG_FINALIZING = 3,
  XRAY_LOG_FINALIZED = 4,
};

enum XRayLogFlushStatus {
  XRAY_LOG_NOT_FLUSHING = 0,
  XRAY_LOG_FLUSHING = 1,
  XRAY_LOG_FLUSHED = 2,
};

struct XRayLogImpl {
  XRayLogInitStatus (*log_init)(size_t, size_t, void *, size_t);
  XRayLogInitStatus (*log_finalize)();
  void (*handle_arg0)(int32_t, XRayEntryType);
  XRayLogFlushStatus (*flush_log)();
};

void __xray_set_log_impl(XRayLogImpl Impl);
XRayLogInitStatus __xray_log_init(size_t BufferSize, size_t MaxBuffers,
                                  void *Args, size_t ArgsSize);
XRayLogInitStatus __xray_log_finalize();
XRayLogFlushStatus __xray_log_flushLog();

} // extern "C"

namespace __xray {
// Options used by the LLVM XRay FDR implementation.
struct FDRLoggingOptions {
  bool ReportErrors = false;
  int Fd = -1;
};

} // namespace __xray

#endif // XRAY_XRAY_LOG_INTERFACE_H