xray-converter.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H
  14. #define LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H
  15. #include "func-id-helper.h"
  16. #include "llvm/XRay/Trace.h"
  17. #include "llvm/XRay/XRayRecord.h"
  18. namespace llvm {
  19. namespace xray {
  20. class TraceConverter {
  21. FuncIdConversionHelper &FuncIdHelper;
  22. bool Symbolize;
  23. public:
  24. TraceConverter(FuncIdConversionHelper &FuncIdHelper, bool Symbolize = false)
  25. : FuncIdHelper(FuncIdHelper), Symbolize(Symbolize) {}
  26. void exportAsYAML(const Trace &Records, raw_ostream &OS);
  27. void exportAsRAWv1(const Trace &Records, raw_ostream &OS);
  28. /// For this conversion, the Function records within each thread are expected
  29. /// to be in sorted TSC order. The trace event format encodes stack traces, so
  30. /// the linear history is essential for correct output.
  31. void exportAsChromeTraceEventFormat(const Trace &Records, raw_ostream &OS);
  32. };
  33. } // namespace xray
  34. } // namespace llvm
  35. #endif // LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H