xref: /freebsd/contrib/llvm-project/compiler-rt/lib/xray/xray_fdr_logging.h (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1 //===-- xray_fdr_logging.h ------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of XRay, a function call tracing system.
10 //
11 //===----------------------------------------------------------------------===//
12 #ifndef XRAY_XRAY_FDR_LOGGING_H
13 #define XRAY_XRAY_FDR_LOGGING_H
14 
15 #include "xray/xray_log_interface.h"
16 #include "xray_fdr_log_records.h"
17 
18 // FDR (Flight Data Recorder) Mode
19 // ===============================
20 //
21 // The XRay whitepaper describes a mode of operation for function call trace
22 // logging that involves writing small records into an in-memory circular
23 // buffer, that then gets logged to disk on demand. To do this efficiently and
24 // capture as much data as we can, we use smaller records compared to the
25 // default mode of always writing fixed-size records.
26 
27 namespace __xray {
28 XRayLogInitStatus fdrLoggingInit(size_t BufferSize, size_t BufferMax,
29                                  void *Options, size_t OptionsSize);
30 XRayLogInitStatus fdrLoggingFinalize();
31 void fdrLoggingHandleArg0(int32_t FuncId, XRayEntryType Entry);
32 void fdrLoggingHandleArg1(int32_t FuncId, XRayEntryType Entry, uint64_t Arg1);
33 XRayLogFlushStatus fdrLoggingFlush();
34 XRayLogInitStatus fdrLoggingReset();
35 
36 } // namespace __xray
37 
38 #endif // XRAY_XRAY_FDR_LOGGING_H
39