1*0b57cec5SDimitry Andric //===- xray-converter.h - XRay Trace Conversion ---------------------------===// 2*0b57cec5SDimitry Andric // 3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric // 7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric // 9*0b57cec5SDimitry Andric // Defines the TraceConverter class for turning binary traces into 10*0b57cec5SDimitry Andric // human-readable text and vice versa. 11*0b57cec5SDimitry Andric // 12*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 13*0b57cec5SDimitry Andric #ifndef LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H 14*0b57cec5SDimitry Andric #define LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H 15*0b57cec5SDimitry Andric 16*0b57cec5SDimitry Andric #include "func-id-helper.h" 17*0b57cec5SDimitry Andric #include "llvm/XRay/Trace.h" 18*0b57cec5SDimitry Andric #include "llvm/XRay/XRayRecord.h" 19*0b57cec5SDimitry Andric 20*0b57cec5SDimitry Andric namespace llvm { 21*0b57cec5SDimitry Andric namespace xray { 22*0b57cec5SDimitry Andric 23*0b57cec5SDimitry Andric class TraceConverter { 24*0b57cec5SDimitry Andric FuncIdConversionHelper &FuncIdHelper; 25*0b57cec5SDimitry Andric bool Symbolize; 26*0b57cec5SDimitry Andric 27*0b57cec5SDimitry Andric public: 28*0b57cec5SDimitry Andric TraceConverter(FuncIdConversionHelper &FuncIdHelper, bool Symbolize = false) FuncIdHelper(FuncIdHelper)29*0b57cec5SDimitry Andric : FuncIdHelper(FuncIdHelper), Symbolize(Symbolize) {} 30*0b57cec5SDimitry Andric 31*0b57cec5SDimitry Andric void exportAsYAML(const Trace &Records, raw_ostream &OS); 32*0b57cec5SDimitry Andric void exportAsRAWv1(const Trace &Records, raw_ostream &OS); 33*0b57cec5SDimitry Andric 34*0b57cec5SDimitry Andric /// For this conversion, the Function records within each thread are expected 35*0b57cec5SDimitry Andric /// to be in sorted TSC order. The trace event format encodes stack traces, so 36*0b57cec5SDimitry Andric /// the linear history is essential for correct output. 37*0b57cec5SDimitry Andric void exportAsChromeTraceEventFormat(const Trace &Records, raw_ostream &OS); 38*0b57cec5SDimitry Andric }; 39*0b57cec5SDimitry Andric 40*0b57cec5SDimitry Andric } // namespace xray 41*0b57cec5SDimitry Andric } // namespace llvm 42*0b57cec5SDimitry Andric 43*0b57cec5SDimitry Andric #endif // LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H 44