[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / llvm / tools / llvm-xray / xray-converter.h
blobdb6d2b1614ee2394f16b9be61514bf92c0014085
1 //===- xray-converter.h - XRay Trace Conversion ---------------------------===//
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 // Defines the TraceConverter class for turning binary traces into
10 // human-readable text and vice versa.
12 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H
14 #define LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H
16 #include "func-id-helper.h"
17 #include "llvm/XRay/Trace.h"
18 #include "llvm/XRay/XRayRecord.h"
20 namespace llvm {
21 namespace xray {
23 class TraceConverter {
24 FuncIdConversionHelper &FuncIdHelper;
25 bool Symbolize;
27 public:
28 TraceConverter(FuncIdConversionHelper &FuncIdHelper, bool Symbolize = false)
29 : FuncIdHelper(FuncIdHelper), Symbolize(Symbolize) {}
31 void exportAsYAML(const Trace &Records, raw_ostream &OS);
32 void exportAsRAWv1(const Trace &Records, raw_ostream &OS);
34 /// For this conversion, the Function records within each thread are expected
35 /// to be in sorted TSC order. The trace event format encodes stack traces, so
36 /// the linear history is essential for correct output.
37 void exportAsChromeTraceEventFormat(const Trace &Records, raw_ostream &OS);
40 } // namespace xray
41 } // namespace llvm
43 #endif // LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H