1 //===- BlockPrinter.cpp - FDR Block Pretty Printer Implementation --------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 #include "llvm/XRay/BlockPrinter.h"
14 Error BlockPrinter::visit(BufferExtents &R) {
15 OS << "\n[New Block]\n";
16 CurrentState = State::Preamble;
21 Error BlockPrinter::visit(NewBufferRecord &R) {
22 if (CurrentState == State::Start)
23 OS << "\n[New Block]\n";
26 CurrentState = State::Preamble;
30 Error BlockPrinter::visit(WallclockRecord &R) {
31 CurrentState = State::Preamble;
35 Error BlockPrinter::visit(PIDRecord &R) {
36 CurrentState = State::Preamble;
41 Error BlockPrinter::visit(NewCPUIDRecord &R) {
42 if (CurrentState == State::Preamble)
44 if (CurrentState == State::Function)
46 CurrentState = State::Metadata;
52 Error BlockPrinter::visit(TSCWrapRecord &R) {
53 if (CurrentState == State::Function)
55 CurrentState = State::Metadata;
61 // Custom events will be rendered like "function" events.
62 Error BlockPrinter::visit(CustomEventRecord &R) {
63 if (CurrentState == State::Metadata)
65 CurrentState = State::CustomEvent;
71 Error BlockPrinter::visit(CustomEventRecordV5 &R) {
72 if (CurrentState == State::Metadata)
74 CurrentState = State::CustomEvent;
80 Error BlockPrinter::visit(TypedEventRecord &R) {
81 if (CurrentState == State::Metadata)
83 CurrentState = State::CustomEvent;
89 // Function call printing.
90 Error BlockPrinter::visit(FunctionRecord &R) {
91 if (CurrentState == State::Metadata)
93 CurrentState = State::Function;
99 Error BlockPrinter::visit(CallArgRecord &R) {
100 CurrentState = State::Arg;
102 auto E = RP.visit(R);
106 Error BlockPrinter::visit(EndBufferRecord &R) {
107 CurrentState = State::End;
109 auto E = RP.visit(R);