llvm-mirror/tools/llvm-xray/xray-converter.h
Dean Michael Berris 85c0bb36c3 [XRay] Define the library for XRay trace logs
Summary:
In this change we move the definition of the log reading routines from
the tools directory in LLVM to {include/llvm,lib}/XRay. We improve the
documentation a little bit for the publicly accessible headers, and
adjust the top-matter. This also leads to some refactoring and cleanup
in the tooling code.

In particular, we do the following:

  - Rename the class from LogReader to Trace, as it better represents
    the logical set of records as opposed to a log.
  - Use file type detection instead of asking the user to say what
    format the input file is. This allows us to keep the interface
    simple and encapsulate the logic of loading the data appropriately.

In future changes we increase the API surface and write dedicated unit
tests for the XRay library.

Depends on D24376.

Reviewers: dblaikie, echristo

Subscribers: mehdi_amini, mgorny, llvm-commits, varno

Differential Revision: https://reviews.llvm.org/D28345

llvm-svn: 291652
2017-01-11 06:39:09 +00:00

40 lines
1.2 KiB
C++

//===- xray-converter.h - XRay Trace Conversion ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Defines the TraceConverter class for turning binary traces into
// human-readable text and vice versa.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H
#define LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H
#include "func-id-helper.h"
#include "llvm/XRay/XRayRecord.h"
#include "llvm/XRay/Trace.h"
namespace llvm {
namespace xray {
class TraceConverter {
FuncIdConversionHelper &FuncIdHelper;
bool Symbolize;
public:
TraceConverter(FuncIdConversionHelper &FuncIdHelper, bool Symbolize = false)
: FuncIdHelper(FuncIdHelper), Symbolize(Symbolize) {}
void exportAsYAML(const Trace &Records, raw_ostream &OS);
void exportAsRAWv1(const Trace &Records, raw_ostream &OS);
};
} // namespace xray
} // namespace llvm
#endif // LLVM_TOOLS_LLVM_XRAY_XRAY_CONVERTER_H