Dean Michael Berris | 6e1f066 | 2017-01-10 02:38:11 +0000 | [diff] [blame] | 1 | //===- xray-converter.h - XRay Trace Conversion ---------------------------===// |
| 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 | // Defines the TraceConverter class for turning binary traces into |
| 11 | // human-readable text and vice versa. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | #ifndef LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H |
| 15 | #define LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H |
| 16 | |
| 17 | #include "func-id-helper.h" |
Dean Michael Berris | 14cdbca | 2017-01-11 06:39:09 +0000 | [diff] [blame] | 18 | #include "llvm/XRay/Trace.h" |
Keith Wyss | ed2657e | 2017-11-07 00:28:28 +0000 | [diff] [blame] | 19 | #include "llvm/XRay/XRayRecord.h" |
Dean Michael Berris | 6e1f066 | 2017-01-10 02:38:11 +0000 | [diff] [blame] | 20 | |
| 21 | namespace llvm { |
| 22 | namespace xray { |
| 23 | |
| 24 | class TraceConverter { |
| 25 | FuncIdConversionHelper &FuncIdHelper; |
| 26 | bool Symbolize; |
| 27 | |
| 28 | public: |
| 29 | TraceConverter(FuncIdConversionHelper &FuncIdHelper, bool Symbolize = false) |
| 30 | : FuncIdHelper(FuncIdHelper), Symbolize(Symbolize) {} |
| 31 | |
Dean Michael Berris | 14cdbca | 2017-01-11 06:39:09 +0000 | [diff] [blame] | 32 | void exportAsYAML(const Trace &Records, raw_ostream &OS); |
| 33 | void exportAsRAWv1(const Trace &Records, raw_ostream &OS); |
Keith Wyss | ed2657e | 2017-11-07 00:28:28 +0000 | [diff] [blame] | 34 | |
| 35 | /// For this conversion, the Function records within each thread are expected |
| 36 | /// to be in sorted TSC order. The trace event format encodes stack traces, so |
| 37 | /// the linear history is essential for correct output. |
| 38 | void exportAsChromeTraceEventFormat(const Trace &Records, raw_ostream &OS); |
Dean Michael Berris | 6e1f066 | 2017-01-10 02:38:11 +0000 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | } // namespace xray |
| 42 | } // namespace llvm |
| 43 | |
| 44 | #endif // LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H |