1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00
llvm-mirror/include/llvm/XRay/RecordPrinter.h
Dean Michael Berris 05508f6a1d [XRay] Add a RecordPrinter visitor for FDR Records
Summary:
This change adds a `RecordPrinter` type which does some basic text
serialization of the FDR record instances. This is one component of the
tool we're building to dump the records from an FDR mode log as-is.

This is a small part of D50441.

Reviewers: eizan, kpw

Subscribers: mgorny, hiraditya, llvm-commits

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

llvm-svn: 341447
2018-09-05 06:57:23 +00:00

49 lines
1.5 KiB
C++

//===- RecordPrinter.h - FDR Record Printer -------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// An implementation of the RecordVisitor which prints an individual record's
// data in an adhoc format, suitable for human inspection.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_INCLUDE_LLVM_XRAY_RECORDPRINTER_H_
#define LLVM_INCLUDE_LLVM_XRAY_RECORDPRINTER_H_
#include "llvm/Support/raw_ostream.h"
#include "llvm/XRay/FDRRecords.h"
namespace llvm {
namespace xray {
class RecordPrinter : public RecordVisitor {
raw_ostream &OS;
std::string Delim;
public:
explicit RecordPrinter(raw_ostream &O, std::string D)
: RecordVisitor(), OS(O), Delim(std::move(D)) {}
explicit RecordPrinter(raw_ostream &O) : RecordPrinter(O, ""){};
Error visit(BufferExtents &) override;
Error visit(WallclockRecord &) override;
Error visit(NewCPUIDRecord &) override;
Error visit(TSCWrapRecord &) override;
Error visit(CustomEventRecord &) override;
Error visit(CallArgRecord &) override;
Error visit(PIDRecord &) override;
Error visit(NewBufferRecord &) override;
Error visit(EndBufferRecord &) override;
Error visit(FunctionRecord &) override;
};
} // namespace xray
} // namespace llvm
#endif // LLVM_INCLUDE_LLVM_XRAY_RECORDPRINTER_H