Dean Michael Berris | f8f909f | 2017-01-10 02:38:11 +0000 | [diff] [blame] | 1 | //===- xray-converter.h - XRay Trace Conversion ---------------------------===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Dean Michael Berris | f8f909f | 2017-01-10 02:38:11 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // Defines the TraceConverter class for turning binary traces into |
| 10 | // human-readable text and vice versa. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | #ifndef LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H |
| 14 | #define LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H |
| 15 | |
| 16 | #include "func-id-helper.h" |
Dean Michael Berris | d6c1865 | 2017-01-11 06:39:09 +0000 | [diff] [blame] | 17 | #include "llvm/XRay/Trace.h" |
Keith Wyss | 4242799 | 2017-11-07 00:28:28 +0000 | [diff] [blame] | 18 | #include "llvm/XRay/XRayRecord.h" |
Dean Michael Berris | f8f909f | 2017-01-10 02:38:11 +0000 | [diff] [blame] | 19 | |
| 20 | namespace llvm { |
| 21 | namespace xray { |
| 22 | |
| 23 | class TraceConverter { |
| 24 | FuncIdConversionHelper &FuncIdHelper; |
| 25 | bool Symbolize; |
| 26 | |
| 27 | public: |
| 28 | TraceConverter(FuncIdConversionHelper &FuncIdHelper, bool Symbolize = false) |
| 29 | : FuncIdHelper(FuncIdHelper), Symbolize(Symbolize) {} |
| 30 | |
Dean Michael Berris | d6c1865 | 2017-01-11 06:39:09 +0000 | [diff] [blame] | 31 | void exportAsYAML(const Trace &Records, raw_ostream &OS); |
| 32 | void exportAsRAWv1(const Trace &Records, raw_ostream &OS); |
Keith Wyss | 4242799 | 2017-11-07 00:28:28 +0000 | [diff] [blame] | 33 | |
| 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); |
Dean Michael Berris | f8f909f | 2017-01-10 02:38:11 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } // namespace xray |
| 41 | } // namespace llvm |
| 42 | |
| 43 | #endif // LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H |