42 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9// Defines the TraceConverter class for turning binary traces into10// human-readable text and vice versa.11//12//===----------------------------------------------------------------------===//13#ifndef LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H14#define LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H15 16#include "func-id-helper.h"17#include "llvm/XRay/Trace.h"18#include "llvm/XRay/XRayRecord.h"19 20namespace llvm::xray {21 22class TraceConverter {23 FuncIdConversionHelper &FuncIdHelper;24 bool Symbolize;25 26public:27 TraceConverter(FuncIdConversionHelper &FuncIdHelper, bool Symbolize = false)28 : FuncIdHelper(FuncIdHelper), Symbolize(Symbolize) {}29 30 void exportAsYAML(const Trace &Records, raw_ostream &OS);31 void exportAsRAWv1(const Trace &Records, raw_ostream &OS);32 33 /// For this conversion, the Function records within each thread are expected34 /// to be in sorted TSC order. The trace event format encodes stack traces, so35 /// the linear history is essential for correct output.36 void exportAsChromeTraceEventFormat(const Trace &Records, raw_ostream &OS);37};38 39} // namespace llvm::xray40 41#endif // LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H42